Add iterator close support for for-of statement (#3401)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "vm-defines.h"
|
||||
#include "vm-stack.h"
|
||||
#include "ecma-iterator-object.h"
|
||||
|
||||
/** \addtogroup vm Virtual machine
|
||||
* @{
|
||||
@@ -79,8 +80,15 @@ vm_stack_context_abort (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
case VM_CONTEXT_FOR_OF:
|
||||
{
|
||||
ecma_value_t iterator = vm_stack_top_p[-3];
|
||||
|
||||
if (context_info & VM_CONTEXT_CLOSE_ITERATOR)
|
||||
{
|
||||
ecma_op_iterator_close (iterator);
|
||||
}
|
||||
ecma_free_value (iterator);
|
||||
|
||||
ecma_free_value (vm_stack_top_p[-2]);
|
||||
ecma_free_value (vm_stack_top_p[-3]);
|
||||
VM_MINUS_EQUAL_U16 (frame_ctx_p->context_depth, PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION);
|
||||
vm_stack_top_p -= PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user