| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 part of dart2js.js_emitter; | 5 part of dart2js.js_emitter; |
| 6 | 6 |
| 7 | 7 |
| 8 class OldEmitter implements Emitter { | 8 class OldEmitter implements Emitter { |
| 9 final Compiler compiler; | 9 final Compiler compiler; |
| 10 final CodeEmitterTask task; | 10 final CodeEmitterTask task; |
| (...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1254 } | 1254 } |
| 1255 }''', | 1255 }''', |
| 1256 {"constructorName": constructorName, | 1256 {"constructorName": constructorName, |
| 1257 "constructorNameString": js.string(constructorName), | 1257 "constructorNameString": js.string(constructorName), |
| 1258 "hasIsolateSupport": hasIsolateSupport, | 1258 "hasIsolateSupport": hasIsolateSupport, |
| 1259 "fieldNamesArray": fieldNamesArray})); | 1259 "fieldNamesArray": fieldNamesArray})); |
| 1260 | 1260 |
| 1261 cspPrecompiledConstructorNamesFor(outputUnit).add(js('#', constructorName)); | 1261 cspPrecompiledConstructorNamesFor(outputUnit).add(js('#', constructorName)); |
| 1262 } | 1262 } |
| 1263 | 1263 |
| 1264 void emitLibraries(Iterable<LibraryElement> libraries) { | |
| 1265 if (libraries.isEmpty) return; | |
| 1266 | |
| 1267 // TODO(karlklose): document what kinds of fields this loop adds to the | |
| 1268 // library class builder. | |
| 1269 for (LibraryElement element in libraries) { | |
| 1270 LibraryElement library = element; | |
| 1271 ClassBuilder builder = new ClassBuilder(library, namer); | |
| 1272 if (classEmitter.emitFields(library, builder, emitStatics: true)) { | |
| 1273 jsAst.ObjectInitializer initializer = builder.toObjectInitializer(); | |
| 1274 compiler.dumpInfoTask.registerElementAst(builder.element, initializer); | |
| 1275 getElementDescriptor(library).properties.addAll(initializer.properties); | |
| 1276 } | |
| 1277 } | |
| 1278 } | |
| 1279 | |
| 1280 void emitTypedefs() { | 1264 void emitTypedefs() { |
| 1281 OutputUnit mainOutputUnit = compiler.deferredLoadTask.mainOutputUnit; | 1265 OutputUnit mainOutputUnit = compiler.deferredLoadTask.mainOutputUnit; |
| 1282 | 1266 |
| 1283 // Emit all required typedef declarations into the main output unit. | 1267 // Emit all required typedef declarations into the main output unit. |
| 1284 // TODO(karlklose): unify required classes and typedefs to declarations | 1268 // TODO(karlklose): unify required classes and typedefs to declarations |
| 1285 // and have builders for each kind. | 1269 // and have builders for each kind. |
| 1286 for (TypedefElement typedef in typedefsNeededForReflection) { | 1270 for (TypedefElement typedef in typedefsNeededForReflection) { |
| 1287 LibraryElement library = typedef.library; | 1271 LibraryElement library = typedef.library; |
| 1288 // TODO(karlklose): add a TypedefBuilder and move this code there. | 1272 // TODO(karlklose): add a TypedefBuilder and move this code there. |
| 1289 DartType type = typedef.alias; | 1273 DartType type = typedef.alias; |
| (...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2104 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { | 2088 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { |
| 2105 if (element.isInstanceMember) { | 2089 if (element.isInstanceMember) { |
| 2106 cachedClassBuilders.remove(element.enclosingClass); | 2090 cachedClassBuilders.remove(element.enclosingClass); |
| 2107 | 2091 |
| 2108 nativeEmitter.cachedBuilders.remove(element.enclosingClass); | 2092 nativeEmitter.cachedBuilders.remove(element.enclosingClass); |
| 2109 | 2093 |
| 2110 } | 2094 } |
| 2111 } | 2095 } |
| 2112 } | 2096 } |
| 2113 } | 2097 } |
| OLD | NEW |