Skip to content

Super class expression parenthesis#404

Merged
michaelficarra merged 3 commits intoestools:masterfrom
javascript-obfuscator:super-class-expression-parenthesis
Jan 10, 2020
Merged

Super class expression parenthesis#404
michaelficarra merged 3 commits intoestools:masterfrom
javascript-obfuscator:super-class-expression-parenthesis

Conversation

@sanex3339
Copy link
Copy Markdown
Contributor

@sanex3339
Copy link
Copy Markdown
Contributor Author

@michaelficarra need your review

@sanex3339
Copy link
Copy Markdown
Contributor Author

@michaelficarra ping

Comment thread escodegen.js Outdated
}
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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