Skip to content

Fix/issue 1124 #1279

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

Merged
merged 3 commits into from
Nov 1, 2022
Merged

Fix/issue 1124 #1279

merged 3 commits into from
Nov 1, 2022

Conversation

Steven19Lee
Copy link
Contributor

@Steven19Lee Steven19Lee commented Oct 23, 2022

fix issue #1124


I fix this issue by adding a context to determine if the current expression is under the class field. if is true, then it is legal to use an in operator with privatename token. if is false. parse would throw an error.

And I find a problem is that terser allow parse function to accept private field even out of class field, which should be a syntax error. so I add a condition to subscripts function to determine if the current subscript is under class feild. if is true, parse would parse it correctly, if is false it would throw an error.

To pass the test, I delete one test from /compress/class-properity which allows parse function to accept private fields even out of class field, which should be a syntax error.

I also add a condition to binary expression, because even class field can use in operation with privatename, other expressions like add can’t use privatename without subscript. for example :

// in class field
 #p in this // pass
 this.#p + 10 // pass
 input.#p + 10 // pass, input can be a param
 #p + 10 // error

@fabiosantoscode fabiosantoscode merged commit 144609a into terser:master Nov 1, 2022
@fabiosantoscode
Copy link
Collaborator

Thank you very much!

@Steven19Lee
Copy link
Contributor Author

@fabiosantoscode Thanks for merging and reviewing, and apologies for my bad English.

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.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy