| 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 | 407 |
| 408 currentMember = node; | 408 currentMember = node; |
| 409 | 409 |
| 410 if (node.isInstanceMember) { | 410 if (node.isInstanceMember) { |
| 411 Name tearOffName = tearOffGetterNames[node.name]; | 411 Name tearOffName = tearOffGetterNames[node.name]; |
| 412 if (tearOffName != null) { | 412 if (tearOffName != null) { |
| 413 if (node.isGetter) { | 413 if (node.isGetter) { |
| 414 // We rename the getter to avoid an indirection in most cases. | 414 // We rename the getter to avoid an indirection in most cases. |
| 415 Name oldName = node.name; | 415 Name oldName = node.name; |
| 416 node.name = tearOffName; | 416 node.name = tearOffName; |
| 417 node.reference.canonicalName.unbind(); | 417 node.canonicalName?.unbind(); |
| 418 addGetterForwarder(oldName, node); | 418 addGetterForwarder(oldName, node); |
| 419 } else if (node.kind == ProcedureKind.Method) { | 419 } else if (node.kind == ProcedureKind.Method) { |
| 420 addTearOffMethod(tearOffName, node); | 420 addTearOffMethod(tearOffName, node); |
| 421 } | 421 } |
| 422 } | 422 } |
| 423 } | 423 } |
| 424 | 424 |
| 425 FunctionNode function = node.function; | 425 FunctionNode function = node.function; |
| 426 if (function.body != null) { | 426 if (function.body != null) { |
| 427 setupContextForFunctionBody(function); | 427 setupContextForFunctionBody(function); |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 newClassMembers.add(tearOffMethod); | 876 newClassMembers.add(tearOffMethod); |
| 877 | 877 |
| 878 resetContext(); | 878 resetContext(); |
| 879 }); | 879 }); |
| 880 } finally { | 880 } finally { |
| 881 currentMember = oldCurrentMember; | 881 currentMember = oldCurrentMember; |
| 882 currentMemberFunction = oldCurrentMemberFunction; | 882 currentMemberFunction = oldCurrentMemberFunction; |
| 883 } | 883 } |
| 884 } | 884 } |
| 885 } | 885 } |
| OLD | NEW |