| 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.info; | 5 library kernel.transformations.closure.info; |
| 6 | 6 |
| 7 import '../../ast.dart' | 7 import '../../ast.dart' |
| 8 show | 8 show |
| 9 Class, | 9 Class, |
| 10 Constructor, | 10 Constructor, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 FunctionNode currentMemberFunction; | 58 FunctionNode currentMemberFunction; |
| 59 | 59 |
| 60 bool get isOuterMostContext { | 60 bool get isOuterMostContext { |
| 61 return currentFunction == null || currentMemberFunction == currentFunction; | 61 return currentFunction == null || currentMemberFunction == currentFunction; |
| 62 } | 62 } |
| 63 | 63 |
| 64 /// Maps the names of all instance methods that may be torn off (aka | 64 /// Maps the names of all instance methods that may be torn off (aka |
| 65 /// implicitly closurized) to `${name.name}#get`. | 65 /// implicitly closurized) to `${name.name}#get`. |
| 66 Map<Name, Name> get tearOffGetterNames { | 66 Map<Name, Name> get tearOffGetterNames { |
| 67 Map<Name, Name> result = <Name, Name>{}; | 67 // TODO(dmitryas): Add support for tear-offs. When added, uncomment this. |
| 68 for (Name name in declaredInstanceMethodNames) { | 68 // |
| 69 if (invokedGetters.contains(name)) { | 69 // Map<Name, Name> result = <Name, Name>{}; |
| 70 result[name] = new Name("${name.name}#get", name.library); | 70 // for (Name name in declaredInstanceMethodNames) { |
| 71 } | 71 // if (invokedGetters.contains(name)) { |
| 72 } | 72 // result[name] = new Name("${name.name}#get", name.library); |
| 73 return result; | 73 // } |
| 74 // } |
| 75 // return result; |
| 76 // |
| 77 // Currently an empty map is returned, so no tear-offs supporting functions |
| 78 // and getters are generated, and no property-get targets are renamed. |
| 79 return <Name, Name>{}; |
| 74 } | 80 } |
| 75 | 81 |
| 76 void beginMember(Member member, [FunctionNode function]) { | 82 void beginMember(Member member, [FunctionNode function]) { |
| 77 currentMemberLocalNames.clear(); | 83 currentMemberLocalNames.clear(); |
| 78 if (function != null) { | 84 if (function != null) { |
| 79 localNames[function] = computeUniqueLocalName(member.name.name); | 85 localNames[function] = computeUniqueLocalName(member.name.name); |
| 80 } | 86 } |
| 81 currentMember = member; | 87 currentMember = member; |
| 82 currentMemberFunction = function; | 88 currentMemberFunction = function; |
| 83 } | 89 } |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 thisAccess.putIfAbsent( | 203 thisAccess.putIfAbsent( |
| 198 currentMemberFunction, () => new VariableDeclaration("#self")); | 204 currentMemberFunction, () => new VariableDeclaration("#self")); |
| 199 } | 205 } |
| 200 } | 206 } |
| 201 | 207 |
| 202 visitPropertyGet(PropertyGet node) { | 208 visitPropertyGet(PropertyGet node) { |
| 203 invokedGetters.add(node.name); | 209 invokedGetters.add(node.name); |
| 204 super.visitPropertyGet(node); | 210 super.visitPropertyGet(node); |
| 205 } | 211 } |
| 206 } | 212 } |
| OLD | NEW |