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

err:identifier n has already been declared #69

Closed
fzxs8 opened this issue Jan 20, 2021 · 2 comments
Closed

err:identifier n has already been declared #69

fzxs8 opened this issue Jan 20, 2021 · 2 comments

Comments

@fzxs8
Copy link

fzxs8 commented Jan 20, 2021

使用 下面的代码执行获取AST会出现错误.

golang 代码:

	ast, err := js.Parse(parse.NewInputBytes(jsStr))

JavaScript代码

const n = 100


let fi = [1, 2, 3, 4], r = []
for (let t = 0, n = fi.length; t < n; t++) {
    const n = fi[t];
    r.push(`${n}:${n + 1};`)
}
// if (n > 0) {
//     const n = 200;
//     r.push(`${n}:${n + 1};`)
// }
console.info(r)

出现了错误

err:identifier n has already been declared on line 6 and column 11
6: const n = fi[t];

@tdewolff
Copy link
Owner

Thanks! There were a couple of bugs related to for initializers, they've all been fixed!

@fzxs8
Copy link
Author

fzxs8 commented Jan 21, 2021

Thanks! There were a couple of bugs related to for initializers, they've all been fixed!

Hard work!

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