Chromium Code Reviews| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 Class currentClass; | 55 Class currentClass; |
| 56 | 56 |
| 57 Member currentMember; | 57 Member currentMember; |
| 58 | 58 |
| 59 FunctionNode currentMemberFunction; | 59 FunctionNode currentMemberFunction; |
| 60 | 60 |
| 61 bool get isOuterMostContext { | 61 bool get isOuterMostContext { |
| 62 return currentFunction == null || currentMemberFunction == currentFunction; | 62 return currentFunction == null || currentMemberFunction == currentFunction; |
| 63 } | 63 } |
| 64 | 64 |
| 65 /// Maps the names of all instance methods that may be torn off (aka | |
| 66 /// implicitly closurized) to `${name.name}#get`. | |
| 67 Map<Name, Name> get tearOffGetterNames { | |
| 68 // TODO(dmitryas): Add support for tear-offs. When added, uncomment this. | |
| 69 // | |
| 70 // Map<Name, Name> result = <Name, Name>{}; | |
| 71 // for (Name name in declaredInstanceMethodNames) { | |
| 72 // if (invokedGetters.contains(name)) { | |
| 73 // result[name] = new Name("${name.name}#get", name.library); | |
| 74 // } | |
| 75 // } | |
| 76 // return result; | |
| 77 // | |
| 78 // Currently an empty map is returned, so no tear-offs supporting functions | |
| 79 // and getters are generated, and no property-get targets are renamed. | |
| 80 return <Name, Name>{}; | |
| 81 } | |
| 82 | |
|
Dmitry Stefantsov
2017/07/20 13:37:06
You probably may want to remove [invokedGetters] a
sjindel
2017/07/20 13:45:46
Done.
| |
| 83 void beginMember(Member member, [FunctionNode function]) { | 65 void beginMember(Member member, [FunctionNode function]) { |
| 84 currentMemberLocalNames.clear(); | 66 currentMemberLocalNames.clear(); |
| 85 if (function != null) { | 67 if (function != null) { |
| 86 localNames[function] = computeUniqueLocalName(member.name.name); | 68 localNames[function] = computeUniqueLocalName(member.name.name); |
| 87 } | 69 } |
| 88 currentMember = member; | 70 currentMember = member; |
| 89 currentMemberFunction = function; | 71 currentMemberFunction = function; |
| 90 } | 72 } |
| 91 | 73 |
| 92 void endMember() { | 74 void endMember() { |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 247 | 229 |
| 248 saveCurrentFunction(void f()) { | 230 saveCurrentFunction(void f()) { |
| 249 var saved = currentFunction; | 231 var saved = currentFunction; |
| 250 try { | 232 try { |
| 251 f(); | 233 f(); |
| 252 } finally { | 234 } finally { |
| 253 currentFunction = saved; | 235 currentFunction = saved; |
| 254 } | 236 } |
| 255 } | 237 } |
| 256 } | 238 } |
| OLD | NEW |