mirror of
https://github.com/bellard/quickjs.git
synced 2025-05-15 18:52:00 +08:00
'undefined' is a valid let/const variable name. It gives a SyntaxError at top level because it is already defined (#370)
This commit is contained in:
parent
f121cbdb5a
commit
beeb2725cd
@ -23731,7 +23731,7 @@ static __exception int js_define_var(JSParseState *s, JSAtom name, int tok)
|
|||||||
&& (fd->js_mode & JS_MODE_STRICT)) {
|
&& (fd->js_mode & JS_MODE_STRICT)) {
|
||||||
return js_parse_error(s, "invalid variable name in strict mode");
|
return js_parse_error(s, "invalid variable name in strict mode");
|
||||||
}
|
}
|
||||||
if ((name == JS_ATOM_let || name == JS_ATOM_undefined)
|
if (name == JS_ATOM_let
|
||||||
&& (tok == TOK_LET || tok == TOK_CONST)) {
|
&& (tok == TOK_LET || tok == TOK_CONST)) {
|
||||||
return js_parse_error(s, "invalid lexical variable name");
|
return js_parse_error(s, "invalid lexical variable name");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user