-
Notifications
You must be signed in to change notification settings - Fork 865
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 cannot evaluate a certain JavaScript code #1218
Comments
FYI, Chrome and Firefox can execute that JavaScript code. |
Thats a large chunk of code, I think you'll have to put in the effort to pinpoint where the actual issue occurs within the code (line 20 is just a wrapper around all the code, so it happens somewhere inside the wrapper). You haven't even specified which version of Rhino you're using, so even if someone would be willing to digg into such a broad question, they'd have no clue where to start |
@p-bakker I am using Rhino v1.7.14. Also, this line occurs a error.
|
There must be more to it, because just executing that bit of code i doubt throws an error |
@p-bakker Could you please try to run this Java project? You can run with a command |
Mmm, strange, can reproduce this, while its quite basic JavaScript stuff BTW: providing just the code snippet would've been sufficient:
|
Figured it out: you're running Rhino without having specified the language version, so it uses the default (0), in which Setting the language version to 200 fixes it:
If this also solves the problem for you, please close the case |
@p-bakker But, I faced another issue. function funcFoo() {
const foo = "foo";
let str = foo;
{
const foo = "FOO";
str = str + foo;
}
return str;
}
Do you know what is wrong? Best Regards, |
Unfortunately Rhino currently doesn't support proper block scoping for There are already several issues that report this. Hopefully this issue can be solved in v1.7.15 or v2.0.0. For now the best path forward is to run your (library) code through Babel, using the 'rhino' profile. No problem with the questions, but we have more appropriate places for them: discussions, Google Groups and Stack Overflow |
@p-bakker |
Rhino returns a error
missing ; before statement
at line #20 of this JavaScript code.Do you know the reason of this error?
The text was updated successfully, but these errors were encountered: