Implement ES2015 class feature (part I.) (#2404)

This patch is the first milestone of the implementation of this new language element.

Currently supported:
 - Class statement
 - Class expression
 - Static methods

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2018-07-12 18:20:08 +02:00
committed by yichoi
parent 62cdb3965f
commit 43aae199ce
18 changed files with 779 additions and 15 deletions
+15 -2
View File
@@ -1047,7 +1047,13 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
}
case VM_OC_SET_PROPERTY:
{
ecma_object_t *object_p = ecma_get_object_from_value (stack_top_p[-1]);
#ifndef CONFIG_DISABLE_ES2015_CLASS
const int index = (byte_code_start_p[0] == CBC_EXT_OPCODE) ? -2 : -1;
#else
const int index = -1;
#endif /* !CONFIG_DISABLE_ES2015_CLASS */
ecma_object_t *object_p = ecma_get_object_from_value (stack_top_p[index]);
ecma_string_t *prop_name_p;
ecma_property_t *property_p;
@@ -1102,8 +1108,15 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
case VM_OC_SET_GETTER:
case VM_OC_SET_SETTER:
{
JERRY_ASSERT (byte_code_start_p[0] == CBC_EXT_OPCODE);
#ifndef CONFIG_DISABLE_ES2015_CLASS
const int index = (byte_code_start_p[1] > CBC_EXT_SET_SETTER) ? -2 : -1;
#else
const int index = -1;
#endif /* !CONFIG_DISABLE_ES2015_CLASS */
opfunc_set_accessor (VM_OC_GROUP_GET_INDEX (opcode_data) == VM_OC_SET_GETTER,
stack_top_p[-1],
stack_top_p[index],
left_value,
right_value);