Chromium Code Reviews| Index: src/preparser.cc |
| diff --git a/src/preparser.cc b/src/preparser.cc |
| index 7ab9814bb41722de1be126ffd96313e523346379..76ff3acc80c5e0f13bb9900454dbd9a4440abcbe 100644 |
| --- a/src/preparser.cc |
| +++ b/src/preparser.cc |
| @@ -132,6 +132,14 @@ PreParser::PreParseResult PreParser::PreParseLazyFunction( |
| } |
| +PreParserExpression PreParserTraits::ParseClassLiteral( |
| + PreParserIdentifier name, Scanner::Location class_name_location, |
| + bool name_is_strict_reserved, int pos, bool* ok) { |
| + return pre_parser_->ParseClassLiteral(name, class_name_location, |
| + name_is_strict_reserved, pos, ok); |
| +} |
| + |
| + |
| // Preparsing checks a JavaScript program and emits preparse-data that helps |
| // a later parsing to be faster. |
| // See preparser-data.h for the data. |
| @@ -928,6 +936,47 @@ void PreParser::ParseLazyFunctionLiteralBody(bool* ok) { |
| } |
| +PreParserExpression PreParser::ParseClassLiteral( |
| + PreParserIdentifier name, Scanner::Location class_name_location, |
| + bool name_is_strict_reserved, int pos, bool* ok) { |
| + // All parts of a ClassDeclaration and ClassExpression are strict code. |
| + if (name_is_strict_reserved) { |
| + ReportMessageAt(class_name_location, "unexpected_strict_reserved"); |
| + *ok = false; |
| + return this->EmptyExpression(); |
|
adamk
2014/11/13 01:45:44
"this->" unnecessary here and below, as well.
arv (Not doing code reviews)
2014/11/13 20:47:50
Done.
|
| + } |
| + if (this->IsEvalOrArguments(name)) { |
| + ReportMessageAt(class_name_location, "strict_eval_arguments"); |
| + *ok = false; |
| + return this->EmptyExpression(); |
| + } |
| + |
| + PreParserScope scope = this->NewScope(scope_, BLOCK_SCOPE); |
| + BlockState block_state(&scope_, &scope); |
| + scope_->SetStrictMode(STRICT); |
| + scope_->SetScopeName(name); |
| + |
| + if (Check(Token::EXTENDS)) { |
| + this->ParseLeftHandSideExpression(CHECK_OK); |
| + } |
| + |
| + bool has_seen_constructor = false; |
| + |
| + Expect(Token::LBRACE, CHECK_OK); |
| + while (peek() != Token::RBRACE) { |
| + if (Check(Token::SEMICOLON)) continue; |
| + const bool in_class = true; |
| + const bool is_static = false; |
| + this->ParsePropertyDefinition(NULL, in_class, is_static, |
| + &has_seen_constructor, CHECK_OK); |
| + } |
| + |
| + Expect(Token::RBRACE, CHECK_OK); |
| + |
| + return Expression::Default(); |
| +} |
| + |
| + |
| PreParser::Expression PreParser::ParseV8Intrinsic(bool* ok) { |
| // CallRuntime :: |
| // '%' Identifier Arguments |