Skip to content

Conversation

@GeoffreyBooth
Copy link
Collaborator

Fixes #4756, where comments where lost before return @foo ? 42. This is because the “salvage comments” code in the Existence class was using eachChild, which only looks at the immediate children of the expression, rather than traverseChildren, which drills down to all descendant children. When the expression contains @, as in @foo instead of just foo, the comments are one level deeper than where they would be on just foo.

Previously I was covering accessors via a second check for child.name, but that just masked the real issue (that I wasn’t drilling down far enough) by selectively diving down just in the case of the name property. Now that we’re searching the entire tree, there’s no need for a special check for a name grandchild node.

…tence, we need to search all its descendants, not just the immediate children
@GeoffreyBooth GeoffreyBooth merged commit f3375e7 into jashkenas:master Oct 26, 2017
@GeoffreyBooth GeoffreyBooth deleted the comment-before-this branch October 26, 2017 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant