Repository: eslint/doctrine (js)

Issue:
Incorrect parsing of parameter without type
For this code, the `selector` parameter appears to be parsed incorrectly:

```
/**
 * Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification.
 * This operator is a specialization of Multicast using a AsyncSubject.
 *
 * @example
 * var res = source.publishLast();
 * var res = source.publishLast(function (x) { return x; });
 *
 * @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will only receive the last notification of the source.
 * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
 */
```

This actually looks like a bug in `doctrine` because the `selector` parameter is missing a name:

```
{ title: 'param',
  description: '[Optional] Selector function which can use the multicasted sourc
e sequence as many times as needed, without causing multiple subscriptions to th
e source sequence. Subscribers to the given source will only receive the last no
tification of the source.',
  type: undefined,
  name: undefined }
```



Pull request:
Fix: Parsing of parameter name without a type (fixes #120)

Patch:
diff --git a/lib/doctrine.js b/lib/doctrine.js
index edf76a7..5ef5967 100644
--- a/lib/doctrine.js
+++ b/lib/doctrine.js
@@ -581,7 +581,9 @@
             // un-fix potentially sloppy declaration
             if (isParamTitle(this._title) && !this._tag.type && description && description.charAt(0) === '[') {
                 this._tag.type = this._extra.name;
-                this._tag.name = undefined;
+                if (!this._tag.name) {
+                    this._tag.name = undefined;
+                }
 
                 if (!sloppy) {
                     if (!this.addError('Missing or invalid tag name')) {


Test patch:
diff --git a/test/parse.js b/test/parse.js
index 49061a8..96f8b13 100644
--- a/test/parse.js
+++ b/test/parse.js
@@ -458,6 +458,20 @@ describe('parse', function () {
     });
 
     it('param typeless', function () {
+        var res = doctrine.parse(
+            [
+                "/**",
+                " * @param something [bye] hi",
+                "*/"
+            ].join('\n'), { unwrap: true, sloppy: true });
+        res.tags.should.have.length(1);
+        res.tags[0].should.eql({
+            title: 'param',
+            type: undefined,
+            name: 'something',
+            description: "[bye] hi"
+        });
+
         var res = doctrine.parse(
         [
             "/**",