-
Notifications
You must be signed in to change notification settings - Fork 851
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
const [y, y] = []
throws a TypeError, instead of SyntaxError
#989
Comments
const [y, y] = []
throwsa TypeError, instead of SyntaxErrorconst [y, y] = []
throws a TypeError, instead of SyntaxError
Perhaps this is the same problem. const y = undefined;
const y = undefined; // SyntaxError, but TypeError in Rhino It should not be possible to achieve this without implementing TDZ. |
Is this really related to TDZ? IMHO this is just about redeclaration of a |
Sorry, this may not be directly related. |
To my knowledge TDZ issues throw a ReferenceError and I think those are runtime errors, not parse-time errors. And redeclaration of const/let throws a SyntaxError, which is a parse-time error I think |
Errors whose message starts with rhino/rhino/src/main/java/org/mozilla/javascript/DefaultErrorReporter.java Lines 39 to 55 in 7feaad0
Perhaps all of these are fine with rhino/rhino/src/main/resources/org/mozilla/javascript/resources/Messages.properties Lines 268 to 281 in 7feaad0
rhino/rhino/src/main/resources/org/mozilla/javascript/resources/Messages.properties Lines 474 to 478 in 7feaad0
// old generator
function g() { return 0; yield 1; }
// js: "<stdin>", line 2: TypeError: generator function g returns a value
// js: function g() { return 0; yield 1; }
// js: ................................^
// js: "<stdin>", line 2: Compilation produced 1 syntax errors.
// latest generator
function *g() { return 0; yield 1; } // no error However, rhino/rhino/src/main/java/org/mozilla/javascript/ScriptableObject.java Lines 2192 to 2200 in 7feaad0
function NaN() {} // TypeError |
Fixed by #1530. |
Followup of #386
The text was updated successfully, but these errors were encountered: