| OLD | NEW | 
|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef V8_PARSING_PARSER_BASE_H | 5 #ifndef V8_PARSING_PARSER_BASE_H | 
| 6 #define V8_PARSING_PARSER_BASE_H | 6 #define V8_PARSING_PARSER_BASE_H | 
| 7 | 7 | 
| 8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" | 
| 9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" | 
| 10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" | 
| (...skipping 4932 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4943   int pos = peek_position(); | 4943   int pos = peek_position(); | 
| 4944 | 4944 | 
| 4945   switch (peek()) { | 4945   switch (peek()) { | 
| 4946     case Token::FUNCTION: | 4946     case Token::FUNCTION: | 
| 4947     case Token::LBRACE: | 4947     case Token::LBRACE: | 
| 4948       UNREACHABLE();  // Always handled by the callers. | 4948       UNREACHABLE();  // Always handled by the callers. | 
| 4949     case Token::CLASS: | 4949     case Token::CLASS: | 
| 4950       ReportUnexpectedToken(Next()); | 4950       ReportUnexpectedToken(Next()); | 
| 4951       *ok = false; | 4951       *ok = false; | 
| 4952       return impl()->NullStatement(); | 4952       return impl()->NullStatement(); | 
| 4953     case Token::LET: | 4953     case Token::LET: { | 
| 4954       if (PeekAhead() != Token::LBRACK) break; | 4954       Token::Value next_next = PeekAhead(); | 
|  | 4955       // "let" followed by either "[", "{" or an identifier means a lexical | 
|  | 4956       // declaration, which should not appear here. | 
|  | 4957       if (next_next != Token::LBRACK && next_next != Token::LBRACE && | 
|  | 4958           next_next != Token::IDENTIFIER) { | 
|  | 4959         break; | 
|  | 4960       } | 
| 4955       impl()->ReportMessageAt(scanner()->peek_location(), | 4961       impl()->ReportMessageAt(scanner()->peek_location(), | 
| 4956                               MessageTemplate::kUnexpectedLexicalDeclaration); | 4962                               MessageTemplate::kUnexpectedLexicalDeclaration); | 
| 4957       *ok = false; | 4963       *ok = false; | 
| 4958       return impl()->NullStatement(); | 4964       return impl()->NullStatement(); | 
|  | 4965     } | 
| 4959     default: | 4966     default: | 
| 4960       break; | 4967       break; | 
| 4961   } | 4968   } | 
| 4962 | 4969 | 
| 4963   bool starts_with_identifier = peek_any_identifier(); | 4970   bool starts_with_identifier = peek_any_identifier(); | 
| 4964   ExpressionT expr = ParseExpression(true, CHECK_OK); | 4971   ExpressionT expr = ParseExpression(true, CHECK_OK); | 
| 4965   if (peek() == Token::COLON && starts_with_identifier && | 4972   if (peek() == Token::COLON && starts_with_identifier && | 
| 4966       impl()->IsIdentifier(expr)) { | 4973       impl()->IsIdentifier(expr)) { | 
| 4967     // The whole expression was a single identifier, and not, e.g., | 4974     // The whole expression was a single identifier, and not, e.g., | 
| 4968     // something starting with an identifier or a parenthesized identifier. | 4975     // something starting with an identifier or a parenthesized identifier. | 
| (...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5865 } | 5872 } | 
| 5866 | 5873 | 
| 5867 #undef CHECK_OK | 5874 #undef CHECK_OK | 
| 5868 #undef CHECK_OK_CUSTOM | 5875 #undef CHECK_OK_CUSTOM | 
| 5869 #undef CHECK_OK_VOID | 5876 #undef CHECK_OK_VOID | 
| 5870 | 5877 | 
| 5871 }  // namespace internal | 5878 }  // namespace internal | 
| 5872 }  // namespace v8 | 5879 }  // namespace v8 | 
| 5873 | 5880 | 
| 5874 #endif  // V8_PARSING_PARSER_BASE_H | 5881 #endif  // V8_PARSING_PARSER_BASE_H | 
| OLD | NEW | 
|---|