-
Notifications
You must be signed in to change notification settings - Fork 133
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
assignment/update Plugin #148
Conversation
a = 2 a *= 2 Treats each assignment operator as a binary operator, but replaces the binary expression with the 'AssignmentExpression' node type afterward
Add esprima comparison tests
src/plugins/jsepAssignment.js
Outdated
]); | ||
const updateOperators = [PLUS_CODE, MINUS_CODE]; | ||
const updateNodeTypes = [jsep.IDENTIFIER, jsep.MEMBER_EXP]; | ||
assignmentOperators.forEach(op => jsep.addBinaryOp(op, 0.9)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why 0.9?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked up the operator precedence table, but I just realized I read the precedence backward because assignment operators are lowest priority (3) so I'll update...
# Conflicts: # README.md # rollup.config.js # test/tests.js
Assignment and Update expression support plugin
a = 2
a *= 2
a++
--a