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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 this.node, String name, Compiler compiler, LocalFunctionElement closure) | 216 this.node, String name, Compiler compiler, LocalFunctionElement closure) |
217 : this.methodElement = closure, | 217 : this.methodElement = closure, |
218 super( | 218 super( |
219 name, | 219 name, |
220 closure.compilationUnit, | 220 closure.compilationUnit, |
221 // By assigning a fresh class-id we make sure that the hashcode | 221 // By assigning a fresh class-id we make sure that the hashcode |
222 // is unique, but also emit closure classes after all other | 222 // is unique, but also emit closure classes after all other |
223 // classes (since the emitter sorts classes by their id). | 223 // classes (since the emitter sorts classes by their id). |
224 compiler.idGenerator.getNextFreeId(), | 224 compiler.idGenerator.getNextFreeId(), |
225 STATE_DONE) { | 225 STATE_DONE) { |
226 JavaScriptBackend backend = compiler.backend; | |
227 ClassElement superclass = methodElement.isInstanceMember | 226 ClassElement superclass = methodElement.isInstanceMember |
228 ? backend.helpers.boundClosureClass | 227 ? compiler.commonElements.boundClosureClass |
229 : backend.helpers.closureClass; | 228 : compiler.commonElements.closureClass; |
230 superclass.ensureResolved(compiler.resolution); | 229 superclass.ensureResolved(compiler.resolution); |
231 supertype = superclass.thisType; | 230 supertype = superclass.thisType; |
232 interfaces = const Link<ResolutionDartType>(); | 231 interfaces = const Link<ResolutionDartType>(); |
233 thisType = rawType = new ResolutionInterfaceType(this); | 232 thisType = rawType = new ResolutionInterfaceType(this); |
234 allSupertypesAndSelf = | 233 allSupertypesAndSelf = |
235 superclass.allSupertypesAndSelf.extendClass(thisType); | 234 superclass.allSupertypesAndSelf.extendClass(thisType); |
236 callType = methodElement.type; | 235 callType = methodElement.type; |
237 } | 236 } |
238 | 237 |
239 Iterable<ClosureFieldElement> get closureFields => _closureFields; | 238 Iterable<ClosureFieldElement> get closureFields => _closureFields; |
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1225 /// | 1224 /// |
1226 /// Move the below classes to a JS model eventually. | 1225 /// Move the below classes to a JS model eventually. |
1227 /// | 1226 /// |
1228 abstract class JSEntity implements Entity { | 1227 abstract class JSEntity implements Entity { |
1229 Entity get declaredEntity; | 1228 Entity get declaredEntity; |
1230 } | 1229 } |
1231 | 1230 |
1232 abstract class PrivatelyNamedJSEntity implements JSEntity { | 1231 abstract class PrivatelyNamedJSEntity implements JSEntity { |
1233 Entity get rootOfScope; | 1232 Entity get rootOfScope; |
1234 } | 1233 } |
OLD | NEW |