| 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.lazy_emitter; | 5 library dart2js.js_emitter.lazy_emitter; |
| 6 | 6 |
| 7 import 'package:js_runtime/shared/embedded_names.dart' show JsBuiltin; | 7 import 'package:js_runtime/shared/embedded_names.dart' show JsBuiltin; |
| 8 | 8 |
| 9 import '../../common.dart'; | 9 import '../../common.dart'; |
| 10 import '../../compiler.dart' show Compiler; | 10 import '../../compiler.dart' show Compiler; |
| 11 import '../../constants/values.dart' show ConstantValue; | 11 import '../../constants/values.dart' show ConstantValue; |
| 12 import '../../deferred_load.dart' show OutputUnit; | 12 import '../../deferred_load.dart' show OutputUnit; |
| 13 import '../../elements/elements.dart' | 13 import '../../elements/elements.dart' |
| 14 show ClassElement, Element, FieldElement, MethodElement; | 14 show ClassElement, Element, FieldElement, MethodElement; |
| 15 import '../../elements/entities.dart'; | 15 import '../../elements/entities.dart'; |
| 16 import '../../js/js.dart' as js; | 16 import '../../js/js.dart' as js; |
| 17 import '../../js_backend/js_backend.dart' show JavaScriptBackend, Namer; | 17 import '../../js_backend/js_backend.dart' show JavaScriptBackend, Namer; |
| 18 import '../../js_backend/interceptor_data.dart' show InterceptorData; | |
| 19 import '../../world.dart' show ClosedWorld; | 18 import '../../world.dart' show ClosedWorld; |
| 20 import '../js_emitter.dart' show CodeEmitterTask, NativeEmitter; | 19 import '../js_emitter.dart' show CodeEmitterTask, NativeEmitter; |
| 21 import '../js_emitter.dart' as emitterTask show Emitter, EmitterFactory; | 20 import '../js_emitter.dart' as emitterTask show Emitter, EmitterFactory; |
| 22 import '../model.dart'; | 21 import '../model.dart'; |
| 23 import '../program_builder/program_builder.dart' show ProgramBuilder; | 22 import '../program_builder/program_builder.dart' show ProgramBuilder; |
| 24 import 'model_emitter.dart'; | 23 import 'model_emitter.dart'; |
| 25 | 24 |
| 26 class EmitterFactory implements emitterTask.EmitterFactory { | 25 class EmitterFactory implements emitterTask.EmitterFactory { |
| 27 @override | 26 @override |
| 28 bool get supportsReflection => false; | 27 bool get supportsReflection => false; |
| 29 | 28 |
| 30 @override | 29 @override |
| 31 Emitter createEmitter( | 30 Emitter createEmitter( |
| 32 CodeEmitterTask task, Namer namer, ClosedWorld closedWorld) { | 31 CodeEmitterTask task, Namer namer, ClosedWorld closedWorld) { |
| 33 return new Emitter( | 32 return new Emitter( |
| 34 task.compiler, namer, task.nativeEmitter, closedWorld.interceptorData); | 33 task.compiler, namer, task.nativeEmitter, closedWorld, task); |
| 35 } | 34 } |
| 36 } | 35 } |
| 37 | 36 |
| 38 class Emitter implements emitterTask.Emitter { | 37 class Emitter implements emitterTask.Emitter { |
| 39 final Compiler _compiler; | 38 final Compiler _compiler; |
| 40 final Namer namer; | 39 final Namer namer; |
| 41 final ModelEmitter _emitter; | 40 final ModelEmitter _emitter; |
| 42 | 41 |
| 43 JavaScriptBackend get _backend => _compiler.backend; | 42 JavaScriptBackend get _backend => _compiler.backend; |
| 44 | 43 |
| 45 Emitter(Compiler compiler, Namer namer, NativeEmitter nativeEmitter, | 44 Emitter(Compiler compiler, Namer namer, NativeEmitter nativeEmitter, |
| 46 InterceptorData interceptorData) | 45 ClosedWorld closedWorld, CodeEmitterTask task) |
| 47 : this._compiler = compiler, | 46 : this._compiler = compiler, |
| 48 this.namer = namer, | 47 this.namer = namer, |
| 49 _emitter = | 48 _emitter = |
| 50 new ModelEmitter(compiler, namer, nativeEmitter, interceptorData); | 49 new ModelEmitter(compiler, namer, nativeEmitter, closedWorld, task); |
| 51 | 50 |
| 52 DiagnosticReporter get reporter => _compiler.reporter; | 51 DiagnosticReporter get reporter => _compiler.reporter; |
| 53 | 52 |
| 54 @override | 53 @override |
| 55 int emitProgram(ProgramBuilder programBuilder) { | 54 int emitProgram(ProgramBuilder programBuilder) { |
| 56 Program program = programBuilder.buildProgram(); | 55 Program program = programBuilder.buildProgram(); |
| 57 return _emitter.emitProgram(program); | 56 return _emitter.emitProgram(program); |
| 58 } | 57 } |
| 59 | 58 |
| 60 // TODO(floitsch): copied from full emitter. Adjust or share. | 59 // TODO(floitsch): copied from full emitter. Adjust or share. |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 reporter.internalError( | 186 reporter.internalError( |
| 188 NO_LOCATION_SPANNABLE, "Unhandled Builtin: $builtin"); | 187 NO_LOCATION_SPANNABLE, "Unhandled Builtin: $builtin"); |
| 189 return null; | 188 return null; |
| 190 } | 189 } |
| 191 } | 190 } |
| 192 | 191 |
| 193 @override | 192 @override |
| 194 // TODO(het): Generate this correctly | 193 // TODO(het): Generate this correctly |
| 195 int generatedSize(OutputUnit unit) => 0; | 194 int generatedSize(OutputUnit unit) => 0; |
| 196 } | 195 } |
| OLD | NEW |