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

Unified Diff: src/preparser.h

Issue 12646003: Add parser support for generators. (Closed) Base URL: git://github.com/v8/v8.git@bleeding_edge
Patch Set: 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
« no previous file with comments | « src/parser.cc ('k') | src/preparser.cc » ('j') | src/preparser.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index ad52d74bbd8082cb3f4c4a4e390f6fc7aa0ee7ab..1df792fd7b33c361a01e64015e7f67ce0566e4b6 100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -240,9 +240,13 @@ class PreParser {
static Identifier FutureStrictReserved() {
return Identifier(kFutureStrictReservedIdentifier);
}
+ static Identifier Yield() {
+ return Identifier(kFutureStrictReservedIdentifier);
+ }
bool IsEval() { return type_ == kEvalIdentifier; }
bool IsArguments() { return type_ == kArgumentsIdentifier; }
bool IsEvalOrArguments() { return type_ >= kEvalIdentifier; }
+ bool IsYield() { return type_ == kYieldIdentifier; }
bool IsFutureReserved() { return type_ == kFutureReservedIdentifier; }
bool IsFutureStrictReserved() {
return type_ == kFutureStrictReservedIdentifier;
@@ -254,6 +258,7 @@ class PreParser {
kUnknownIdentifier,
kFutureReservedIdentifier,
kFutureStrictReservedIdentifier,
+ kYieldIdentifier,
kEvalIdentifier,
kArgumentsIdentifier
};
@@ -451,7 +456,8 @@ class PreParser {
expected_properties_(0),
with_nesting_count_(0),
language_mode_(
- (prev_ != NULL) ? prev_->language_mode() : i::CLASSIC_MODE) {
+ (prev_ != NULL) ? prev_->language_mode() : i::CLASSIC_MODE),
+ is_generator_(false) {
*variable = this;
}
~Scope() { *variable_ = prev_; }
@@ -461,6 +467,8 @@ class PreParser {
int expected_properties() { return expected_properties_; }
int materialized_literal_count() { return materialized_literal_count_; }
bool IsInsideWith() { return with_nesting_count_ != 0; }
+ bool is_generator() { return is_generator_; }
+ void set_is_generator(bool is_generator) { is_generator_ = is_generator; }
bool is_classic_mode() {
return language_mode_ == i::CLASSIC_MODE;
}
@@ -492,6 +500,7 @@ class PreParser {
int expected_properties_;
int with_nesting_count_;
i::LanguageMode language_mode_;
+ bool is_generator_;
};
// Preparse the program. Only called in PreParseProgram after creating
« no previous file with comments | « src/parser.cc ('k') | src/preparser.cc » ('j') | src/preparser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698