Invalid regexp patterns should not throw syntax error during parsing (#4038)

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2020-07-27 09:28:26 +02:00
committed by GitHub
parent da5b058dec
commit 11c2ae30d1
11 changed files with 175 additions and 36 deletions
+8
View File
@@ -1640,6 +1640,14 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
result = ecma_raise_type_error (ECMA_ERR_MSG ("Constant bindings cannot be reassigned."));
goto error;
}
case VM_OC_THROW_SYNTAX_ERROR:
{
ecma_string_t *msg_p = ecma_get_string_from_value (left_value);
ecma_object_t *error_obj_p = ecma_new_standard_error_with_message (ECMA_ERROR_SYNTAX, msg_p);
jcontext_raise_exception (ecma_make_object_value (error_obj_p));
result = ECMA_VALUE_ERROR;
goto error;
}
case VM_OC_COPY_TO_GLOBAL:
{
uint32_t literal_index;
+2
View File
@@ -241,6 +241,7 @@ typedef enum
VM_OC_ASSIGN_LET_CONST, /**< assign values to let/const declarations */
VM_OC_INIT_BINDING, /**< create and intialize a binding */
VM_OC_THROW_CONST_ERROR, /**< throw invalid assignment to const variable error */
VM_OC_THROW_SYNTAX_ERROR, /**< throw syntax error */
VM_OC_COPY_TO_GLOBAL, /**< copy value to global lex env */
VM_OC_COPY_FROM_ARG, /**< copy value from arg lex env */
VM_OC_CLONE_CONTEXT, /**< clone lexical environment with let/const declarations */
@@ -316,6 +317,7 @@ typedef enum
VM_OC_ASSIGN_LET_CONST = VM_OC_NONE, /**< assign values to let/const declarations */
VM_OC_INIT_BINDING = VM_OC_NONE, /**< create and intialize a binding */
VM_OC_THROW_CONST_ERROR = VM_OC_NONE, /**< throw invalid assignment to const variable error */
VM_OC_THROW_SYNTAX_ERROR = VM_OC_NONE, /**< throw syntax error */
VM_OC_COPY_TO_GLOBAL = VM_OC_NONE, /**< copy value to global lex env */
VM_OC_COPY_FROM_ARG = VM_OC_NONE, /**< copy value from arg lex env */
VM_OC_CLONE_CONTEXT = VM_OC_NONE, /**< clone lexical environment with let/const declarations */