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 #include "src/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/ast-expression-rewriter.h" | 9 #include "src/ast/ast-expression-rewriter.h" |
10 #include "src/ast/ast-expression-visitor.h" | 10 #include "src/ast/ast-expression-visitor.h" |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 int pos) { | 636 int pos) { |
637 static const int kNewTargetStringLength = 10; | 637 static const int kNewTargetStringLength = 10; |
638 auto proxy = scope->NewUnresolved( | 638 auto proxy = scope->NewUnresolved( |
639 factory, parser_->ast_value_factory()->new_target_string(), | 639 factory, parser_->ast_value_factory()->new_target_string(), |
640 Variable::NORMAL, pos, pos + kNewTargetStringLength); | 640 Variable::NORMAL, pos, pos + kNewTargetStringLength); |
641 proxy->set_is_new_target(); | 641 proxy->set_is_new_target(); |
642 return proxy; | 642 return proxy; |
643 } | 643 } |
644 | 644 |
645 | 645 |
| 646 Expression* ParserTraits::FunctionSentExpression(Scope* scope, |
| 647 AstNodeFactory* factory, |
| 648 int pos) { |
| 649 // We desugar function.sent into %GeneratorGetInput(generator). |
| 650 Zone* zone = parser_->zone(); |
| 651 ZoneList<Expression*>* args = new (zone) ZoneList<Expression*>(1, zone); |
| 652 VariableProxy* generator = factory->NewVariableProxy( |
| 653 parser_->function_state_->generator_object_variable()); |
| 654 args->Add(generator, zone); |
| 655 return factory->NewCallRuntime(Runtime::kGeneratorGetInput, args, pos); |
| 656 } |
| 657 |
| 658 |
646 Expression* ParserTraits::DefaultConstructor(bool call_super, Scope* scope, | 659 Expression* ParserTraits::DefaultConstructor(bool call_super, Scope* scope, |
647 int pos, int end_pos, | 660 int pos, int end_pos, |
648 LanguageMode mode) { | 661 LanguageMode mode) { |
649 return parser_->DefaultConstructor(call_super, scope, pos, end_pos, mode); | 662 return parser_->DefaultConstructor(call_super, scope, pos, end_pos, mode); |
650 } | 663 } |
651 | 664 |
652 | 665 |
653 Literal* ParserTraits::ExpressionFromLiteral(Token::Value token, int pos, | 666 Literal* ParserTraits::ExpressionFromLiteral(Token::Value token, int pos, |
654 Scanner* scanner, | 667 Scanner* scanner, |
655 AstNodeFactory* factory) { | 668 AstNodeFactory* factory) { |
(...skipping 5117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5773 auto class_literal = value->AsClassLiteral(); | 5786 auto class_literal = value->AsClassLiteral(); |
5774 if (class_literal->raw_name() == nullptr) { | 5787 if (class_literal->raw_name() == nullptr) { |
5775 class_literal->set_raw_name(name); | 5788 class_literal->set_raw_name(name); |
5776 } | 5789 } |
5777 } | 5790 } |
5778 } | 5791 } |
5779 | 5792 |
5780 | 5793 |
5781 } // namespace internal | 5794 } // namespace internal |
5782 } // namespace v8 | 5795 } // namespace v8 |
OLD | NEW |