Fix local variable declaration issues after function argument initialization. (#3304)
Fixes #3298 Fixes #3299 Fixes #3300 Fixes #3302 JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
committed by
Dániel Bátyai
parent
b16b400d5b
commit
419ccff611
@@ -303,13 +303,13 @@
|
||||
CBC_OPCODE (CBC_EVAL, CBC_NO_FLAG, 0, \
|
||||
VM_OC_EVAL) \
|
||||
CBC_OPCODE (CBC_CREATE_LOCAL, CBC_HAS_LITERAL_ARG, 0, \
|
||||
VM_OC_NONE) \
|
||||
VM_OC_INIT_LOCALS) \
|
||||
CBC_OPCODE (CBC_CREATE_LET, CBC_HAS_LITERAL_ARG, 0, \
|
||||
VM_OC_NONE) \
|
||||
VM_OC_INIT_LOCALS) \
|
||||
CBC_OPCODE (CBC_CREATE_CONST, CBC_HAS_LITERAL_ARG, 0, \
|
||||
VM_OC_NONE) \
|
||||
VM_OC_INIT_LOCALS) \
|
||||
CBC_OPCODE (CBC_INIT_LOCAL, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \
|
||||
VM_OC_NONE) \
|
||||
VM_OC_INIT_LOCALS) \
|
||||
CBC_OPCODE (CBC_CREATE_VAR_EVAL, CBC_HAS_LITERAL_ARG, 0, \
|
||||
VM_OC_NONE) \
|
||||
CBC_OPCODE (CBC_CREATE_VAR_FUNC_EVAL, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \
|
||||
|
||||
@@ -1312,6 +1312,13 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
continue;
|
||||
}
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
case VM_OC_INIT_LOCALS:
|
||||
{
|
||||
frame_ctx_p->byte_code_p = byte_code_start_p;
|
||||
vm_init_loop (frame_ctx_p);
|
||||
byte_code_p = frame_ctx_p->byte_code_p;
|
||||
continue;
|
||||
}
|
||||
case VM_OC_ASSIGN_LET_CONST:
|
||||
{
|
||||
uint32_t literal_index;
|
||||
@@ -3424,6 +3431,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
continue;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
case VM_OC_NONE:
|
||||
default:
|
||||
{
|
||||
JERRY_ASSERT (VM_OC_GROUP_GET_INDEX (opcode_data) == VM_OC_NONE);
|
||||
|
||||
+8
-5
@@ -202,9 +202,7 @@ typedef enum
|
||||
VM_OC_RIGHT_SHIFT, /**< right shift */
|
||||
VM_OC_UNS_RIGHT_SHIFT, /**< unsigned right shift */
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
VM_OC_BLOCK_CREATE_CONTEXT, /**< create lexical environment for blocks enclosed in braces */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
VM_OC_WITH, /**< with */
|
||||
VM_OC_FOR_IN_CREATE_CONTEXT, /**< for in create context */
|
||||
VM_OC_FOR_IN_GET_NEXT, /**< get next */
|
||||
@@ -220,11 +218,14 @@ typedef enum
|
||||
VM_OC_BREAKPOINT_ENABLED, /**< enabled breakpoint for debugger */
|
||||
VM_OC_BREAKPOINT_DISABLED, /**< disabled breakpoint for debugger */
|
||||
#endif /* ENABLED (JERRY_DEBUGGER) */
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
#if ENABLED (JERRY_LINE_INFO) || ENABLED (JERRY_ES2015_MODULE_SYSTEM)
|
||||
VM_OC_RESOURCE_NAME, /**< resource name of the current function */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) || ENABLED (JERRY_ES2015_MODULE_SYSTEM) */
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
VM_OC_LINE, /**< line number of the next statement */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
VM_OC_INIT_LOCALS, /**< call vm_init_loop() */
|
||||
VM_OC_ASSIGN_LET_CONST, /**< assign values to let/const declarations */
|
||||
VM_OC_CLONE_CONTEXT, /**< clone lexical environment with let/const declarations */
|
||||
VM_OC_SET_COMPUTED_PROPERTY, /**< set computed property */
|
||||
@@ -260,15 +261,17 @@ typedef enum
|
||||
VM_OC_BREAKPOINT_ENABLED = VM_OC_NONE, /**< enabled breakpoint for debugger is unused */
|
||||
VM_OC_BREAKPOINT_DISABLED = VM_OC_NONE, /**< disabled breakpoint for debugger is unused */
|
||||
#endif /* !ENABLED (JERRY_DEBUGGER) */
|
||||
#if !ENABLED (JERRY_LINE_INFO)
|
||||
#if !ENABLED (JERRY_LINE_INFO) && !ENABLED (JERRY_ES2015_MODULE_SYSTEM)
|
||||
VM_OC_RESOURCE_NAME = VM_OC_NONE, /**< resource name of the current function is unused */
|
||||
#endif /* !ENABLED (JERRY_LINE_INFO) && !ENABLED (JERRY_ES2015_MODULE_SYSTEM) */
|
||||
#if !ENABLED (JERRY_LINE_INFO)
|
||||
VM_OC_LINE = VM_OC_NONE, /**< line number of the next statement is unused */
|
||||
#endif /* !ENABLED (JERRY_LINE_INFO) */
|
||||
#if !ENABLED (JERRY_ES2015)
|
||||
VM_OC_INIT_LOCALS = VM_OC_NONE, /**< call vm_init_loop() */
|
||||
VM_OC_ASSIGN_LET_CONST = VM_OC_NONE, /**< assign values to let/const declarations */
|
||||
VM_OC_CLONE_CONTEXT = VM_OC_NONE, /**< clone lexical environment with let/const declarations */
|
||||
VM_OC_SET_COMPUTED_PROPERTY = VM_OC_NONE, /**< set computed property is unused */
|
||||
VM_OC_BLOCK_CREATE_CONTEXT = VM_OC_NONE, /**< create context for blocks enclosed in braces */
|
||||
|
||||
VM_OC_FOR_OF_CREATE_CONTEXT = VM_OC_NONE, /**< for of create context */
|
||||
VM_OC_FOR_OF_GET_NEXT = VM_OC_NONE, /**< get next */
|
||||
|
||||
Reference in New Issue
Block a user