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

Feature problem: Top-level prototype assignment #451

Open
Yi2255 opened this issue Oct 14, 2024 · 2 comments
Open

Feature problem: Top-level prototype assignment #451

Yi2255 opened this issue Oct 14, 2024 · 2 comments

Comments

@Yi2255
Copy link
Contributor

Yi2255 commented Oct 14, 2024

Problem

A code generator using setPrototype may generate code that assigns a value to the top-level prototype.

Example

const v11 = { a: 1 };
const v20 = v11.__proto__;
const newProto = { b: 2 };
v20.__proto__ = newProto; //TypeError: Immutable prototype object 'Object.prototype' cannot have their prototype set

The problem is more likely to be reproduced with the following generators weighting.

top-level proto.txt

@saelo
Copy link
Collaborator

saelo commented Oct 16, 2024

Also a good point! I guess this is quite similar to issue #452 and the same fix should work here.

@Yi2255
Copy link
Contributor Author

Yi2255 commented Oct 18, 2024

Yes, it's a category of issues. Thank you for your reply!

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