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

Side by Side Diff: src/parser.cc

Issue 1386253002: Use Scope::function_kind_ to distinguish arrow function scopes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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 #include "src/parser.h" 5 #include "src/parser.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/ast-literal-reindexer.h" 9 #include "src/ast-literal-reindexer.h"
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 DCHECK(info->language_mode() == shared_info->language_mode()); 1183 DCHECK(info->language_mode() == shared_info->language_mode());
1184 FunctionLiteral::FunctionType function_type = shared_info->is_expression() 1184 FunctionLiteral::FunctionType function_type = shared_info->is_expression()
1185 ? (shared_info->is_anonymous() 1185 ? (shared_info->is_anonymous()
1186 ? FunctionLiteral::ANONYMOUS_EXPRESSION 1186 ? FunctionLiteral::ANONYMOUS_EXPRESSION
1187 : FunctionLiteral::NAMED_EXPRESSION) 1187 : FunctionLiteral::NAMED_EXPRESSION)
1188 : FunctionLiteral::DECLARATION; 1188 : FunctionLiteral::DECLARATION;
1189 bool ok = true; 1189 bool ok = true;
1190 1190
1191 if (shared_info->is_arrow()) { 1191 if (shared_info->is_arrow()) {
1192 Scope* scope = 1192 Scope* scope =
1193 NewScope(scope_, ARROW_SCOPE, FunctionKind::kArrowFunction); 1193 NewScope(scope_, FUNCTION_SCOPE, FunctionKind::kArrowFunction);
1194 scope->SetLanguageMode(shared_info->language_mode()); 1194 scope->SetLanguageMode(shared_info->language_mode());
1195 scope->set_start_position(shared_info->start_position()); 1195 scope->set_start_position(shared_info->start_position());
1196 ExpressionClassifier formals_classifier; 1196 ExpressionClassifier formals_classifier;
1197 ParserFormalParameters formals(scope); 1197 ParserFormalParameters formals(scope);
1198 Checkpoint checkpoint(this); 1198 Checkpoint checkpoint(this);
1199 { 1199 {
1200 // Parsing patterns as variable reference expression creates 1200 // Parsing patterns as variable reference expression creates
1201 // NewUnresolved references in current scope. Entrer arrow function 1201 // NewUnresolved references in current scope. Entrer arrow function
1202 // scope for formal parameter parsing. 1202 // scope for formal parameter parsing.
1203 BlockState block_state(&scope_, scope); 1203 BlockState block_state(&scope_, scope);
(...skipping 5138 matching lines...) Expand 10 before | Expand all | Expand 10 after
6342 6342
6343 Expression* Parser::SpreadCallNew(Expression* function, 6343 Expression* Parser::SpreadCallNew(Expression* function,
6344 ZoneList<v8::internal::Expression*>* args, 6344 ZoneList<v8::internal::Expression*>* args,
6345 int pos) { 6345 int pos) {
6346 args->InsertAt(0, function, zone()); 6346 args->InsertAt(0, function, zone());
6347 6347
6348 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); 6348 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos);
6349 } 6349 }
6350 } // namespace internal 6350 } // namespace internal
6351 } // namespace v8 6351 } // namespace v8
OLDNEW
« no previous file with comments | « src/globals.h ('k') | src/preparser.h » ('j') | test/mjsunit/es6/regress/regress-4466.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698