| 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 library dart2js.js_emitter.full_emitter; | 5 library dart2js.js_emitter.full_emitter; |
| 6 | 6 |
| 7 import 'dart:collection' show HashMap; | 7 import 'dart:collection' show HashMap; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 | 9 |
| 10 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; | 10 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; |
| 11 import 'package:js_runtime/shared/embedded_names.dart' | 11 import 'package:js_runtime/shared/embedded_names.dart' |
| 12 show JsBuiltin, JsGetName; | 12 show JsBuiltin, JsGetName; |
| 13 | 13 |
| 14 import '../../common.dart'; | 14 import '../../common.dart'; |
| 15 import '../../common/names.dart' show Names; | 15 import '../../common/names.dart' show Names; |
| 16 import '../../compiler.dart' show Compiler; | 16 import '../../compiler.dart' show Compiler; |
| 17 import '../../constants/values.dart'; | 17 import '../../constants/values.dart'; |
| 18 import '../../core_types.dart' show CommonElements; | 18 import '../../core_types.dart' show CommonElements; |
| 19 import '../../elements/resolution_types.dart' show DartType; | 19 import '../../elements/resolution_types.dart' show ResolutionDartType; |
| 20 import '../../deferred_load.dart' show OutputUnit; | 20 import '../../deferred_load.dart' show OutputUnit; |
| 21 import '../../elements/elements.dart' | 21 import '../../elements/elements.dart' |
| 22 show | 22 show |
| 23 ClassElement, | 23 ClassElement, |
| 24 Element, | 24 Element, |
| 25 Elements, | 25 Elements, |
| 26 FieldElement, | 26 FieldElement, |
| 27 FunctionElement, | 27 FunctionElement, |
| 28 FunctionSignature, | 28 FunctionSignature, |
| 29 LibraryElement, | 29 LibraryElement, |
| (...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 void assembleTypedefs(Program program) { | 1216 void assembleTypedefs(Program program) { |
| 1217 Fragment mainFragment = program.mainFragment; | 1217 Fragment mainFragment = program.mainFragment; |
| 1218 OutputUnit mainOutputUnit = mainFragment.outputUnit; | 1218 OutputUnit mainOutputUnit = mainFragment.outputUnit; |
| 1219 | 1219 |
| 1220 // Emit all required typedef declarations into the main output unit. | 1220 // Emit all required typedef declarations into the main output unit. |
| 1221 // TODO(karlklose): unify required classes and typedefs to declarations | 1221 // TODO(karlklose): unify required classes and typedefs to declarations |
| 1222 // and have builders for each kind. | 1222 // and have builders for each kind. |
| 1223 for (TypedefElement typedef in typedefsNeededForReflection) { | 1223 for (TypedefElement typedef in typedefsNeededForReflection) { |
| 1224 LibraryElement library = typedef.library; | 1224 LibraryElement library = typedef.library; |
| 1225 // TODO(karlklose): add a TypedefBuilder and move this code there. | 1225 // TODO(karlklose): add a TypedefBuilder and move this code there. |
| 1226 DartType type = typedef.alias; | 1226 ResolutionDartType type = typedef.alias; |
| 1227 // TODO(zarah): reify type variables once reflection on type arguments of | 1227 // TODO(zarah): reify type variables once reflection on type arguments of |
| 1228 // typedefs is supported. | 1228 // typedefs is supported. |
| 1229 jsAst.Expression typeIndex = | 1229 jsAst.Expression typeIndex = |
| 1230 task.metadataCollector.reifyType(type, ignoreTypeVariables: true); | 1230 task.metadataCollector.reifyType(type, ignoreTypeVariables: true); |
| 1231 ClassBuilder builder = new ClassBuilder.forStatics(typedef, namer); | 1231 ClassBuilder builder = new ClassBuilder.forStatics(typedef, namer); |
| 1232 builder.addPropertyByName( | 1232 builder.addPropertyByName( |
| 1233 embeddedNames.TYPEDEF_TYPE_PROPERTY_NAME, typeIndex); | 1233 embeddedNames.TYPEDEF_TYPE_PROPERTY_NAME, typeIndex); |
| 1234 builder.addPropertyByName( | 1234 builder.addPropertyByName( |
| 1235 embeddedNames.TYPEDEF_PREDICATE_PROPERTY_NAME, js.boolean(true)); | 1235 embeddedNames.TYPEDEF_PREDICATE_PROPERTY_NAME, js.boolean(true)); |
| 1236 | 1236 |
| (...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2179 if (cachedElements.isEmpty) return; | 2179 if (cachedElements.isEmpty) return; |
| 2180 for (Element element in backend.codegenEnqueuer.newlyEnqueuedElements) { | 2180 for (Element element in backend.codegenEnqueuer.newlyEnqueuedElements) { |
| 2181 if (element.isInstanceMember) { | 2181 if (element.isInstanceMember) { |
| 2182 cachedClassBuilders.remove(element.enclosingClass); | 2182 cachedClassBuilders.remove(element.enclosingClass); |
| 2183 | 2183 |
| 2184 nativeEmitter.cachedBuilders.remove(element.enclosingClass); | 2184 nativeEmitter.cachedBuilders.remove(element.enclosingClass); |
| 2185 } | 2185 } |
| 2186 } | 2186 } |
| 2187 } | 2187 } |
| 2188 } | 2188 } |
| OLD | NEW |