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

Side by Side Diff: pkg/kernel/lib/transformations/closure/converter.dart

Issue 2939043002: Remove unnecessary contexts in closure conversion (Closed)
Patch Set: Don't treat constructor parameters in initializers as captured Created 3 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 library kernel.transformations.closure.converter; 5 library kernel.transformations.closure.converter;
6 6
7 import '../../ast.dart' 7 import '../../ast.dart'
8 show 8 show
9 Arguments, 9 Arguments,
10 Block, 10 Block,
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 409
410 currentMember = node; 410 currentMember = node;
411 411
412 if (node.isInstanceMember) { 412 if (node.isInstanceMember) {
413 Name tearOffName = tearOffGetterNames[node.name]; 413 Name tearOffName = tearOffGetterNames[node.name];
414 if (tearOffName != null) { 414 if (tearOffName != null) {
415 if (node.isGetter) { 415 if (node.isGetter) {
416 // We rename the getter to avoid an indirection in most cases. 416 // We rename the getter to avoid an indirection in most cases.
417 Name oldName = node.name; 417 Name oldName = node.name;
418 node.name = tearOffName; 418 node.name = tearOffName;
419 node.reference.canonicalName.unbind(); 419 node.canonicalName?.unbind();
420 addGetterForwarder(oldName, node); 420 addGetterForwarder(oldName, node);
421 } else if (node.kind == ProcedureKind.Method) { 421 } else if (node.kind == ProcedureKind.Method) {
422 addTearOffMethod(tearOffName, node); 422 addTearOffMethod(tearOffName, node);
423 } 423 }
424 } 424 }
425 } 425 }
426 426
427 FunctionNode function = node.function; 427 FunctionNode function = node.function;
428 if (function.body != null) { 428 if (function.body != null) {
429 setupContextForFunctionBody(function); 429 setupContextForFunctionBody(function);
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 newClassMembers.add(tearOffMethod); 878 newClassMembers.add(tearOffMethod);
879 879
880 resetContext(); 880 resetContext();
881 }); 881 });
882 } finally { 882 } finally {
883 currentMember = oldCurrentMember; 883 currentMember = oldCurrentMember;
884 currentMemberFunction = oldCurrentMemberFunction; 884 currentMemberFunction = oldCurrentMemberFunction;
885 } 885 }
886 } 886 }
887 } 887 }
OLDNEW
« no previous file with comments | « no previous file | pkg/kernel/lib/transformations/closure/info.dart » ('j') | pkg/kernel/lib/transformations/closure/info.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698