| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 closureToClassMapper; | 5 library closureToClassMapper; |
| 6 | 6 |
| 7 import 'common/names.dart' show Identifiers; | 7 import 'common/names.dart' show Identifiers; |
| 8 import 'common/resolution.dart' show ParsingContext, Resolution; | 8 import 'common/resolution.dart' show ParsingContext, Resolution; |
| 9 import 'common/tasks.dart' show CompilerTask; | 9 import 'common/tasks.dart' show CompilerTask; |
| 10 import 'common.dart'; | 10 import 'common.dart'; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 _closureMappingCache[element] = | 108 _closureMappingCache[element] = |
| 109 new ClosureClassMap(null, null, null, new ThisLocal(element)); | 109 new ClosureClassMap(null, null, null, new ThisLocal(element)); |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 assert(invariant(element, _closureMappingCache[element] != null, | 112 assert(invariant(element, _closureMappingCache[element] != null, |
| 113 message: "No ClosureClassMap computed for ${element}.")); | 113 message: "No ClosureClassMap computed for ${element}.")); |
| 114 return _closureMappingCache[element]; | 114 return _closureMappingCache[element]; |
| 115 }); | 115 }); |
| 116 }); | 116 }); |
| 117 } | 117 } |
| 118 | |
| 119 void forgetElement(var closure) { | |
| 120 ClosureClassElement cls; | |
| 121 if (closure is ClosureFieldElement) { | |
| 122 cls = closure.closureClass; | |
| 123 } else if (closure is SynthesizedCallMethodElementX) { | |
| 124 cls = closure.closureClass; | |
| 125 } else { | |
| 126 throw new SpannableAssertionFailure( | |
| 127 closure, 'Not a closure: $closure (${closure.runtimeType}).'); | |
| 128 } | |
| 129 compiler.enqueuer.codegen.forgetEntity(cls, compiler); | |
| 130 } | |
| 131 } | 118 } |
| 132 | 119 |
| 133 /// Common interface for [BoxFieldElement] and [ClosureFieldElement] as | 120 /// Common interface for [BoxFieldElement] and [ClosureFieldElement] as |
| 134 /// non-elements. | 121 /// non-elements. |
| 135 // TODO(johnniwinther): Remove `implements Element`. | 122 // TODO(johnniwinther): Remove `implements Element`. |
| 136 abstract class CapturedVariable implements Element {} | 123 abstract class CapturedVariable implements Element {} |
| 137 | 124 |
| 138 // TODO(ahe): These classes continuously cause problems. We need to | 125 // TODO(ahe): These classes continuously cause problems. We need to |
| 139 // find a more general solution. | 126 // find a more general solution. |
| 140 class ClosureFieldElement extends ElementX | 127 class ClosureFieldElement extends ElementX |
| (...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1225 /// | 1212 /// |
| 1226 /// Move the below classes to a JS model eventually. | 1213 /// Move the below classes to a JS model eventually. |
| 1227 /// | 1214 /// |
| 1228 abstract class JSEntity implements Entity { | 1215 abstract class JSEntity implements Entity { |
| 1229 Entity get declaredEntity; | 1216 Entity get declaredEntity; |
| 1230 } | 1217 } |
| 1231 | 1218 |
| 1232 abstract class PrivatelyNamedJSEntity implements JSEntity { | 1219 abstract class PrivatelyNamedJSEntity implements JSEntity { |
| 1233 Entity get rootOfScope; | 1220 Entity get rootOfScope; |
| 1234 } | 1221 } |
| OLD | NEW |