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 4978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4989 int pos = peek_position(); | 4989 int pos = peek_position(); |
4990 | 4990 |
4991 switch (peek()) { | 4991 switch (peek()) { |
4992 case Token::FUNCTION: | 4992 case Token::FUNCTION: |
4993 case Token::LBRACE: | 4993 case Token::LBRACE: |
4994 UNREACHABLE(); // Always handled by the callers. | 4994 UNREACHABLE(); // Always handled by the callers. |
4995 case Token::CLASS: | 4995 case Token::CLASS: |
4996 ReportUnexpectedToken(Next()); | 4996 ReportUnexpectedToken(Next()); |
4997 *ok = false; | 4997 *ok = false; |
4998 return impl()->NullStatement(); | 4998 return impl()->NullStatement(); |
| 4999 case Token::LET: |
| 5000 if (PeekAhead() != Token::LBRACK) break; |
| 5001 impl()->ReportMessageAt(scanner()->peek_location(), |
| 5002 MessageTemplate::kUnexpectedTokenLetLBrack); |
| 5003 *ok = false; |
| 5004 return impl()->NullStatement(); |
4999 default: | 5005 default: |
5000 break; | 5006 break; |
5001 } | 5007 } |
5002 | 5008 |
5003 bool starts_with_identifier = peek_any_identifier(); | 5009 bool starts_with_identifier = peek_any_identifier(); |
5004 ExpressionT expr = ParseExpression(true, CHECK_OK); | 5010 ExpressionT expr = ParseExpression(true, CHECK_OK); |
5005 if (peek() == Token::COLON && starts_with_identifier && | 5011 if (peek() == Token::COLON && starts_with_identifier && |
5006 impl()->IsIdentifier(expr)) { | 5012 impl()->IsIdentifier(expr)) { |
5007 // The whole expression was a single identifier, and not, e.g., | 5013 // The whole expression was a single identifier, and not, e.g., |
5008 // something starting with an identifier or a parenthesized identifier. | 5014 // something starting with an identifier or a parenthesized identifier. |
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5767 } | 5773 } |
5768 | 5774 |
5769 #undef CHECK_OK | 5775 #undef CHECK_OK |
5770 #undef CHECK_OK_CUSTOM | 5776 #undef CHECK_OK_CUSTOM |
5771 #undef CHECK_OK_VOID | 5777 #undef CHECK_OK_VOID |
5772 | 5778 |
5773 } // namespace internal | 5779 } // namespace internal |
5774 } // namespace v8 | 5780 } // namespace v8 |
5775 | 5781 |
5776 #endif // V8_PARSING_PARSER_BASE_H | 5782 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |