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

Disallow anonymous function declarations #1418

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

p-bakker
Copy link
Collaborator

@p-bakker p-bakker commented Nov 4, 2023

EcmaScript doesn't allow anonymous function declarations, only function expressions can be anonymous.

Rhino does allow anonymous function declarations, but this PR fixes it.

Test262 doesn't have any test for this (or at least not the test262 version we're currently on), so tests are missing

More importantly though, should this fix be tied to a specific language version? If so, everyone OK with >= ES6?

Fixes #577

@p-bakker p-bakker added the Ecma Incompatibility Issues about Rhino being incompatible with the EcmaScript spec label Nov 4, 2023
@rbri
Copy link
Collaborator

rbri commented Nov 5, 2023

= ES6? if fine for my

But i think we need at least some test in our test suite for this

@gbrail
Copy link
Collaborator

gbrail commented Nov 9, 2023

This seems OK to me but it should definitely be gated by a language version (ES6 works for me). I suspect that there are no tests because this is basically invalid syntax that I suspect the test authors didn't expect. We should write a few of our own tests for this just to exercise the code path.

@p-bakker
Copy link
Collaborator Author

p-bakker commented Nov 9, 2023

K, will add the language flag and tests

@p-bakker p-bakker added the bug Issues considered a bug label Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues considered a bug Ecma Incompatibility Issues about Rhino being incompatible with the EcmaScript spec
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rhino should throw a syntax error when defining a function that is not standardized
3 participants