| 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'; |
| 11 import 'compiler.dart' show Compiler; | 11 import 'compiler.dart' show Compiler; |
| 12 import 'constants/expressions.dart'; | 12 import 'constants/expressions.dart'; |
| 13 import 'dart_types.dart'; | 13 import 'dart_types.dart'; |
| 14 import 'elements/elements.dart'; | 14 import 'elements/elements.dart'; |
| 15 import 'elements/modelx.dart' | 15 import 'elements/modelx.dart' |
| 16 show BaseFunctionElementX, ClassElementX, ElementX; | 16 show BaseFunctionElementX, ClassElementX, ElementX; |
| 17 import 'elements/visitor.dart' show ElementVisitor; | 17 import 'elements/visitor.dart' show ElementVisitor; |
| 18 import 'js_backend/js_backend.dart' show JavaScriptBackend; | 18 import 'js_backend/js_backend.dart' show JavaScriptBackend; |
| 19 import 'resolution/tree_elements.dart' show TreeElements; | 19 import 'resolution/tree_elements.dart' show TreeElements; |
| 20 import 'tokens/token.dart' show Token; | 20 import 'tokens/token.dart' show Token; |
| 21 import 'tree/tree.dart'; | 21 import 'tree/tree.dart'; |
| 22 import 'universe/world_builder.dart' show CodegenWorldBuilder; | |
| 23 import 'util/util.dart'; | 22 import 'util/util.dart'; |
| 24 | 23 |
| 25 class ClosureTask extends CompilerTask { | 24 class ClosureTask extends CompilerTask { |
| 26 Map<Element, ClosureClassMap> _closureMappingCache = | 25 Map<Element, ClosureClassMap> _closureMappingCache = |
| 27 <Element, ClosureClassMap>{}; | 26 <Element, ClosureClassMap>{}; |
| 28 Compiler compiler; | 27 Compiler compiler; |
| 29 ClosureTask(Compiler compiler) | 28 ClosureTask(Compiler compiler) |
| 30 : compiler = compiler, | 29 : compiler = compiler, |
| 31 super(compiler.measurer); | 30 super(compiler.measurer); |
| 32 | 31 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 void forgetElement(var closure) { | 114 void forgetElement(var closure) { |
| 116 ClosureClassElement cls; | 115 ClosureClassElement cls; |
| 117 if (closure is ClosureFieldElement) { | 116 if (closure is ClosureFieldElement) { |
| 118 cls = closure.closureClass; | 117 cls = closure.closureClass; |
| 119 } else if (closure is SynthesizedCallMethodElementX) { | 118 } else if (closure is SynthesizedCallMethodElementX) { |
| 120 cls = closure.closureClass; | 119 cls = closure.closureClass; |
| 121 } else { | 120 } else { |
| 122 throw new SpannableAssertionFailure( | 121 throw new SpannableAssertionFailure( |
| 123 closure, 'Not a closure: $closure (${closure.runtimeType}).'); | 122 closure, 'Not a closure: $closure (${closure.runtimeType}).'); |
| 124 } | 123 } |
| 125 compiler.enqueuer.codegen.forgetElement(cls); | 124 compiler.enqueuer.codegen.forgetElement(cls, compiler); |
| 126 } | 125 } |
| 127 } | 126 } |
| 128 | 127 |
| 129 /// Common interface for [BoxFieldElement] and [ClosureFieldElement] as | 128 /// Common interface for [BoxFieldElement] and [ClosureFieldElement] as |
| 130 /// non-elements. | 129 /// non-elements. |
| 131 // TODO(johnniwinther): Remove `implements Element`. | 130 // TODO(johnniwinther): Remove `implements Element`. |
| 132 abstract class CapturedVariable implements Element {} | 131 abstract class CapturedVariable implements Element {} |
| 133 | 132 |
| 134 // TODO(ahe): These classes continuously cause problems. We need to | 133 // TODO(ahe): These classes continuously cause problems. We need to |
| 135 // find a more general solution. | 134 // find a more general solution. |
| (...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 /// | 1208 /// |
| 1210 /// Move the below classes to a JS model eventually. | 1209 /// Move the below classes to a JS model eventually. |
| 1211 /// | 1210 /// |
| 1212 abstract class JSEntity implements Entity { | 1211 abstract class JSEntity implements Entity { |
| 1213 Entity get declaredEntity; | 1212 Entity get declaredEntity; |
| 1214 } | 1213 } |
| 1215 | 1214 |
| 1216 abstract class PrivatelyNamedJSEntity implements JSEntity { | 1215 abstract class PrivatelyNamedJSEntity implements JSEntity { |
| 1217 Entity get rootOfScope; | 1216 Entity get rootOfScope; |
| 1218 } | 1217 } |
| OLD | NEW |