Add validation for single statement lexical declarations (#3326)

This patch fixes #3275 and fixes #3276.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2019-11-19 15:44:12 +01:00
committed by GitHub
parent 134f0c0d0f
commit a1189cfb62
7 changed files with 92 additions and 1 deletions
+4
View File
@@ -1089,6 +1089,10 @@ parser_error_to_string (parser_error_t error) /**< error code */
{
return "Local variable is redeclared.";
}
case PARSER_ERR_LEXICAL_SINGLE_STATEMENT:
{
return "Lexical declaration cannot appear in a single-statement context.";
}
case PARSER_ERR_MISSING_ASSIGN_AFTER_CONST:
{
return "Value assignment is expected after a const declaration.";