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

Super class expression parenthesis #404

Conversation

sanex3339
Copy link
Contributor

@sanex3339
Copy link
Contributor Author

@michaelficarra need your review

@sanex3339
Copy link
Contributor Author

@michaelficarra ping

escodegen.js Outdated
@@ -1145,7 +1145,17 @@
result = join(result, this.generateExpression(stmt.id, Precedence.Sequence, E_TTT));
}
if (stmt.superClass) {
fragment = join('extends', this.generateExpression(stmt.superClass, Precedence.Assignment, E_TTT));
var superClassExpression = this.generateExpression(stmt.superClass, Precedence.Assignment, E_TTT);
Copy link
Member

Choose a reason for hiding this comment

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

None of the rest of this is necessary. ClassHeritage is a LeftHandSideExpression, not an AssignmentExpression. We should just replace Precedence.Assignment on this line with Precedence.Unary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will try

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It works, thank you

@sanex3339
Copy link
Contributor Author

@michaelficarra fixed

@michaelficarra michaelficarra merged commit c917cf2 into estools:master Jan 10, 2020
bizob2828 pushed a commit to Contrast-Security-OSS/escodegen that referenced this pull request Apr 2, 2020
* Added parenthesis for some `superClass` expressions

* Simplify logic to enable super class expression parenthesis
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.

Breaks conditional extends by removing parenthesis
2 participants