mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Return early when checking logical operators (#4626)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
parent
8321640c4e
commit
e739f11ed2
@ -2937,6 +2937,13 @@ parser_check_invalid_logical_op (parser_context_t *context_p, /**< context */
|
|||||||
parser_raise_error (context_p, PARSER_ERR_INVALID_NULLISH_COALESCING);
|
parser_raise_error (context_p, PARSER_ERR_INVALID_NULLISH_COALESCING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If a logical operator is found, and there is no SyntaxError, the scan can be terminated
|
||||||
|
* since there was no SyntaxError when the logical operator was pushed onto the stack. */
|
||||||
|
if (token == LEXER_LOGICAL_OR || token == LEXER_LOGICAL_AND || token == LEXER_NULLISH_COALESCING)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
parser_stack_iterator_skip (&iterator, sizeof (uint8_t));
|
parser_stack_iterator_skip (&iterator, sizeof (uint8_t));
|
||||||
}
|
}
|
||||||
} /* parser_check_invalid_logical_op */
|
} /* parser_check_invalid_logical_op */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user