Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(586)

Side by Side Diff: src/parsing/parser-base.h

Issue 2703563002: [ESNext] Implement DynamicImportCall (Closed)
Patch Set: add test + comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 3332 matching lines...) Expand 10 before | Expand all | Expand 10 after
3343 3343
3344 template <typename Impl> 3344 template <typename Impl>
3345 typename ParserBase<Impl>::ExpressionT 3345 typename ParserBase<Impl>::ExpressionT
3346 ParserBase<Impl>::ParseDynamicImportExpression(bool* ok) { 3346 ParserBase<Impl>::ParseDynamicImportExpression(bool* ok) {
3347 DCHECK(allow_harmony_dynamic_import()); 3347 DCHECK(allow_harmony_dynamic_import());
3348 Consume(Token::IMPORT); 3348 Consume(Token::IMPORT);
3349 int pos = position(); 3349 int pos = position();
3350 Expect(Token::LPAREN, CHECK_OK); 3350 Expect(Token::LPAREN, CHECK_OK);
3351 ExpressionT arg = ParseAssignmentExpression(true, CHECK_OK); 3351 ExpressionT arg = ParseAssignmentExpression(true, CHECK_OK);
3352 Expect(Token::RPAREN, CHECK_OK); 3352 Expect(Token::RPAREN, CHECK_OK);
3353 ZoneList<ExpressionT>* args = new (zone()) ZoneList<ExpressionT>(1, zone()); 3353 return factory()->NewImportCallExpression(arg, pos);
3354 args->Add(arg, zone());
3355 return factory()->NewCallRuntime(Runtime::kDynamicImportCall, args, pos);
3356 } 3354 }
3357 3355
3358 template <typename Impl> 3356 template <typename Impl>
3359 typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseSuperExpression( 3357 typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseSuperExpression(
3360 bool is_new, bool* ok) { 3358 bool is_new, bool* ok) {
3361 Expect(Token::SUPER, CHECK_OK); 3359 Expect(Token::SUPER, CHECK_OK);
3362 int pos = position(); 3360 int pos = position();
3363 3361
3364 DeclarationScope* scope = GetReceiverScope(); 3362 DeclarationScope* scope = GetReceiverScope();
3365 FunctionKind kind = scope->function_kind(); 3363 FunctionKind kind = scope->function_kind();
(...skipping 2442 matching lines...) Expand 10 before | Expand all | Expand 10 after
5808 } 5806 }
5809 5807
5810 #undef CHECK_OK 5808 #undef CHECK_OK
5811 #undef CHECK_OK_CUSTOM 5809 #undef CHECK_OK_CUSTOM
5812 #undef CHECK_OK_VOID 5810 #undef CHECK_OK_VOID
5813 5811
5814 } // namespace internal 5812 } // namespace internal
5815 } // namespace v8 5813 } // namespace v8
5816 5814
5817 #endif // V8_PARSING_PARSER_BASE_H 5815 #endif // V8_PARSING_PARSER_BASE_H
OLDNEW
« include/v8.h ('K') | « src/objects.h ('k') | src/parsing/pattern-rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698