Index: src/preparser.h |
diff --git a/src/preparser.h b/src/preparser.h |
index ad52d74bbd8082cb3f4c4a4e390f6fc7aa0ee7ab..d5fca0bf6d17158e826caca82a17084546db51fb 100644 |
--- a/src/preparser.h |
+++ b/src/preparser.h |
@@ -152,11 +152,12 @@ class PreParser { |
// parameters to the closing brace after the body. |
// Returns a FunctionEntry describing the body of the function in enough |
// detail that it can be lazily compiled. |
- // The scanner is expected to have matched the "function" keyword and |
- // parameters, and have consumed the initial '{'. |
+ // The scanner is expected to have matched the "function" or "function*" |
+ // keyword and parameters, and have consumed the initial '{'. |
// At return, unless an error occurred, the scanner is positioned before the |
// the final '}'. |
PreParseResult PreParseLazyFunction(i::LanguageMode mode, |
+ bool is_generator, |
i::ParserRecorder* log); |
private: |
@@ -240,9 +241,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 +259,7 @@ class PreParser { |
kUnknownIdentifier, |
kFutureReservedIdentifier, |
kFutureStrictReservedIdentifier, |
+ kYieldIdentifier, |
kEvalIdentifier, |
kArgumentsIdentifier |
}; |
@@ -347,7 +353,7 @@ class PreParser { |
// Identifiers and string literals can be parenthesized. |
// They no longer work as labels or directive prologues, |
// but are still recognized in other contexts. |
- return Expression(code_ | kParentesizedExpressionFlag); |
+ return Expression(code_ | kParenthesizedExpressionFlag); |
} |
// For other types of expressions, it's not important to remember |
// the parentheses. |
@@ -373,7 +379,8 @@ class PreParser { |
kUseStrictString = kStringLiteralFlag | 8, |
kStringLiteralMask = kUseStrictString, |
- kParentesizedExpressionFlag = 4, // Only if identifier or string literal. |
+ // Only if identifier or string literal. |
+ kParenthesizedExpressionFlag = 4, |
// Below here applies if neither identifier nor string literal. |
kThisExpression = 4, |
@@ -451,7 +458,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 +469,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 +502,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 |
@@ -557,6 +568,7 @@ class PreParser { |
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); |
@@ -572,7 +584,7 @@ class PreParser { |
Expression ParseV8Intrinsic(bool* ok); |
Arguments ParseArguments(bool* ok); |
- Expression ParseFunctionLiteral(bool* ok); |
+ Expression ParseFunctionLiteral(bool is_generator, bool* ok); |
void ParseLazyFunctionLiteralBody(bool* ok); |
Identifier ParseIdentifier(bool* ok); |