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

Allow 'undefined' in let or const declaration #639

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

bnoordhuis
Copy link
Contributor

Except at the global scope of a classic script because... who knows, that's just how it is.

Fixes: #633

&& fd->scope_level == 1
&& fd->is_global_var
&& !fd->module) {
return js_parse_error(s, "'undefined' already declared");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the (abridged) version of what V8 reports, which felt a little more helpful to me than "invalid variable name"

quickjs.c Outdated Show resolved Hide resolved
Copy link
Contributor

@saghul saghul left a comment

Choose a reason for hiding this comment

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

Very nice!

Except at the global scope of a classic script because... who knows,
that's just how it is.

Fixes: quickjs-ng#633
@bnoordhuis bnoordhuis merged commit dfe5675 into quickjs-ng:master Oct 29, 2024
27 checks passed
@bnoordhuis bnoordhuis deleted the fix633 branch October 29, 2024 21:55
@p-bakker
Copy link

Any guesstimate when there might be a new release containing this fix?

@saghul
Copy link
Contributor

saghul commented Oct 30, 2024

I want to do one soon, I think it'd be good to finish the iterators work, not to have functions that throw with a TODO error.

@p-bakker
Copy link

Great!

Full support for all Iterator helper methods would indeed be well worth the wait, can use those as well 🙂

@p-bakker
Copy link

p-bakker commented Nov 4, 2024

@saghul Any update on the additional Iterator.prototype methods? Asking because not having those result in throwing an InternalError currently InternalError: TODO implement Iterator.prototype.xxxx, which in turn bombs out code in ses that tries to lock down a JavaScript environment

@saghul
Copy link
Contributor

saghul commented Nov 4, 2024

No updates, I didn't have much time last week. Hoping to have some more this one.

@saghul
Copy link
Contributor

saghul commented Nov 8, 2024

Update, got started, hope to make the first PR this weekend.

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.

SyntaxError thrown on valid JS
4 participants