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

Side by Side Diff: src/parser.cc

Issue 1135243004: [es6] Support super.property in eval and arrow functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Code review cleanup Created 5 years, 6 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
« no previous file with comments | « src/parser.h ('k') | src/preparser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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
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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 DCHECK(info->language_mode() == shared_info->language_mode()); 1136 DCHECK(info->language_mode() == shared_info->language_mode());
1132 scope->SetLanguageMode(shared_info->language_mode()); 1137 scope->SetLanguageMode(shared_info->language_mode());
1133 FunctionLiteral::FunctionType function_type = shared_info->is_expression() 1138 FunctionLiteral::FunctionType function_type = shared_info->is_expression()
1134 ? (shared_info->is_anonymous() 1139 ? (shared_info->is_anonymous()
1135 ? FunctionLiteral::ANONYMOUS_EXPRESSION 1140 ? FunctionLiteral::ANONYMOUS_EXPRESSION
1136 : FunctionLiteral::NAMED_EXPRESSION) 1141 : FunctionLiteral::NAMED_EXPRESSION)
1137 : FunctionLiteral::DECLARATION; 1142 : FunctionLiteral::DECLARATION;
1138 bool ok = true; 1143 bool ok = true;
1139 1144
1140 if (shared_info->is_arrow()) { 1145 if (shared_info->is_arrow()) {
1141 Scope* scope = NewScope(scope_, ARROW_SCOPE); 1146 Scope* scope =
1147 NewScope(scope_, ARROW_SCOPE, FunctionKind::kArrowFunction);
1142 scope->set_start_position(shared_info->start_position()); 1148 scope->set_start_position(shared_info->start_position());
1143 ExpressionClassifier formals_classifier; 1149 ExpressionClassifier formals_classifier;
1144 bool has_rest = false; 1150 bool has_rest = false;
1145 if (Check(Token::LPAREN)) { 1151 if (Check(Token::LPAREN)) {
1146 // '(' StrictFormalParameters ')' 1152 // '(' StrictFormalParameters ')'
1147 ParseFormalParameterList(scope, &has_rest, &formals_classifier, &ok); 1153 ParseFormalParameterList(scope, &has_rest, &formals_classifier, &ok);
1148 if (ok) ok = Check(Token::RPAREN); 1154 if (ok) ok = Check(Token::RPAREN);
1149 } else { 1155 } else {
1150 // BindingIdentifier 1156 // BindingIdentifier
1151 ParseFormalParameter(scope, has_rest, &formals_classifier, &ok); 1157 ParseFormalParameter(scope, has_rest, &formals_classifier, &ok);
(...skipping 4632 matching lines...) Expand 10 before | Expand all | Expand 10 after
5784 5790
5785 Expression* Parser::SpreadCallNew(Expression* function, 5791 Expression* Parser::SpreadCallNew(Expression* function,
5786 ZoneList<v8::internal::Expression*>* args, 5792 ZoneList<v8::internal::Expression*>* args,
5787 int pos) { 5793 int pos) {
5788 args->InsertAt(0, function, zone()); 5794 args->InsertAt(0, function, zone());
5789 5795
5790 return factory()->NewCallRuntime( 5796 return factory()->NewCallRuntime(
5791 ast_value_factory()->reflect_construct_string(), NULL, args, pos); 5797 ast_value_factory()->reflect_construct_string(), NULL, args, pos);
5792 } 5798 }
5793 } } // namespace v8::internal 5799 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/parser.h ('k') | src/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698