| 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 "elements/elements.dart"; | 7 import 'constants/expressions.dart'; |
| 8 import "dart2jslib.dart"; | 8 import 'dart2jslib.dart'; |
| 9 import "dart_types.dart"; | 9 import 'dart_types.dart'; |
| 10 import "js_backend/js_backend.dart" show JavaScriptBackend; | 10 import 'elements/elements.dart'; |
| 11 import "scanner/scannerlib.dart" show Token; | 11 import 'elements/modelx.dart' |
| 12 import "tree/tree.dart"; | |
| 13 import "util/util.dart"; | |
| 14 import "elements/modelx.dart" | |
| 15 show BaseFunctionElementX, | 12 show BaseFunctionElementX, |
| 16 ClassElementX, | 13 ClassElementX, |
| 17 ElementX, | 14 ElementX, |
| 18 LocalFunctionElementX; | 15 LocalFunctionElementX; |
| 19 import "elements/visitor.dart" show ElementVisitor; | 16 import 'elements/visitor.dart' show ElementVisitor; |
| 20 | 17 import 'js_backend/js_backend.dart' show JavaScriptBackend; |
| 18 import 'scanner/scannerlib.dart' show Token; |
| 19 import 'tree/tree.dart'; |
| 20 import 'util/util.dart'; |
| 21 import 'universe/universe.dart' show | 21 import 'universe/universe.dart' show |
| 22 Universe; | 22 Universe; |
| 23 | 23 |
| 24 class ClosureTask extends CompilerTask { | 24 class ClosureTask extends CompilerTask { |
| 25 Map<Node, ClosureClassMap> closureMappingCache; | 25 Map<Node, ClosureClassMap> closureMappingCache; |
| 26 ClosureTask(Compiler compiler) | 26 ClosureTask(Compiler compiler) |
| 27 : closureMappingCache = new Map<Node, ClosureClassMap>(), | 27 : closureMappingCache = new Map<Node, ClosureClassMap>(), |
| 28 super(compiler); | 28 super(compiler); |
| 29 | 29 |
| 30 String get name => "Closure Simplifier"; | 30 String get name => "Closure Simplifier"; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 String toString() => "ClosureFieldElement($name)"; | 144 String toString() => "ClosureFieldElement($name)"; |
| 145 | 145 |
| 146 accept(ElementVisitor visitor, arg) { | 146 accept(ElementVisitor visitor, arg) { |
| 147 return visitor.visitClosureFieldElement(this, arg); | 147 return visitor.visitClosureFieldElement(this, arg); |
| 148 } | 148 } |
| 149 | 149 |
| 150 Element get analyzableElement => closureClass.methodElement.analyzableElement; | 150 Element get analyzableElement => closureClass.methodElement.analyzableElement; |
| 151 | 151 |
| 152 @override | 152 @override |
| 153 List<FunctionElement> get nestedClosures => const <FunctionElement>[]; | 153 List<FunctionElement> get nestedClosures => const <FunctionElement>[]; |
| 154 |
| 155 @override |
| 156 ConstantExpression get constant => null; |
| 154 } | 157 } |
| 155 | 158 |
| 156 // TODO(ahe): These classes continuously cause problems. We need to find | 159 // TODO(ahe): These classes continuously cause problems. We need to find |
| 157 // a more general solution. | 160 // a more general solution. |
| 158 class ClosureClassElement extends ClassElementX { | 161 class ClosureClassElement extends ClassElementX { |
| 159 DartType rawType; | 162 DartType rawType; |
| 160 DartType thisType; | 163 DartType thisType; |
| 161 FunctionType callType; | 164 FunctionType callType; |
| 162 /// Node that corresponds to this closure, used for source position. | 165 /// Node that corresponds to this closure, used for source position. |
| 163 final FunctionExpression node; | 166 final FunctionExpression node; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 | 272 |
| 270 @override | 273 @override |
| 271 Node get node { | 274 Node get node { |
| 272 throw new UnsupportedError("BoxFieldElement.node"); | 275 throw new UnsupportedError("BoxFieldElement.node"); |
| 273 } | 276 } |
| 274 | 277 |
| 275 @override | 278 @override |
| 276 ResolvedAst get resolvedAst { | 279 ResolvedAst get resolvedAst { |
| 277 throw new UnsupportedError("BoxFieldElement.resolvedAst"); | 280 throw new UnsupportedError("BoxFieldElement.resolvedAst"); |
| 278 } | 281 } |
| 282 |
| 283 @override |
| 284 ConstantExpression get constant => null; |
| 279 } | 285 } |
| 280 | 286 |
| 281 /// A local variable used encode the direct (uncaptured) references to [this]. | 287 /// A local variable used encode the direct (uncaptured) references to [this]. |
| 282 class ThisLocal extends Local { | 288 class ThisLocal extends Local { |
| 283 final ExecutableElement executableContext; | 289 final ExecutableElement executableContext; |
| 284 | 290 |
| 285 ThisLocal(this.executableContext); | 291 ThisLocal(this.executableContext); |
| 286 | 292 |
| 287 String get name => 'this'; | 293 String get name => 'this'; |
| 288 | 294 |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 | 1099 |
| 1094 String get name => typeVariable.name; | 1100 String get name => typeVariable.name; |
| 1095 | 1101 |
| 1096 int get hashCode => typeVariable.hashCode; | 1102 int get hashCode => typeVariable.hashCode; |
| 1097 | 1103 |
| 1098 bool operator ==(other) { | 1104 bool operator ==(other) { |
| 1099 if (other is! TypeVariableLocal) return false; | 1105 if (other is! TypeVariableLocal) return false; |
| 1100 return typeVariable == other.typeVariable; | 1106 return typeVariable == other.typeVariable; |
| 1101 } | 1107 } |
| 1102 } | 1108 } |
| OLD | NEW |