| 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 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1036 void emitTypedefs() { | 1036 void emitTypedefs() { |
| 1037 OutputUnit mainOutputUnit = compiler.deferredLoadTask.mainOutputUnit; | 1037 OutputUnit mainOutputUnit = compiler.deferredLoadTask.mainOutputUnit; |
| 1038 | 1038 |
| 1039 // Emit all required typedef declarations into the main output unit. | 1039 // Emit all required typedef declarations into the main output unit. |
| 1040 // TODO(karlklose): unify required classes and typedefs to declarations | 1040 // TODO(karlklose): unify required classes and typedefs to declarations |
| 1041 // and have builders for each kind. | 1041 // and have builders for each kind. |
| 1042 for (TypedefElement typedef in typedefsNeededForReflection) { | 1042 for (TypedefElement typedef in typedefsNeededForReflection) { |
| 1043 LibraryElement library = typedef.library; | 1043 LibraryElement library = typedef.library; |
| 1044 // TODO(karlklose): add a TypedefBuilder and move this code there. | 1044 // TODO(karlklose): add a TypedefBuilder and move this code there. |
| 1045 DartType type = typedef.alias; | 1045 DartType type = typedef.alias; |
| 1046 int typeIndex = task.metadataCollector.reifyType(type); | 1046 // TODO(zarah): reify type variables once reflection on type arguments of |
| 1047 // typedefs is supported. |
| 1048 int typeIndex = |
| 1049 task.metadataCollector.reifyType(type, ignoreTypeVariables: true); |
| 1047 ClassBuilder builder = new ClassBuilder(typedef, namer); | 1050 ClassBuilder builder = new ClassBuilder(typedef, namer); |
| 1048 builder.addProperty(embeddedNames.TYPEDEF_TYPE_PROPERTY_NAME, | 1051 builder.addProperty(embeddedNames.TYPEDEF_TYPE_PROPERTY_NAME, |
| 1049 js.number(typeIndex)); | 1052 js.number(typeIndex)); |
| 1050 builder.addProperty(embeddedNames.TYPEDEF_PREDICATE_PROPERTY_NAME, | 1053 builder.addProperty(embeddedNames.TYPEDEF_PREDICATE_PROPERTY_NAME, |
| 1051 js.boolean(true)); | 1054 js.boolean(true)); |
| 1052 | 1055 |
| 1053 // We can be pretty sure that the objectClass is initialized, since | 1056 // We can be pretty sure that the objectClass is initialized, since |
| 1054 // typedefs are only emitted with reflection, which requires lots of | 1057 // typedefs are only emitted with reflection, which requires lots of |
| 1055 // classes. | 1058 // classes. |
| 1056 assert(compiler.objectClass != null); | 1059 assert(compiler.objectClass != null); |
| (...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1876 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { | 1879 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { |
| 1877 if (element.isInstanceMember) { | 1880 if (element.isInstanceMember) { |
| 1878 cachedClassBuilders.remove(element.enclosingClass); | 1881 cachedClassBuilders.remove(element.enclosingClass); |
| 1879 | 1882 |
| 1880 nativeEmitter.cachedBuilders.remove(element.enclosingClass); | 1883 nativeEmitter.cachedBuilders.remove(element.enclosingClass); |
| 1881 | 1884 |
| 1882 } | 1885 } |
| 1883 } | 1886 } |
| 1884 } | 1887 } |
| 1885 } | 1888 } |
| OLD | NEW |