Skip to content

Return false instead of error with undefined receiver in Reflect.set - #1734

Open
sr5434 wants to merge 2 commits into
quickjs-ng:masterfrom
sr5434:js-set-property
Open

sr5434 wants to merge 2 commits into
quickjs-ng:masterfrom
sr5434:js-set-property

Conversation

@sr5434

@sr5434 sr5434 commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Fixes #1730 and adds a few regression tests.

Comment thread quickjs.c Outdated
break;
goto retry2;
default:
primitive_receiver:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

shouldn't this label be after the if?

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.

I put it after the default because I wanted it to use the default logic when obj was an object rather than throwing an error.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

But you are only jumping there when obj is an object. Am I missing something? 😅

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.

Ohhh I see what you meant. I'll move the label down

This branch has not been deployed

No deployments
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.

Reflect.set throws when the receiver is null or undefined

2 participants