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

assignment/update Plugin #148

Merged
merged 7 commits into from
Aug 2, 2021
Merged

assignment/update Plugin #148

merged 7 commits into from
Aug 2, 2021

Conversation

6utt3rfly
Copy link
Collaborator

Assignment and Update expression support plugin
a = 2
a *= 2
a++
--a

a = 2
a *= 2

Treats each assignment operator as a binary operator, but replaces the binary expression with the 'AssignmentExpression' node type afterward
@6utt3rfly 6utt3rfly changed the title Plugin assignment/update assignment/update Plugin Jul 18, 2021
@6utt3rfly 6utt3rfly changed the base branch from plugin-obj-build to plugin-system July 21, 2021 16:28
@6utt3rfly 6utt3rfly mentioned this pull request Jul 26, 2021
]);
const updateOperators = [PLUS_CODE, MINUS_CODE];
const updateNodeTypes = [jsep.IDENTIFIER, jsep.MEMBER_EXP];
assignmentOperators.forEach(op => jsep.addBinaryOp(op, 0.9));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why 0.9?

Copy link
Collaborator Author

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...

@6utt3rfly 6utt3rfly merged commit b33d481 into plugin-system Aug 2, 2021
@6utt3rfly 6utt3rfly deleted the plugin-assignment branch August 2, 2021 17:26
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.

None yet

2 participants