Correctly propagate super prop ref when parsing expressions (#3077)

The "super prop ref" flag is incorrectly used at multiple expressions
as it was only cleared if there was an assignment operation.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
This commit is contained in:
Péter Gál
2019-09-06 16:56:04 +02:00
committed by Robert Fancsik
parent 57f389dcf4
commit 1b84a17dc7
2 changed files with 50 additions and 0 deletions
+18
View File
@@ -2245,6 +2245,16 @@ parser_parse_expression (parser_context_t *context_p, /**< context */
parser_stack_push_uint8 (context_p, LEXER_EXPRESSION_START);
#if ENABLED (JERRY_ES2015_CLASS)
/* Parsing a new expression:
* So save, remove, and at the end restore the super prop reference indicator.
*
* If this is not done, it is possible to carry the flag over to the next expression.
*/
bool has_super_ref = (context_p->status_flags & PARSER_CLASS_SUPER_PROP_REFERENCE);
context_p->status_flags &= (uint32_t) ~PARSER_CLASS_SUPER_PROP_REFERENCE;
#endif
while (true)
{
if (options & PARSE_EXPR_HAS_LITERAL)
@@ -2409,6 +2419,14 @@ parser_parse_expression (parser_context_t *context_p, /**< context */
{
parser_push_result (context_p);
}
#if ENABLED (JERRY_ES2015_CLASS)
/* Restore the super prop ref flag. */
if (has_super_ref)
{
context_p->status_flags |= (uint32_t) PARSER_CLASS_SUPER_PROP_REFERENCE;
}
#endif /* ENABLED (JERRY_ES2015_CLASS) */
} /* parser_parse_expression */
/**