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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/ast.h" | 8 #include "src/ast.h" |
9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 | 742 |
743 Expression* ParserTraits::ThisExpression(Scope* scope, AstNodeFactory* factory, | 743 Expression* ParserTraits::ThisExpression(Scope* scope, AstNodeFactory* factory, |
744 int pos) { | 744 int pos) { |
745 return scope->NewUnresolved(factory, | 745 return scope->NewUnresolved(factory, |
746 parser_->ast_value_factory()->this_string(), | 746 parser_->ast_value_factory()->this_string(), |
747 Variable::THIS, pos, pos + 4); | 747 Variable::THIS, pos, pos + 4); |
748 } | 748 } |
749 | 749 |
750 Expression* ParserTraits::SuperReference(Scope* scope, AstNodeFactory* factory, | 750 Expression* ParserTraits::SuperReference(Scope* scope, AstNodeFactory* factory, |
751 int pos) { | 751 int pos) { |
| 752 // TODO(arv): Split into SuperProperty and SuperCall? |
| 753 VariableProxy* home_object_proxy = scope->NewUnresolved( |
| 754 factory, parser_->ast_value_factory()->home_object_string(), |
| 755 Variable::NORMAL, pos); |
| 756 |
752 return factory->NewSuperReference( | 757 return factory->NewSuperReference( |
753 ThisExpression(scope, factory, pos)->AsVariableProxy(), | 758 ThisExpression(scope, factory, pos)->AsVariableProxy(), home_object_proxy, |
754 pos); | 759 pos); |
755 } | 760 } |
756 | 761 |
757 | 762 |
758 Expression* ParserTraits::DefaultConstructor(bool call_super, Scope* scope, | 763 Expression* ParserTraits::DefaultConstructor(bool call_super, Scope* scope, |
759 int pos, int end_pos) { | 764 int pos, int end_pos) { |
760 return parser_->DefaultConstructor(call_super, scope, pos, end_pos); | 765 return parser_->DefaultConstructor(call_super, scope, pos, end_pos); |
761 } | 766 } |
762 | 767 |
763 | 768 |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 DCHECK(info->language_mode() == shared_info->language_mode()); | 1135 DCHECK(info->language_mode() == shared_info->language_mode()); |
1131 scope->SetLanguageMode(shared_info->language_mode()); | 1136 scope->SetLanguageMode(shared_info->language_mode()); |
1132 FunctionLiteral::FunctionType function_type = shared_info->is_expression() | 1137 FunctionLiteral::FunctionType function_type = shared_info->is_expression() |
1133 ? (shared_info->is_anonymous() | 1138 ? (shared_info->is_anonymous() |
1134 ? FunctionLiteral::ANONYMOUS_EXPRESSION | 1139 ? FunctionLiteral::ANONYMOUS_EXPRESSION |
1135 : FunctionLiteral::NAMED_EXPRESSION) | 1140 : FunctionLiteral::NAMED_EXPRESSION) |
1136 : FunctionLiteral::DECLARATION; | 1141 : FunctionLiteral::DECLARATION; |
1137 bool ok = true; | 1142 bool ok = true; |
1138 | 1143 |
1139 if (shared_info->is_arrow()) { | 1144 if (shared_info->is_arrow()) { |
1140 Scope* scope = NewScope(scope_, ARROW_SCOPE); | 1145 Scope* scope = |
| 1146 NewScope(scope_, ARROW_SCOPE, FunctionKind::kArrowFunction); |
1141 scope->set_start_position(shared_info->start_position()); | 1147 scope->set_start_position(shared_info->start_position()); |
1142 ExpressionClassifier formals_classifier; | 1148 ExpressionClassifier formals_classifier; |
1143 bool has_rest = false; | 1149 bool has_rest = false; |
1144 if (Check(Token::LPAREN)) { | 1150 if (Check(Token::LPAREN)) { |
1145 // '(' StrictFormalParameters ')' | 1151 // '(' StrictFormalParameters ')' |
1146 ParseFormalParameterList(scope, &has_rest, &formals_classifier, &ok); | 1152 ParseFormalParameterList(scope, &has_rest, &formals_classifier, &ok); |
1147 if (ok) ok = Check(Token::RPAREN); | 1153 if (ok) ok = Check(Token::RPAREN); |
1148 } else { | 1154 } else { |
1149 // BindingIdentifier | 1155 // BindingIdentifier |
1150 ParseFormalParameter(scope, has_rest, &formals_classifier, &ok); | 1156 ParseFormalParameter(scope, has_rest, &formals_classifier, &ok); |
(...skipping 4652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5803 | 5809 |
5804 Expression* Parser::SpreadCallNew(Expression* function, | 5810 Expression* Parser::SpreadCallNew(Expression* function, |
5805 ZoneList<v8::internal::Expression*>* args, | 5811 ZoneList<v8::internal::Expression*>* args, |
5806 int pos) { | 5812 int pos) { |
5807 args->InsertAt(0, function, zone()); | 5813 args->InsertAt(0, function, zone()); |
5808 | 5814 |
5809 return factory()->NewCallRuntime( | 5815 return factory()->NewCallRuntime( |
5810 ast_value_factory()->reflect_construct_string(), NULL, args, pos); | 5816 ast_value_factory()->reflect_construct_string(), NULL, args, pos); |
5811 } | 5817 } |
5812 } } // namespace v8::internal | 5818 } } // namespace v8::internal |
OLD | NEW |