Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix misprinting of computed properties in method chains. #108

Closed
wants to merge 1 commit into from
Closed

Fix misprinting of computed properties in method chains. #108

wants to merge 1 commit into from

Conversation

bnjmnt4n
Copy link
Contributor

Closes #23, #94.

@@ -1953,7 +1953,7 @@ function printMemberChain(node, options, print) {
if (hasMultipleLookups) {
const currPrinted = print(FastPath.from(curr));
const nodesPrinted = nodes.map(node => ({
property: print(FastPath.from(node.property)),
property: printMemberLookup(FastPath.from(node), print),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node is not a good variable name here (my fault). It's not actually supposed to be a valid AST node. It just is a collection of AST nodes that I need to print individually. The fact that this works is a coincidence; for example node here has a call property which is not a valid AST property.

What you need to do is on line 1929, instead of adding property: curr.callee.property to the object, change it to something like this: member: curr.callee. Keep the MemberExpression around, not just the property. And then in the code here you can do printMemberLookup(FastPath.from(node.member), print).

@bnjmnt4n
Copy link
Contributor Author

Updated!

@jlongster
Copy link
Member

Wow, great work! Thanks a lot!

@jlongster
Copy link
Member

Argh, sorry, there's a conflict. Mind rebasing and regenerating the snapshots again? That's the easiest way to resolve it.

@jlongster
Copy link
Member

Superseded by #157

@jlongster jlongster closed this Jan 12, 2017
@bnjmnt4n bnjmnt4n deleted the fix-chain branch January 15, 2017 09:57
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jan 21, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants