The "var_in" flag indicates parsing inside the "for" statement with expectation
of the "in" token, but it doesn't define the loop as a for-in one. In fact,
that's unknown at the moment when this particular error message is emitted.
As a result, the following code:
for (var eval = 10; eval; eval--);
produces the error message about for-in loop:
SyntaxError: Identifier "eval" is forbidden in for-in var declaration
Actually, according to the specification "eval" isn't a keyword and shouldn't
cause any errors here. But this bug is beyond the scope of the current fix.
if (token != NJS_TOKEN_NAME) {
if (token == NJS_TOKEN_ARGUMENTS || token == NJS_TOKEN_EVAL) {
njs_parser_syntax_error(vm, parser, "Identifier \"%V\" "
- "is forbidden in %s declaration",
- njs_parser_text(parser),
- var_in ? "for-in var" : "var");
+ "is forbidden in var declaration",
+ njs_parser_text(parser));
}
return NJS_TOKEN_ILLEGAL;
nxt_string("SyntaxError: Identifier \"arguments\" is forbidden in var declaration in 1") },
{ nxt_string("for (var arguments in []) {}"),
- nxt_string("SyntaxError: Identifier \"arguments\" is forbidden in for-in var declaration in 1") },
+ nxt_string("SyntaxError: Identifier \"arguments\" is forbidden in var declaration in 1") },
{ nxt_string("function arguments(){}"),
nxt_string("SyntaxError: Identifier \"arguments\" is forbidden in function declaration in 1") },