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

Side by Side Diff: runtime/vm/parser.cc

Issue 2164323002: Remove unnecessary capturing code from the Parser::CreateImplicitClosureNode. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/parser.h" 5 #include "vm/parser.h"
6 #include "vm/flags.h" 6 #include "vm/flags.h"
7 7
8 #ifndef DART_PRECOMPILED_RUNTIME 8 #ifndef DART_PRECOMPILED_RUNTIME
9 9
10 #include "lib/invocation_mirror.h" 10 #include "lib/invocation_mirror.h"
(...skipping 2388 matching lines...) Expand 10 before | Expand all | Expand 10 after
2399 } 2399 }
2400 return super_op; 2400 return super_op;
2401 } 2401 }
2402 2402
2403 2403
2404 ClosureNode* Parser::CreateImplicitClosureNode(const Function& func, 2404 ClosureNode* Parser::CreateImplicitClosureNode(const Function& func,
2405 TokenPosition token_pos, 2405 TokenPosition token_pos,
2406 AstNode* receiver) { 2406 AstNode* receiver) {
2407 Function& implicit_closure_function = 2407 Function& implicit_closure_function =
2408 Function::ZoneHandle(Z, func.ImplicitClosureFunction()); 2408 Function::ZoneHandle(Z, func.ImplicitClosureFunction());
2409 if (receiver != NULL) {
2410 // If we create an implicit instance closure from inside a closure of a
2411 // parameterized class, make sure that the receiver is captured as
2412 // instantiator.
2413 if (FunctionLevel() > 0) {
2414 const Type& signature_type = Type::Handle(Z,
2415 implicit_closure_function.SignatureType());
2416 const Class& scope_class = Class::Handle(Z, signature_type.type_class());
2417 if (scope_class.IsGeneric()) {
2418 CaptureInstantiator();
2419 }
2420 }
2421 }
2422 return new ClosureNode(token_pos, implicit_closure_function, receiver, NULL); 2409 return new ClosureNode(token_pos, implicit_closure_function, receiver, NULL);
2423 } 2410 }
2424 2411
2425 2412
2426 AstNode* Parser::ParseSuperFieldAccess(const String& field_name, 2413 AstNode* Parser::ParseSuperFieldAccess(const String& field_name,
2427 TokenPosition field_pos) { 2414 TokenPosition field_pos) {
2428 TRACE_PARSER("ParseSuperFieldAccess"); 2415 TRACE_PARSER("ParseSuperFieldAccess");
2429 const Class& super_class = Class::ZoneHandle(Z, current_class().SuperClass()); 2416 const Class& super_class = Class::ZoneHandle(Z, current_class().SuperClass());
2430 if (super_class.IsNull()) { 2417 if (super_class.IsNull()) {
2431 ReportError("class '%s' does not have a superclass", 2418 ReportError("class '%s' does not have a superclass",
(...skipping 12206 matching lines...) Expand 10 before | Expand all | Expand 10 after
14638 const ArgumentListNode& function_args, 14625 const ArgumentListNode& function_args,
14639 const LocalVariable* temp_for_last_arg, 14626 const LocalVariable* temp_for_last_arg,
14640 bool is_super_invocation) { 14627 bool is_super_invocation) {
14641 UNREACHABLE(); 14628 UNREACHABLE();
14642 return NULL; 14629 return NULL;
14643 } 14630 }
14644 14631
14645 } // namespace dart 14632 } // namespace dart
14646 14633
14647 #endif // DART_PRECOMPILED_RUNTIME 14634 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698