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
+14
View File
@@ -67,6 +67,10 @@ typedef enum
PARSER_IS_ARROW_FUNCTION = (1u << 18), /**< an arrow function is parsed */
PARSER_ARROW_PARSE_ARGS = (1u << 19), /**< parse the argument list of an arrow function */
#endif /* !CONFIG_DISABLE_ES2015_ARROW_FUNCTION */
#ifndef CONFIG_DISABLE_ES2015_CLASS
PARSER_IS_CLASS = (1u << 20), /**< statements parsed inside class body */
PARSER_CLASS_CONSTRUCTOR = (1u << 21), /**< a class constructor is parsed */
#endif /* !CONFIG_DISABLE_ES2015_CLASS */
} parser_general_flags_t;
/**
@@ -426,6 +430,10 @@ void parser_set_continues_to_current_position (parser_context_t *context_p, pars
void lexer_next_token (parser_context_t *context_p);
bool lexer_check_colon (parser_context_t *context_p);
#ifndef CONFIG_DISABLE_ES2015_CLASS
bool lexer_check_left_paren (parser_context_t *context_p);
void lexer_skip_empty_statements (parser_context_t *context_p);
#endif /* !CONFIG_DISABLE_ES2015_CLASS */
#ifndef CONFIG_DISABLE_ES2015_ARROW_FUNCTION
lexer_token_type_t lexer_check_arrow (parser_context_t *context_p);
#endif /* !CONFIG_DISABLE_ES2015_ARROW_FUNCTION */
@@ -472,6 +480,9 @@ void parser_scan_until (parser_context_t *context_p, lexer_range_t *range_p, lex
*/
void parser_parse_statements (parser_context_t *context_p);
#ifndef CONFIG_DISABLE_ES2015_CLASS
void parser_parse_class (parser_context_t *context_p, bool is_statement);
#endif /* !CONFIG_DISABLE_ES2015_CLASS */
void parser_free_jumps (parser_stack_iterator_t iterator);
/**
@@ -485,6 +496,9 @@ ecma_compiled_code_t *parser_parse_function (parser_context_t *context_p, uint32
#ifndef CONFIG_DISABLE_ES2015_ARROW_FUNCTION
ecma_compiled_code_t *parser_parse_arrow_function (parser_context_t *context_p, uint32_t status_flags);
#endif /* !CONFIG_DISABLE_ES2015_ARROW_FUNCTION */
#ifndef CONFIG_DISABLE_ES2015_CLASS
ecma_compiled_code_t *parser_create_class_implicit_constructor (parser_context_t *context_p);
#endif /* !CONFIG_DISABLE_ES2015_CLASS */
/* Error management. */