| 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 4962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4973 int pos = peek_position(); | 4973 int pos = peek_position(); |
| 4974 | 4974 |
| 4975 switch (peek()) { | 4975 switch (peek()) { |
| 4976 case Token::FUNCTION: | 4976 case Token::FUNCTION: |
| 4977 case Token::LBRACE: | 4977 case Token::LBRACE: |
| 4978 UNREACHABLE(); // Always handled by the callers. | 4978 UNREACHABLE(); // Always handled by the callers. |
| 4979 case Token::CLASS: | 4979 case Token::CLASS: |
| 4980 ReportUnexpectedToken(Next()); | 4980 ReportUnexpectedToken(Next()); |
| 4981 *ok = false; | 4981 *ok = false; |
| 4982 return impl()->NullStatement(); | 4982 return impl()->NullStatement(); |
| 4983 case Token::LET: |
| 4984 if (PeekAhead() != Token::LBRACK) break; |
| 4985 impl()->ReportMessageAt(scanner()->peek_location(), |
| 4986 MessageTemplate::kUnexpectedLexicalDeclaration); |
| 4987 *ok = false; |
| 4988 return impl()->NullStatement(); |
| 4983 default: | 4989 default: |
| 4984 break; | 4990 break; |
| 4985 } | 4991 } |
| 4986 | 4992 |
| 4987 bool starts_with_identifier = peek_any_identifier(); | 4993 bool starts_with_identifier = peek_any_identifier(); |
| 4988 ExpressionT expr = ParseExpression(true, CHECK_OK); | 4994 ExpressionT expr = ParseExpression(true, CHECK_OK); |
| 4989 if (peek() == Token::COLON && starts_with_identifier && | 4995 if (peek() == Token::COLON && starts_with_identifier && |
| 4990 impl()->IsIdentifier(expr)) { | 4996 impl()->IsIdentifier(expr)) { |
| 4991 // The whole expression was a single identifier, and not, e.g., | 4997 // The whole expression was a single identifier, and not, e.g., |
| 4992 // something starting with an identifier or a parenthesized identifier. | 4998 // something starting with an identifier or a parenthesized identifier. |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5751 } | 5757 } |
| 5752 | 5758 |
| 5753 #undef CHECK_OK | 5759 #undef CHECK_OK |
| 5754 #undef CHECK_OK_CUSTOM | 5760 #undef CHECK_OK_CUSTOM |
| 5755 #undef CHECK_OK_VOID | 5761 #undef CHECK_OK_VOID |
| 5756 | 5762 |
| 5757 } // namespace internal | 5763 } // namespace internal |
| 5758 } // namespace v8 | 5764 } // namespace v8 |
| 5759 | 5765 |
| 5760 #endif // V8_PARSING_PARSER_BASE_H | 5766 #endif // V8_PARSING_PARSER_BASE_H |
| OLD | NEW |