OLD | NEW |
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 Loading... |
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 addGetterForwarder(oldName, node); | 420 addGetterForwarder(oldName, node); |
420 } else if (node.kind == ProcedureKind.Method) { | 421 } else if (node.kind == ProcedureKind.Method) { |
421 addTearOffMethod(tearOffName, node); | 422 addTearOffMethod(tearOffName, node); |
422 } | 423 } |
423 } | 424 } |
424 } | 425 } |
425 | 426 |
426 FunctionNode function = node.function; | 427 FunctionNode function = node.function; |
427 if (function.body != null) { | 428 if (function.body != null) { |
428 setupContextForFunctionBody(function); | 429 setupContextForFunctionBody(function); |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 newClassMembers.add(tearOffMethod); | 878 newClassMembers.add(tearOffMethod); |
878 | 879 |
879 resetContext(); | 880 resetContext(); |
880 }); | 881 }); |
881 } finally { | 882 } finally { |
882 currentMember = oldCurrentMember; | 883 currentMember = oldCurrentMember; |
883 currentMemberFunction = oldCurrentMemberFunction; | 884 currentMemberFunction = oldCurrentMemberFunction; |
884 } | 885 } |
885 } | 886 } |
886 } | 887 } |
OLD | NEW |