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

Rhino should throw a syntax error when defining a function that is not standardized #577

Open
YaoHouyou opened this issue Jun 22, 2019 · 2 comments · May be fixed by #1418
Open

Rhino should throw a syntax error when defining a function that is not standardized #577

YaoHouyou opened this issue Jun 22, 2019 · 2 comments · May be fixed by #1418
Labels
bug Issues considered a bug Ecma Incompatibility Issues about Rhino being incompatible with the EcmaScript spec

Comments

@YaoHouyou
Copy link

YaoHouyou commented Jun 22, 2019

Rhino dose not throw any exception as show as the below test case, while others engines throw a syntax error, such as v8, spiderMonkey, javascriptCore and chakra.
Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Unnamed_function_statement

Version: rhino-1.7.11, rhino-1.7.10, rhino-1.7.9

Testcase:

function () {
	print("hello rhino!");
	return true;
}

Command:

java -jar rhino/rhino-1.7.11.jar -debug -version 200 testcase.js
@moreheadm
Copy link

As a note, I'm pretty sure not throwing a SyntaxError here is allowed by the ES standard, even if it doesn't match other implementations.

@p-bakker p-bakker added the bug Issues considered a bug label Jun 29, 2021
@p-bakker
Copy link
Collaborator

Think on function statements the name is mandatory in EcmaScript and an error ought to be thrown here

@p-bakker p-bakker added the Ecma Incompatibility Issues about Rhino being incompatible with the EcmaScript spec label Oct 14, 2021
@p-bakker p-bakker linked a pull request Aug 18, 2024 that will close this issue
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 a pull request may close this issue.

3 participants