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 3303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3314 | 3314 |
3315 if (peek() == Token::NEW) { | 3315 if (peek() == Token::NEW) { |
3316 BindingPatternUnexpectedToken(); | 3316 BindingPatternUnexpectedToken(); |
3317 ArrowFormalParametersUnexpectedToken(); | 3317 ArrowFormalParametersUnexpectedToken(); |
3318 Consume(Token::NEW); | 3318 Consume(Token::NEW); |
3319 int new_pos = position(); | 3319 int new_pos = position(); |
3320 ExpressionT result; | 3320 ExpressionT result; |
3321 if (peek() == Token::SUPER) { | 3321 if (peek() == Token::SUPER) { |
3322 const bool is_new = true; | 3322 const bool is_new = true; |
3323 result = ParseSuperExpression(is_new, CHECK_OK); | 3323 result = ParseSuperExpression(is_new, CHECK_OK); |
| 3324 } else if (allow_harmony_dynamic_import() && peek() == Token::IMPORT) { |
| 3325 impl()->ReportMessageAt(scanner()->peek_location(), |
| 3326 MessageTemplate::kImportCallNotNewExpression); |
| 3327 *ok = false; |
| 3328 return impl()->EmptyExpression(); |
3324 } else if (peek() == Token::PERIOD) { | 3329 } else if (peek() == Token::PERIOD) { |
3325 return ParseNewTargetExpression(CHECK_OK); | 3330 return ParseNewTargetExpression(CHECK_OK); |
3326 } else { | 3331 } else { |
3327 result = ParseMemberWithNewPrefixesExpression(is_async, CHECK_OK); | 3332 result = ParseMemberWithNewPrefixesExpression(is_async, CHECK_OK); |
3328 } | 3333 } |
3329 impl()->RewriteNonPattern(CHECK_OK); | 3334 impl()->RewriteNonPattern(CHECK_OK); |
3330 if (peek() == Token::LPAREN) { | 3335 if (peek() == Token::LPAREN) { |
3331 // NewExpression with arguments. | 3336 // NewExpression with arguments. |
3332 Scanner::Location spread_pos; | 3337 Scanner::Location spread_pos; |
3333 ExpressionListT args = ParseArguments(&spread_pos, CHECK_OK); | 3338 ExpressionListT args = ParseArguments(&spread_pos, CHECK_OK); |
(...skipping 2413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5747 return; | 5752 return; |
5748 } | 5753 } |
5749 } | 5754 } |
5750 | 5755 |
5751 #undef CHECK_OK_VOID | 5756 #undef CHECK_OK_VOID |
5752 | 5757 |
5753 } // namespace internal | 5758 } // namespace internal |
5754 } // namespace v8 | 5759 } // namespace v8 |
5755 | 5760 |
5756 #endif // V8_PARSING_PARSER_BASE_H | 5761 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |