Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(740)

Unified Diff: src/parser.h

Issue 12646003: Add parser support for generators. (Closed) Base URL: git://github.com/v8/v8.git@bleeding_edge
Patch Set: Fix bad initialization list in last preparser commit Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/parser.h
diff --git a/src/parser.h b/src/parser.h
index 0f85f91583b161ceab4d80d6cd81b570f144f6d9..f0319d5de85808f03f86f5bd8b309f66cabf9285 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -479,6 +479,7 @@ class Parser {
public:
FunctionState(Parser* parser,
Scope* scope,
+ bool is_generator,
Isolate* isolate);
~FunctionState();
@@ -509,6 +510,8 @@ class Parser {
void AddProperty() { expected_property_count_++; }
int expected_property_count() { return expected_property_count_; }
+ bool is_generator() const { return is_generator_; }
+
AstNodeFactory<AstConstructionVisitor>* factory() { return &factory_; }
private:
@@ -523,6 +526,9 @@ class Parser {
// 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_;
@@ -636,6 +642,7 @@ class Parser {
Expression* ParseExpression(bool accept_IN, bool* ok);
Expression* ParseAssignmentExpression(bool accept_IN, bool* ok);
+ Expression* ParseYieldExpression(bool* ok);
Expression* ParseConditionalExpression(bool accept_IN, bool* ok);
Expression* ParseBinaryExpression(int prec, bool accept_IN, bool* ok);
Expression* ParseUnaryExpression(bool* ok);
@@ -679,6 +686,7 @@ class Parser {
ZoneList<Expression*>* ParseArguments(bool* ok);
FunctionLiteral* ParseFunctionLiteral(Handle<String> var_name,
bool name_is_reserved,
+ bool is_generator,
int function_token_position,
FunctionLiteral::Type type,
bool* ok);
@@ -708,6 +716,8 @@ class Parser {
return scanner().Next();
}
+ bool is_generator() const { return current_function_state_->is_generator(); }
+
bool peek_any_identifier();
INLINE(void Consume(Token::Value token));
« no previous file with comments | « src/objects-inl.h ('k') | src/parser.cc » ('j') | test/mjsunit/harmony/generators-parsing.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698