| 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 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 | 741 |
| 742 Expression* ParserTraits::ThisExpression(Scope* scope, AstNodeFactory* factory, | 742 Expression* ParserTraits::ThisExpression(Scope* scope, AstNodeFactory* factory, |
| 743 int pos) { | 743 int pos) { |
| 744 return scope->NewUnresolved(factory, | 744 return scope->NewUnresolved(factory, |
| 745 parser_->ast_value_factory()->this_string(), | 745 parser_->ast_value_factory()->this_string(), |
| 746 Variable::THIS, pos, pos + 4); | 746 Variable::THIS, pos, pos + 4); |
| 747 } | 747 } |
| 748 | 748 |
| 749 Expression* ParserTraits::SuperReference(Scope* scope, AstNodeFactory* factory, | 749 Expression* ParserTraits::SuperReference(Scope* scope, AstNodeFactory* factory, |
| 750 int pos) { | 750 int pos) { |
| 751 // TODO(arv): Split into SuperProperty and SuperCall? |
| 752 VariableProxy* home_object_proxy = scope->NewUnresolved( |
| 753 factory, parser_->ast_value_factory()->home_object_string(), |
| 754 Variable::NORMAL, pos); |
| 755 |
| 751 return factory->NewSuperReference( | 756 return factory->NewSuperReference( |
| 752 ThisExpression(scope, factory, pos)->AsVariableProxy(), | 757 ThisExpression(scope, factory, pos)->AsVariableProxy(), home_object_proxy, |
| 753 pos); | 758 pos); |
| 754 } | 759 } |
| 755 | 760 |
| 756 | 761 |
| 757 Expression* ParserTraits::DefaultConstructor(bool call_super, Scope* scope, | 762 Expression* ParserTraits::DefaultConstructor(bool call_super, Scope* scope, |
| 758 int pos, int end_pos) { | 763 int pos, int end_pos) { |
| 759 return parser_->DefaultConstructor(call_super, scope, pos, end_pos); | 764 return parser_->DefaultConstructor(call_super, scope, pos, end_pos); |
| 760 } | 765 } |
| 761 | 766 |
| 762 | 767 |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 DCHECK(info->language_mode() == shared_info->language_mode()); | 1134 DCHECK(info->language_mode() == shared_info->language_mode()); |
| 1130 scope->SetLanguageMode(shared_info->language_mode()); | 1135 scope->SetLanguageMode(shared_info->language_mode()); |
| 1131 FunctionLiteral::FunctionType function_type = shared_info->is_expression() | 1136 FunctionLiteral::FunctionType function_type = shared_info->is_expression() |
| 1132 ? (shared_info->is_anonymous() | 1137 ? (shared_info->is_anonymous() |
| 1133 ? FunctionLiteral::ANONYMOUS_EXPRESSION | 1138 ? FunctionLiteral::ANONYMOUS_EXPRESSION |
| 1134 : FunctionLiteral::NAMED_EXPRESSION) | 1139 : FunctionLiteral::NAMED_EXPRESSION) |
| 1135 : FunctionLiteral::DECLARATION; | 1140 : FunctionLiteral::DECLARATION; |
| 1136 bool ok = true; | 1141 bool ok = true; |
| 1137 | 1142 |
| 1138 if (shared_info->is_arrow()) { | 1143 if (shared_info->is_arrow()) { |
| 1139 Scope* scope = NewScope(scope_, ARROW_SCOPE); | 1144 Scope* scope = |
| 1145 NewScope(scope_, ARROW_SCOPE, FunctionKind::kArrowFunction); |
| 1140 scope->set_start_position(shared_info->start_position()); | 1146 scope->set_start_position(shared_info->start_position()); |
| 1141 FormalParameterErrorLocations error_locs; | 1147 FormalParameterErrorLocations error_locs; |
| 1142 bool has_rest = false; | 1148 bool has_rest = false; |
| 1143 if (Check(Token::LPAREN)) { | 1149 if (Check(Token::LPAREN)) { |
| 1144 // '(' StrictFormalParameters ')' | 1150 // '(' StrictFormalParameters ')' |
| 1145 ParseFormalParameterList(scope, &error_locs, &has_rest, &ok); | 1151 ParseFormalParameterList(scope, &error_locs, &has_rest, &ok); |
| 1146 if (ok) ok = Check(Token::RPAREN); | 1152 if (ok) ok = Check(Token::RPAREN); |
| 1147 } else { | 1153 } else { |
| 1148 // BindingIdentifier | 1154 // BindingIdentifier |
| 1149 ParseFormalParameter(scope, &error_locs, has_rest, &ok); | 1155 ParseFormalParameter(scope, &error_locs, has_rest, &ok); |
| (...skipping 4625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5775 | 5781 |
| 5776 Expression* Parser::SpreadCallNew(Expression* function, | 5782 Expression* Parser::SpreadCallNew(Expression* function, |
| 5777 ZoneList<v8::internal::Expression*>* args, | 5783 ZoneList<v8::internal::Expression*>* args, |
| 5778 int pos) { | 5784 int pos) { |
| 5779 args->InsertAt(0, function, zone()); | 5785 args->InsertAt(0, function, zone()); |
| 5780 | 5786 |
| 5781 return factory()->NewCallRuntime( | 5787 return factory()->NewCallRuntime( |
| 5782 ast_value_factory()->reflect_construct_string(), NULL, args, pos); | 5788 ast_value_factory()->reflect_construct_string(), NULL, args, pos); |
| 5783 } | 5789 } |
| 5784 } } // namespace v8::internal | 5790 } } // namespace v8::internal |
| OLD | NEW |