Implement ECMAScript 2022 class static block (#4841)
Co-authored-by: Martin Negyokru negyokru@inf.u-szeged.hu JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
This commit is contained in:
@@ -28,7 +28,7 @@ JERRY_STATIC_ASSERT (offsetof (cbc_uint8_arguments_t, script_value) == offsetof
|
||||
* whenever new bytecodes are introduced or existing ones have been deleted.
|
||||
*/
|
||||
JERRY_STATIC_ASSERT (CBC_END == 238, number_of_cbc_opcodes_changed);
|
||||
JERRY_STATIC_ASSERT (CBC_EXT_END == 166, number_of_cbc_ext_opcodes_changed);
|
||||
JERRY_STATIC_ASSERT (CBC_EXT_END == 167, number_of_cbc_ext_opcodes_changed);
|
||||
|
||||
#if JERRY_PARSER || JERRY_PARSER_DUMP_BYTE_CODE
|
||||
|
||||
|
||||
@@ -581,6 +581,10 @@
|
||||
VM_OC_PUSH_STATIC_FIELD_FUNC | VM_OC_GET_LITERAL) \
|
||||
CBC_OPCODE (CBC_EXT_ADD_COMPUTED_FIELD, CBC_NO_FLAG, -1, VM_OC_ADD_COMPUTED_FIELD | VM_OC_GET_STACK) \
|
||||
CBC_OPCODE (CBC_EXT_ADD_STATIC_COMPUTED_FIELD, CBC_NO_FLAG, -1, VM_OC_ADD_COMPUTED_FIELD | VM_OC_GET_STACK) \
|
||||
CBC_OPCODE (CBC_EXT_CLASS_CALL_STATIC_BLOCK, \
|
||||
CBC_HAS_LITERAL_ARG, \
|
||||
0, \
|
||||
VM_OC_CLASS_CALL_STATIC_BLOCK | VM_OC_GET_LITERAL) \
|
||||
/* Class private property related opcodes */ \
|
||||
CBC_OPCODE (CBC_EXT_PUSH_PRIVATE_PROP_LITERAL_REFERENCE, \
|
||||
CBC_HAS_LITERAL_ARG, \
|
||||
|
||||
@@ -781,7 +781,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
|
||||
#if JERRY_ESNEXT
|
||||
if (JERRY_UNLIKELY (keyword_p->type == LEXER_KEYW_AWAIT))
|
||||
{
|
||||
if (!(context_p->status_flags & PARSER_IS_ASYNC_FUNCTION)
|
||||
if (!(context_p->status_flags & (PARSER_IS_ASYNC_FUNCTION | PARSER_IS_CLASS_STATIC_BLOCK))
|
||||
&& !(context_p->global_status_flags & ECMA_PARSE_MODULE))
|
||||
{
|
||||
break;
|
||||
@@ -2833,6 +2833,33 @@ lexer_construct_function_object (parser_context_t *context_p, /**< context */
|
||||
return result_index;
|
||||
} /* lexer_construct_function_object */
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
/**
|
||||
* Construct a class static block function literal object.
|
||||
*
|
||||
* @return function object literal index
|
||||
*/
|
||||
uint16_t
|
||||
lexer_construct_class_static_block_function (parser_context_t *context_p) /**< context */
|
||||
{
|
||||
ecma_compiled_code_t *compiled_code_p;
|
||||
lexer_literal_t *literal_p;
|
||||
uint16_t result_index;
|
||||
|
||||
literal_p = lexer_construct_unused_literal (context_p);
|
||||
result_index = context_p->literal_count;
|
||||
context_p->literal_count++;
|
||||
|
||||
parser_flush_cbc (context_p);
|
||||
compiled_code_p = parser_parse_class_static_block (context_p);
|
||||
|
||||
literal_p->u.bytecode_p = compiled_code_p;
|
||||
literal_p->type = LEXER_FUNCTION_LITERAL;
|
||||
|
||||
return result_index;
|
||||
} /* lexer_construct_class_static_block_function */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/**
|
||||
* Construct a regular expression object.
|
||||
*
|
||||
@@ -3244,6 +3271,17 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
case LIT_CHAR_LEFT_BRACE:
|
||||
{
|
||||
if (ident_opts & (LEXER_OBJ_IDENT_CLASS_NO_STATIC | LEXER_OBJ_IDENT_CLASS_PRIVATE))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
context_p->token.type = LEXER_LEFT_BRACE;
|
||||
lexer_consume_next_character (context_p);
|
||||
return;
|
||||
}
|
||||
case LIT_CHAR_RIGHT_BRACE:
|
||||
{
|
||||
if (ident_opts & LEXER_OBJ_IDENT_ONLY_IDENTIFIERS)
|
||||
|
||||
@@ -847,11 +847,13 @@ parser_parse_class_body (parser_context_t *context_p, /**< context */
|
||||
}
|
||||
}
|
||||
|
||||
bool is_static_block = context_p->token.type == LEXER_LEFT_BRACE;
|
||||
|
||||
if (context_p->token.type == LEXER_RIGHT_SQUARE)
|
||||
{
|
||||
is_computed = true;
|
||||
}
|
||||
else if (LEXER_IS_IDENT_OR_STRING (context_p->token.lit_location.type))
|
||||
else if (!is_static_block && LEXER_IS_IDENT_OR_STRING (context_p->token.lit_location.type))
|
||||
{
|
||||
if (is_static && !is_private)
|
||||
{
|
||||
@@ -869,7 +871,7 @@ parser_parse_class_body (parser_context_t *context_p, /**< context */
|
||||
|
||||
if (!(status_flags & (PARSER_IS_ASYNC_FUNCTION | PARSER_IS_GENERATOR_FUNCTION)))
|
||||
{
|
||||
if (!lexer_check_next_character (context_p, LIT_CHAR_LEFT_PAREN))
|
||||
if (is_static_block || !lexer_check_next_character (context_p, LIT_CHAR_LEFT_PAREN))
|
||||
{
|
||||
/* Class field. */
|
||||
if (fields_size == 0)
|
||||
@@ -889,7 +891,7 @@ parser_parse_class_body (parser_context_t *context_p, /**< context */
|
||||
parser_emit_cbc_ext_literal_from_token (context_p, field_opcode);
|
||||
}
|
||||
|
||||
if (is_static && parser_is_constructor_literal (context_p))
|
||||
if (is_static && !is_static_block && parser_is_constructor_literal (context_p))
|
||||
{
|
||||
parser_raise_error (context_p, PARSER_ERR_ARGUMENT_LIST_EXPECTED);
|
||||
}
|
||||
@@ -925,7 +927,31 @@ parser_parse_class_body (parser_context_t *context_p, /**< context */
|
||||
}
|
||||
}
|
||||
|
||||
if (lexer_consume_assign (context_p))
|
||||
if (is_static_block)
|
||||
{
|
||||
class_field_type |= PARSER_CLASS_FIELD_STATIC_BLOCK;
|
||||
|
||||
if (context_p->next_scanner_info_p->type != SCANNER_TYPE_CLASS_STATIC_BLOCK_END)
|
||||
{
|
||||
parser_flush_cbc (context_p);
|
||||
parser_parse_class_static_block (context_p);
|
||||
}
|
||||
|
||||
JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_CLASS_STATIC_BLOCK_END);
|
||||
|
||||
scanner_set_location (context_p, &((scanner_location_info_t *) context_p->next_scanner_info_p)->location);
|
||||
scanner_release_next (context_p, sizeof (scanner_location_info_t));
|
||||
JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_FUNCTION);
|
||||
range.start_location.source_p = context_p->next_scanner_info_p->source_p - 1;
|
||||
|
||||
scanner_seek (context_p);
|
||||
|
||||
parser_stack_push (context_p, &range.start_location, sizeof (scanner_location_t));
|
||||
fields_size += sizeof (scanner_location_t);
|
||||
|
||||
lexer_consume_next_character (context_p);
|
||||
}
|
||||
else if (lexer_consume_assign (context_p))
|
||||
{
|
||||
class_field_type |= PARSER_CLASS_FIELD_INITIALIZED;
|
||||
|
||||
@@ -1738,8 +1764,17 @@ parser_parse_function_expression (parser_context_t *context_p, /**< context */
|
||||
|
||||
if (!lexer_check_next_character (context_p, LIT_CHAR_LEFT_PAREN))
|
||||
{
|
||||
#if JERRY_ESNEXT
|
||||
/* The `await` keyword is interpreted as an IdentifierReference within function expressions */
|
||||
context_p->status_flags &= (uint32_t) ~PARSER_IS_CLASS_STATIC_BLOCK;
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
lexer_next_token (context_p);
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
context_p->status_flags |= parent_status_flags & PARSER_IS_CLASS_STATIC_BLOCK;
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
|
||||
{
|
||||
parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);
|
||||
@@ -2168,7 +2203,8 @@ parser_parse_unary_expression (parser_context_t *context_p, /**< context */
|
||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
||||
|
||||
uint32_t arrow_status_flags =
|
||||
(PARSER_IS_FUNCTION | PARSER_IS_ARROW_FUNCTION | (context_p->status_flags & PARSER_INSIDE_CLASS_FIELD));
|
||||
(PARSER_IS_FUNCTION | PARSER_IS_ARROW_FUNCTION
|
||||
| (context_p->status_flags & (PARSER_INSIDE_CLASS_FIELD | PARSER_IS_CLASS_STATIC_BLOCK)));
|
||||
|
||||
if (context_p->next_scanner_info_p->u8_arg & SCANNER_FUNCTION_ASYNC)
|
||||
{
|
||||
@@ -2425,7 +2461,8 @@ parser_parse_unary_expression (parser_context_t *context_p, /**< context */
|
||||
#endif /* JERRY_FUNCTION_TO_STRING */
|
||||
|
||||
uint32_t arrow_status_flags =
|
||||
(PARSER_IS_FUNCTION | PARSER_IS_ARROW_FUNCTION | (context_p->status_flags & PARSER_INSIDE_CLASS_FIELD));
|
||||
(PARSER_IS_FUNCTION | PARSER_IS_ARROW_FUNCTION
|
||||
| (context_p->status_flags & (PARSER_INSIDE_CLASS_FIELD | PARSER_IS_CLASS_STATIC_BLOCK)));
|
||||
parser_parse_function_expression (context_p, arrow_status_flags);
|
||||
return parser_abort_parsing_after_assignment_expression (context_p);
|
||||
}
|
||||
|
||||
@@ -76,12 +76,13 @@ typedef enum
|
||||
PARSER_INSIDE_CLASS_FIELD = (1u << 23), /**< a class field is being parsed */
|
||||
PARSER_ALLOW_NEW_TARGET = (1u << 24), /**< allow new.target parsing in the current context */
|
||||
PARSER_IS_METHOD = (1u << 25), /**< method is parsed */
|
||||
PARSER_IS_CLASS_STATIC_BLOCK = (1u << 26), /**< a class static block is parsed */
|
||||
PARSER_PRIVATE_FUNCTION_NAME = PARSER_IS_FUNC_EXPRESSION, /**< represents private method for
|
||||
* parser_set_function_name*/
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
PARSER_MODULE_DEFAULT_CLASS_OR_FUNC = (1u << 26), /**< parsing a function or class default export */
|
||||
PARSER_MODULE_STORE_IDENT = (1u << 27), /**< store identifier of the current export statement */
|
||||
PARSER_MODULE_DEFAULT_CLASS_OR_FUNC = (1u << 27), /**< parsing a function or class default export */
|
||||
PARSER_MODULE_STORE_IDENT = (1u << 28), /**< store identifier of the current export statement */
|
||||
#endif /* JERRY_MODULE_SYSTEM */
|
||||
PARSER_HAS_LATE_LIT_INIT = (1u << 30), /**< there are identifier or string literals which construction
|
||||
* is postponed after the local parser data is freed */
|
||||
@@ -144,6 +145,7 @@ typedef enum
|
||||
PARSER_CLASS_FIELD_NORMAL = (1u << 1), /**< normal (non-computed) class field */
|
||||
PARSER_CLASS_FIELD_INITIALIZED = (1u << 2), /**< class field is initialized */
|
||||
PARSER_CLASS_FIELD_STATIC = (1u << 3), /**< static class field */
|
||||
PARSER_CLASS_FIELD_STATIC_BLOCK = (1u << 4), /**< static class field */
|
||||
} parser_class_field_type_t;
|
||||
|
||||
#endif /* JERRY_ESNEXT */
|
||||
@@ -798,6 +800,9 @@ void lexer_construct_literal_object (parser_context_t *context_p,
|
||||
bool lexer_construct_number_object (parser_context_t *context_p, bool is_expr, bool is_negative_number);
|
||||
void lexer_convert_push_number_to_push_literal (parser_context_t *context_p);
|
||||
uint16_t lexer_construct_function_object (parser_context_t *context_p, uint32_t extra_status_flags);
|
||||
#if JERRY_ESNEXT
|
||||
uint16_t lexer_construct_class_static_block_function (parser_context_t *context_p);
|
||||
#endif /* JERRY_ESNEXT */
|
||||
void lexer_construct_regexp_object (parser_context_t *context_p, bool parse_only);
|
||||
bool lexer_compare_identifier_to_string (const lexer_lit_location_t *left_p, const uint8_t *right_p, size_t size);
|
||||
bool lexer_compare_identifiers (parser_context_t *context_p,
|
||||
@@ -931,6 +936,7 @@ uint8_t *parser_line_info_generate (parser_context_t *context_p);
|
||||
|
||||
ecma_compiled_code_t *parser_parse_function (parser_context_t *context_p, uint32_t status_flags);
|
||||
#if JERRY_ESNEXT
|
||||
ecma_compiled_code_t *parser_parse_class_static_block (parser_context_t *context_p);
|
||||
ecma_compiled_code_t *parser_parse_arrow_function (parser_context_t *context_p, uint32_t status_flags);
|
||||
ecma_compiled_code_t *parser_parse_class_fields (parser_context_t *context_p);
|
||||
void parser_set_function_name (parser_context_t *context_p,
|
||||
|
||||
@@ -3090,6 +3090,12 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
|
||||
{
|
||||
parser_raise_error (context_p, PARSER_ERR_INVALID_RETURN);
|
||||
}
|
||||
#if JERRY_ESNEXT
|
||||
if (context_p->status_flags & PARSER_IS_CLASS_STATIC_BLOCK)
|
||||
{
|
||||
parser_raise_error (context_p, PARSER_ERR_INVALID_RETURN);
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
lexer_next_token (context_p);
|
||||
|
||||
|
||||
@@ -2793,6 +2793,46 @@ parser_parse_function (parser_context_t *context_p, /**< context */
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
/**
|
||||
* Parse static class block code
|
||||
*
|
||||
* @return compiled code
|
||||
*/
|
||||
ecma_compiled_code_t *
|
||||
parser_parse_class_static_block (parser_context_t *context_p) /**< context */
|
||||
{
|
||||
parser_saved_context_t saved_context;
|
||||
ecma_compiled_code_t *compiled_code_p;
|
||||
|
||||
parser_save_context (context_p, &saved_context);
|
||||
context_p->status_flags |= (PARSER_IS_CLASS_STATIC_BLOCK | PARSER_FUNCTION_CLOSURE | PARSER_ALLOW_SUPER
|
||||
| PARSER_INSIDE_CLASS_FIELD | PARSER_ALLOW_NEW_TARGET | PARSER_DISALLOW_AWAIT_YIELD);
|
||||
|
||||
#if JERRY_PARSER_DUMP_BYTE_CODE
|
||||
if (context_p->is_show_opcodes)
|
||||
{
|
||||
JERRY_DEBUG_MSG ("\n--- Static class block parsing start ---\n\n");
|
||||
}
|
||||
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
|
||||
|
||||
scanner_create_variables (context_p, SCANNER_CREATE_VARS_NO_OPTS);
|
||||
lexer_next_token (context_p);
|
||||
|
||||
parser_parse_statements (context_p);
|
||||
compiled_code_p = parser_post_processing (context_p);
|
||||
|
||||
#if JERRY_PARSER_DUMP_BYTE_CODE
|
||||
if (context_p->is_show_opcodes)
|
||||
{
|
||||
JERRY_DEBUG_MSG ("\n--- Static class block parsing end ---\n\n");
|
||||
}
|
||||
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
|
||||
|
||||
parser_restore_context (context_p, &saved_context);
|
||||
|
||||
return compiled_code_p;
|
||||
} /* parser_parse_class_static_block */
|
||||
|
||||
/**
|
||||
* Parse arrow function code
|
||||
*
|
||||
@@ -2826,6 +2866,12 @@ parser_parse_arrow_function (parser_context_t *context_p, /**< context */
|
||||
}
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
/* The `await` keyword is disallowed in the IdentifierReference position */
|
||||
if (status_flags & PARSER_IS_CLASS_STATIC_BLOCK)
|
||||
{
|
||||
context_p->status_flags |= PARSER_DISALLOW_AWAIT_YIELD;
|
||||
}
|
||||
|
||||
if (context_p->token.type == LEXER_LEFT_PAREN)
|
||||
{
|
||||
lexer_next_token (context_p);
|
||||
@@ -2837,6 +2883,12 @@ parser_parse_arrow_function (parser_context_t *context_p, /**< context */
|
||||
parser_parse_function_arguments (context_p, LEXER_ARROW);
|
||||
}
|
||||
|
||||
/* The `await` keyword is interpreted as an identifier within the body of arrow functions */
|
||||
if (status_flags & PARSER_IS_CLASS_STATIC_BLOCK)
|
||||
{
|
||||
context_p->status_flags &= (uint32_t) ~(PARSER_DISALLOW_AWAIT_YIELD | PARSER_IS_CLASS_STATIC_BLOCK);
|
||||
}
|
||||
|
||||
JERRY_ASSERT (context_p->token.type == LEXER_ARROW);
|
||||
|
||||
lexer_next_token (context_p);
|
||||
@@ -2950,6 +3002,20 @@ parser_parse_class_fields (parser_context_t *context_p) /**< context */
|
||||
if (class_field_type & PARSER_CLASS_FIELD_NORMAL)
|
||||
{
|
||||
scanner_set_location (context_p, &range.start_location);
|
||||
|
||||
if (class_field_type & PARSER_CLASS_FIELD_STATIC_BLOCK)
|
||||
{
|
||||
scanner_seek (context_p);
|
||||
JERRY_ASSERT (context_p->source_p[1] == LIT_CHAR_LEFT_BRACE);
|
||||
context_p->source_p += 2;
|
||||
context_p->source_end_p = source_end_p;
|
||||
|
||||
uint16_t func_index = lexer_construct_class_static_block_function (context_p);
|
||||
|
||||
parser_emit_cbc_ext_literal (context_p, CBC_EXT_CLASS_CALL_STATIC_BLOCK, func_index);
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32_t ident_opts = LEXER_OBJ_IDENT_ONLY_IDENTIFIERS;
|
||||
is_private = context_p->source_p[-1] == LIT_CHAR_HASHMARK;
|
||||
|
||||
|
||||
@@ -118,6 +118,7 @@ typedef enum
|
||||
SCAN_STACK_FUNCTION_PARAMETERS, /**< function parameter initializer */
|
||||
SCAN_STACK_FOR_START_PATTERN, /**< possible assignment pattern for "for" iterator */
|
||||
SCAN_STACK_USE_ASYNC, /**< an "async" identifier is used */
|
||||
SCAN_STACK_CLASS_STATIC_BLOCK, /**< class static block */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
SCAN_STACK_EXPORT_DEFAULT, /**< scan primary expression after export default */
|
||||
|
||||
@@ -2083,6 +2083,7 @@ scanner_cleanup (parser_context_t *context_p) /**< context */
|
||||
#if JERRY_ESNEXT
|
||||
case SCANNER_TYPE_INITIALIZER:
|
||||
case SCANNER_TYPE_CLASS_FIELD_INITIALIZER_END:
|
||||
case SCANNER_TYPE_CLASS_STATIC_BLOCK_END:
|
||||
#endif /* JERRY_ESNEXT */
|
||||
{
|
||||
size = sizeof (scanner_location_info_t);
|
||||
|
||||
@@ -2304,6 +2304,33 @@ scanner_scan_statement_end (parser_context_t *context_p, /**< context */
|
||||
continue;
|
||||
}
|
||||
#if JERRY_ESNEXT
|
||||
case SCAN_STACK_CLASS_STATIC_BLOCK:
|
||||
{
|
||||
if (type != LEXER_RIGHT_BRACE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
scanner_pop_literal_pool (context_p, scanner_context_p);
|
||||
scanner_source_start_t start_range;
|
||||
parser_stack_pop_uint8 (context_p);
|
||||
parser_stack_pop (context_p, &start_range, sizeof (scanner_source_start_t));
|
||||
|
||||
scanner_context_p->mode = SCAN_MODE_CLASS_BODY_NO_SCAN;
|
||||
|
||||
scanner_location_info_t *location_info_p;
|
||||
location_info_p = (scanner_location_info_t *) scanner_insert_info (context_p,
|
||||
start_range.source_p,
|
||||
sizeof (scanner_location_info_t));
|
||||
|
||||
location_info_p->info.type = SCANNER_TYPE_CLASS_STATIC_BLOCK_END;
|
||||
location_info_p->location.source_p = context_p->source_p;
|
||||
location_info_p->location.line = context_p->token.line;
|
||||
location_info_p->location.column = context_p->token.column;
|
||||
|
||||
lexer_scan_identifier (context_p, LEXER_PARSE_CHECK_KEYWORDS | LEXER_PARSE_NO_STRICT_IDENT_ERROR);
|
||||
return SCAN_KEEP_TOKEN;
|
||||
}
|
||||
case SCAN_STACK_PRIVATE_BLOCK_EARLY:
|
||||
{
|
||||
parser_list_iterator_t literal_iterator;
|
||||
@@ -2681,9 +2708,28 @@ scanner_scan_all (parser_context_t *context_p) /**< context */
|
||||
}
|
||||
else if (lexer_token_is_identifier (context_p, "static", 6))
|
||||
{
|
||||
scanner_source_start_t static_start;
|
||||
static_start.source_p = context_p->source_p - 1;
|
||||
|
||||
lexer_scan_identifier (context_p, LEXER_PARSE_NO_OPTS);
|
||||
identifier_found = true;
|
||||
private_field_flags |= SCANNER_PRIVATE_FIELD_STATIC;
|
||||
|
||||
if (!is_private && context_p->token.type == LEXER_LEFT_BRACE)
|
||||
{
|
||||
parser_stack_push (context_p, &static_start, sizeof (scanner_source_start_t));
|
||||
parser_stack_push_uint8 (context_p, SCAN_STACK_CLASS_STATIC_BLOCK);
|
||||
|
||||
scanner_literal_pool_t *literal_pool_p =
|
||||
scanner_push_literal_pool (context_p, &scanner_context, SCANNER_LITERAL_POOL_FUNCTION);
|
||||
literal_pool_p->source_p = context_p->source_p - 1;
|
||||
|
||||
lexer_next_token (context_p);
|
||||
|
||||
scanner_context.mode = SCAN_MODE_STATEMENT_OR_TERMINATOR;
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
scanner_context.mode = SCAN_MODE_FUNCTION_ARGUMENTS;
|
||||
@@ -3851,6 +3897,12 @@ scan_completed:
|
||||
print_location = false;
|
||||
break;
|
||||
}
|
||||
case SCANNER_TYPE_CLASS_STATIC_BLOCK_END:
|
||||
{
|
||||
name_p = "SCANNER_TYPE_CLASS_STATIC_BLOCK_END";
|
||||
print_location = true;
|
||||
break;
|
||||
}
|
||||
case SCANNER_TYPE_CLASS_FIELD_INITIALIZER_END:
|
||||
{
|
||||
name_p = "SCANNER_TYPE_CLASS_FIELD_INITIALIZER_END";
|
||||
|
||||
@@ -49,6 +49,7 @@ typedef enum
|
||||
SCANNER_TYPE_LITERAL_FLAGS, /**< object or array literal with non-zero flags (stored in u8_arg) */
|
||||
SCANNER_TYPE_CLASS_CONSTRUCTOR, /**< class constructor */
|
||||
SCANNER_TYPE_CLASS_FIELD_INITIALIZER_END, /**< class field initializer end */
|
||||
SCANNER_TYPE_CLASS_STATIC_BLOCK_END, /**< class static block end */
|
||||
SCANNER_TYPE_LET_EXPRESSION, /**< let expression */
|
||||
SCANNER_TYPE_ERR_REDECLARED, /**< syntax error: a variable is redeclared */
|
||||
SCANNER_TYPE_ERR_ASYNC_FUNCTION, /**< an invalid async function follows */
|
||||
|
||||
Reference in New Issue
Block a user