Implement the core of the generator functions. (#3368)
Some things are missing: - yield* support - generator definition in object literal - the hidden GeneratorFunction JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
committed by
Dániel Bátyai
parent
14e95a4775
commit
110f75c99d
@@ -55,32 +55,33 @@ typedef enum
|
||||
PARSER_INSIDE_WITH = (1u << 9), /**< code block is inside a with statement */
|
||||
PARSER_RESOLVE_BASE_FOR_CALLS = (1u << 10), /**< the this object must be resolved when
|
||||
* a function without a base object is called */
|
||||
PARSER_HAS_INITIALIZED_VARS = (1u << 11), /**< a CBC_INITIALIZE_VARS instruction must be emitted */
|
||||
PARSER_HAS_LATE_LIT_INIT = (1u << 12), /**< allocate memory for this string after
|
||||
PARSER_HAS_LATE_LIT_INIT = (1u << 11), /**< allocate memory for this string after
|
||||
* the local parser data is freed */
|
||||
PARSER_NO_END_LABEL = (1u << 13), /**< return instruction must be inserted
|
||||
PARSER_NO_END_LABEL = (1u << 12), /**< return instruction must be inserted
|
||||
* after the last byte code */
|
||||
PARSER_DEBUGGER_BREAKPOINT_APPENDED = (1u << 14), /**< pending (unsent) breakpoint
|
||||
PARSER_DEBUGGER_BREAKPOINT_APPENDED = (1u << 13), /**< pending (unsent) breakpoint
|
||||
* info is available */
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
PARSER_INSIDE_BLOCK = (1u << 15), /**< script has a lexical environment for let and const */
|
||||
PARSER_IS_ARROW_FUNCTION = (1u << 16), /**< an arrow function is parsed */
|
||||
PARSER_ARROW_PARSE_ARGS = (1u << 17), /**< parse the argument list of an arrow function */
|
||||
PARSER_FUNCTION_HAS_NON_SIMPLE_PARAM = (1u << 18), /**< function has a non simple parameter */
|
||||
PARSER_FUNCTION_HAS_REST_PARAM = (1u << 19), /**< function has rest parameter */
|
||||
PARSER_INSIDE_BLOCK = (1u << 14), /**< script has a lexical environment for let and const */
|
||||
PARSER_IS_ARROW_FUNCTION = (1u << 15), /**< an arrow function is parsed */
|
||||
PARSER_ARROW_PARSE_ARGS = (1u << 16), /**< parse the argument list of an arrow function */
|
||||
PARSER_IS_GENERATOR_FUNCTION = (1u << 17), /**< a generator function is parsed */
|
||||
PARSER_DISALLOW_YIELD = (1u << 18), /**< throw SyntaxError for yield expression */
|
||||
PARSER_FUNCTION_HAS_NON_SIMPLE_PARAM = (1u << 19), /**< function has a non simple parameter */
|
||||
PARSER_FUNCTION_HAS_REST_PARAM = (1u << 20), /**< function has rest parameter */
|
||||
/* These four status flags must be in this order. See PARSER_CLASS_PARSE_OPTS_OFFSET. */
|
||||
PARSER_CLASS_CONSTRUCTOR = (1u << 20), /**< a class constructor is parsed (this value must be kept in
|
||||
PARSER_CLASS_CONSTRUCTOR = (1u << 21), /**< a class constructor is parsed (this value must be kept in
|
||||
* in sync with ECMA_PARSE_CLASS_CONSTRUCTOR) */
|
||||
PARSER_CLASS_HAS_SUPER = (1u << 21), /**< class has super reference */
|
||||
PARSER_CLASS_IMPLICIT_SUPER = (1u << 22), /**< class has implicit parent class */
|
||||
PARSER_CLASS_STATIC_FUNCTION = (1u << 23), /**< this function is a static class method */
|
||||
PARSER_CLASS_SUPER_PROP_REFERENCE = (1u << 24), /**< super property call or assignment */
|
||||
PARSER_IS_EVAL = (1u << 25), /**< eval code */
|
||||
PARSER_CLASS_HAS_SUPER = (1u << 22), /**< class has super reference */
|
||||
PARSER_CLASS_IMPLICIT_SUPER = (1u << 23), /**< class has implicit parent class */
|
||||
PARSER_CLASS_STATIC_FUNCTION = (1u << 24), /**< this function is a static class method */
|
||||
PARSER_CLASS_SUPER_PROP_REFERENCE = (1u << 25), /**< super property call or assignment */
|
||||
PARSER_IS_EVAL = (1u << 26), /**< eval code */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#if ENABLED (JERRY_ES2015_MODULE_SYSTEM)
|
||||
PARSER_IS_MODULE = (1u << 26), /**< an export / import keyword is encountered */
|
||||
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 */
|
||||
PARSER_IS_MODULE = (1u << 27), /**< an export / import keyword is encountered */
|
||||
PARSER_MODULE_DEFAULT_CLASS_OR_FUNC = (1u << 28), /**< parsing a function or class default export */
|
||||
PARSER_MODULE_STORE_IDENT = (1u << 29), /**< store identifier of the current export statement */
|
||||
#endif /* ENABLED (JERRY_ES2015_MODULE_SYSTEM) */
|
||||
#ifndef JERRY_NDEBUG
|
||||
PARSER_SCANNING_SUCCESSFUL = (1u << 30), /**< scanning process was successful */
|
||||
@@ -624,6 +625,7 @@ uint8_t lexer_consume_next_character (parser_context_t *context_p);
|
||||
void lexer_skip_empty_statements (parser_context_t *context_p);
|
||||
bool lexer_check_arrow (parser_context_t *context_p);
|
||||
bool lexer_check_arrow_param (parser_context_t *context_p);
|
||||
bool lexer_check_yield_no_arg (parser_context_t *context_p);
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
void lexer_parse_string (parser_context_t *context_p);
|
||||
void lexer_expect_identifier (parser_context_t *context_p, uint8_t literal_type);
|
||||
|
||||
Reference in New Issue
Block a user