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

Add support for super inside eval #1736

Closed
wants to merge 5 commits into from

Conversation

andreabergia
Copy link
Contributor

@andreabergia andreabergia commented Nov 27, 2024

This PR, co-authored with @0xe , implements super support inside eval. It is stacked on top of #1735.

The semantics come for "free", i.e. trying to resolve super when doing eval works automatically because it will do the same logic as a nested arrow function, i.e. look it up from the activation (the NativeCall).
So, the changes are really only related to the parser and need to allow super inside eval. We have implemented this by adding a new flag in CompilerEnvirons that is filled automatically during an eval call. We have chosen this approach because it allows super to be used in other places, such as a debugger's watch or immediate evaluation.

Co-authored-by: Satish Srinivasan <satish.srinivasan@servicenow.com>
Co-authored-by: Satish Srinivasan <satish.srinivasan@servicenow.com>
Copy link
Collaborator

@gbrail gbrail left a comment

Choose a reason for hiding this comment

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

This makes sense but we have to be careful about changing the public interface to Rhino.

andreabergia and others added 2 commits December 3, 2024 17:04
See spec 13.5.1.2 at
https://tc39.es/ecma262/#sec-delete-operator-runtime-semantics-evaluation

Co-authored-by: Satish Srinivasan <satish.srinivasan@servicenow.com>
Co-authored-by: Andrea Bergia <andrea.bergia@servicenow.com>
Co-authored-by: Satish Srinivasan <satish.srinivasan@servicenow.com>
@andreabergia
Copy link
Contributor Author

Merged onto #1735

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.

4 participants