The issue in brief: Within an object literal, if a standalone comment was followed by a commented symbol, the symbol's comment would not be attached correctly.
The fix essentially reverts the changes for #565, which are no longer needed thanks to 50cd99fa2fca753fcf7c9ec3ecf70afd47168e94.
The fix also corrects the order in which we walk a MemberExpression's child nodes. Without this correction, comments would not be attached correctly inside CallExpression nodes.
For consistency with method parameters, this change extends our unfortunate practice of adding type properties to the parent of the `type` object, rather than the object itself.
Without the fix, we get the following when running ./jsdoc -T:
Failures:
jsdoc/src/filter Filter isIncluded
1) should be able to exclude descendants of excluded subdirectories
Message:
Expected 4 to be 2.
Stacktrace:
undefined
2) should be able to exclude descendants of excluded subdirectories
Message:
Expected 1 to be -1.
Stacktrace:
undefined
3) should be able to exclude descendants of excluded subdirectories
Message:
Expected 3 to be -1.
Stacktrace:
undefined
Finished in 6.696 seconds
849 tests, 2050 assertions, 3 failures
This test passes with the fix.
There were three separate problems here:
1. The visitor called `trackVars` at the wrong time for `AssignmentExpression` and `VariableDeclarator` nodes, which prevented JSDoc from setting the `funcscope` property correctly.
2. The `funcscope` property was being added to `VariableDeclarator` nodes. It should only be added to `AssignmentExpression` nodes.
3. We were trying to resolve the variable name `____` in `AssignmentExpression` nodes. This is a special value we add to the source code so that the `lends` tag will work, and it should never be resolved against the enclosing scope.
The previous, buggy behavior looked reasonable in most cases, but it didn't work for closures that contain multiple `lends` tags.
Prior to this fix, if a file was outside of the JSDoc
directory, and your code included something like a
`@file` tag, we would set the doclet's name to the
entire filepath instead of the shortened filepath.
With this fix, we set the name to the shortened
filepath.
We previously set the doclet's scope by adding a
`@scope` tag, which, in turn, was used to update
the scope. Since this tag isn't defined or used in
any other context, it could cause "not a known
tag" errors.