Skip to content

Allow 'undefined' in let or const declaration#639

Merged
bnoordhuis merged 1 commit intoquickjs-ng:masterfrom
bnoordhuis:fix633
Oct 29, 2024
Merged

Allow 'undefined' in let or const declaration#639
bnoordhuis merged 1 commit intoquickjs-ng:masterfrom
bnoordhuis:fix633

Conversation

@bnoordhuis
Copy link
Copy Markdown
Contributor

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

Fixes: #633

Comment thread quickjs.c
&& fd->scope_level == 1
&& fd->is_global_var
&& !fd->module) {
return js_parse_error(s, "'undefined' already declared");
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.

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

Comment thread quickjs.c Outdated
Copy link
Copy Markdown
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
@bnoordhuis bnoordhuis deleted the fix633 branch October 29, 2024 21:55
@p-bakker
Copy link
Copy Markdown

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

@saghul
Copy link
Copy Markdown
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
Copy Markdown

Great!

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

@p-bakker
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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