Initial implementation of class fields (#4191)

Missing features:
 - this binding in static fields are not supported
 - static field evaluation order is wrong
 - function names are not supported

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2020-09-17 15:22:55 +02:00
committed by GitHub
parent 7345c83af7
commit d9653823ca
30 changed files with 1666 additions and 581 deletions
+5 -2
View File
@@ -45,7 +45,8 @@ typedef enum
SCAN_MODE_CONTINUE_FUNCTION_ARGUMENTS, /**< continue scanning function arguments */
SCAN_MODE_BINDING, /**< array or object binding */
SCAN_MODE_CLASS_DECLARATION, /**< scanning class declaration */
SCAN_MODE_CLASS_METHOD, /**< scanning class method */
SCAN_MODE_CLASS_BODY, /**< scanning class body */
SCAN_MODE_CLASS_BODY_NO_SCAN, /**< scanning class body without calling lexer_scan_identifier */
#endif /* ENABLED (JERRY_ESNEXT) */
} scan_modes_t;
@@ -59,7 +60,7 @@ typedef enum
SCAN_STACK_BLOCK_STATEMENT, /**< block statement group */
SCAN_STACK_FUNCTION_STATEMENT, /**< function statement */
SCAN_STACK_FUNCTION_EXPRESSION, /**< function expression */
SCAN_STACK_FUNCTION_PROPERTY, /**< function expression in an object literal or class */
SCAN_STACK_FUNCTION_PROPERTY, /**< function expression in an object literal */
#if ENABLED (JERRY_ESNEXT)
SCAN_STACK_FUNCTION_ARROW, /**< arrow function expression */
#endif /* ENABLED (JERRY_ESNEXT) */
@@ -113,6 +114,7 @@ typedef enum
SCAN_STACK_CLASS_STATEMENT, /**< class statement */
SCAN_STACK_CLASS_EXPRESSION, /**< class expression */
SCAN_STACK_CLASS_EXTENDS, /**< class extends expression */
SCAN_STACK_CLASS_FIELD_INITIALIZER, /**< class field initializer */
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 */
@@ -387,6 +389,7 @@ void scanner_detect_eval_call (parser_context_t *context_p, scanner_context_t *s
#if ENABLED (JERRY_ESNEXT)
void scanner_push_class_declaration (parser_context_t *context_p, scanner_context_t *scanner_context_p,
uint8_t stack_mode);
void scanner_push_class_field_initializer (parser_context_t *context_p, scanner_context_t *scanner_context_p);
void scanner_push_destructuring_pattern (parser_context_t *context_p, scanner_context_t *scanner_context_p,
uint8_t binding_type, bool is_nested);
void scanner_pop_binding_list (scanner_context_t *scanner_context_p);