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

this variable declarations should cause an error. #23

Open
ota-meshi opened this issue May 28, 2023 · 5 comments
Open

this variable declarations should cause an error. #23

ota-meshi opened this issue May 28, 2023 · 5 comments

Comments

@ota-meshi
Copy link
Contributor

It seems that an error should be raised in the following cases, but the error is not raised. I found this from test262 results.

// See: https://github.com/tc39/test262/blob/main/test/language/identifiers/val-this.js
var this = 42;

// See: https://github.com/tc39/test262/blob/main/test/language/statements/class/syntax/escaped-static.js
class C {
  st\u0061tic m() {
  } 
}
@ota-meshi
Copy link
Contributor Author

I believe #25 fixes the escaped static keyword.

@TyrealHu
Copy link
Owner

we wont handle this in acorn-typescript. bo this may be a parameter in typescript

@ota-meshi
Copy link
Contributor Author

Yeah, TypeScript allows we to use this for parameters, but it is still an error to use this for variable declarations.

https://www.typescriptlang.org/play?#code/G4QwTgBALgFglgZwgXggFgEwCgsDMCuAdgMZRwD2h05AogB4AOlApoWSADYAUsiAXBEL4AtgCNmYAJQQA3lggQwzKPjBVeCAHRRajFmzicukrAF8sQA

@TyrealHu
Copy link
Owner

Yeah, That's an error in typescript. Parse this in parameter will call parseBindingAtom, and then call the parseIdent to parse it. Parse this in val decl will alse call the parseBindingAtom. So its so hard for us to distinguish which is in parameter or val decl

@ota-meshi
Copy link
Contributor Author

I agree that it is hard. At least I didn't think I could fix it, so I left it as an issue.

@ota-meshi ota-meshi changed the title Some illegal keywords should cause an error. this variable declarations should cause an error. May 29, 2023
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

No branches or pull requests

2 participants