Support line info for class fields (#4670)

Furthermore fix function info for call frames.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2021-05-17 11:15:02 +02:00
committed by GitHub
parent 26f604ce1e
commit 5180680030
3 changed files with 88 additions and 11 deletions
+7
View File
@@ -2578,6 +2578,13 @@ parser_parse_class_fields (parser_context_t *context_p) /**< context */
scanner_seek (context_p);
}
#if JERRY_LINE_INFO
if (context_p->token.line != context_p->last_line_info_line)
{
parser_emit_line_info (context_p, context_p->token.line, true);
}
#endif /* JERRY_LINE_INFO */
context_p->source_end_p = range.source_end_p;
lexer_next_token (context_p);
parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);
+7 -6
View File
@@ -948,6 +948,7 @@ opfunc_init_class_fields (ecma_value_t class_object, /**< the function itself */
ecma_extended_object_t *ext_function_p;
ext_function_p = (ecma_extended_object_t *) ecma_get_object_from_value (property_value_p->value);
shared_class_fields.header.bytecode_header_p = ecma_op_function_get_compiled_code (ext_function_p);
shared_class_fields.header.function_object_p = &ext_function_p->object;
ecma_object_t *scope_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t,
ext_function_p->u.function.scope_cp);
@@ -971,22 +972,22 @@ opfunc_init_static_class_fields (ecma_value_t function_object, /**< the function
JERRY_ASSERT (ecma_op_is_callable (function_object));
JERRY_ASSERT (ecma_is_value_object (this_val));
vm_frame_ctx_shared_class_fields_t shared_class_fields;
shared_class_fields.header.status_flags = VM_FRAME_CTX_SHARED_HAS_CLASS_FIELDS;
shared_class_fields.computed_class_fields_p = NULL;
ecma_string_t *name_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_CLASS_FIELD_COMPUTED);
ecma_object_t *function_object_p = ecma_get_object_from_value (function_object);
ecma_property_t *class_field_property_p = ecma_find_named_property (function_object_p, name_p);
vm_frame_ctx_shared_class_fields_t shared_class_fields;
shared_class_fields.header.function_object_p = function_object_p;
shared_class_fields.header.status_flags = VM_FRAME_CTX_SHARED_HAS_CLASS_FIELDS;
shared_class_fields.computed_class_fields_p = NULL;
if (class_field_property_p != NULL)
{
ecma_value_t value = ECMA_PROPERTY_VALUE_PTR (class_field_property_p)->value;
shared_class_fields.computed_class_fields_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_value_t, value);
}
ecma_extended_object_t *ext_function_p;
ext_function_p = (ecma_extended_object_t *) ecma_get_object_from_value (function_object);
ecma_extended_object_t *ext_function_p = (ecma_extended_object_t *) function_object_p;
shared_class_fields.header.bytecode_header_p = ecma_op_function_get_compiled_code (ext_function_p);
ecma_object_t *scope_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t,