Index: src/parser.h |
diff --git a/src/parser.h b/src/parser.h |
index 8a3be4ef16cb5daf00e788e3c457da80c11f7ab1..99d9da2a82bacd7fef09949d27bed8c88ffe1aa7 100644 |
--- a/src/parser.h |
+++ b/src/parser.h |
@@ -488,7 +488,6 @@ class Parser BASE_EMBEDDED { |
public: |
FunctionState(Parser* parser, |
Scope* scope, |
- bool is_generator, |
Isolate* isolate); |
~FunctionState(); |
@@ -519,7 +518,17 @@ class Parser BASE_EMBEDDED { |
void AddProperty() { expected_property_count_++; } |
int expected_property_count() { return expected_property_count_; } |
- bool is_generator() const { return is_generator_; } |
+ void set_generator_object_variable(Variable *variable) { |
+ ASSERT(variable != NULL); |
+ ASSERT(!is_generator()); |
+ generator_object_variable_ = variable; |
+ } |
+ Variable* generator_object_variable() const { |
+ return generator_object_variable_; |
+ } |
+ bool is_generator() const { |
+ return generator_object_variable_ != NULL; |
+ } |
AstNodeFactory<AstConstructionVisitor>* factory() { return &factory_; } |
@@ -535,14 +544,16 @@ class Parser BASE_EMBEDDED { |
// Properties count estimation. |
int expected_property_count_; |
- // Indicates that this function is a generator. |
- bool is_generator_; |
- |
// Keeps track of assignments to properties of this. Used for |
// optimizing constructors. |
bool only_simple_this_property_assignments_; |
Handle<FixedArray> this_property_assignments_; |
+ // For generators, the variable that holds the generator object. This |
+ // variable is used by yield expressions and return statements. NULL |
+ // indicates that this function is not a generator. |
+ Variable* generator_object_variable_; |
+ |
Parser* parser_; |
FunctionState* outer_function_state_; |
Scope* outer_scope_; |
@@ -698,6 +709,8 @@ class Parser BASE_EMBEDDED { |
// in the object literal boilerplate. |
Handle<Object> GetBoilerplateValue(Expression* expression); |
+ Statement* BuildGeneratorObjectInitialization(); |
+ |
ZoneList<Expression*>* ParseArguments(bool* ok); |
FunctionLiteral* ParseFunctionLiteral(Handle<String> var_name, |
bool name_is_reserved, |