| 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 | 7 import 'package:js_runtime/shared/embedded_names.dart' show |
| 8 JsBuiltin, | 8 JsBuiltin, |
| 9 METADATA, | 9 METADATA, |
| 10 TYPES; | 10 TYPES; |
| 11 | 11 |
| 12 import '../program_builder/program_builder.dart' show ProgramBuilder; | 12 import '../program_builder/program_builder.dart' show ProgramBuilder; |
| 13 import '../model.dart'; | 13 import '../model.dart'; |
| 14 import 'model_emitter.dart'; | 14 import 'model_emitter.dart'; |
| 15 import '../../common.dart'; | 15 import '../../common.dart'; |
| 16 import '../../elements/elements.dart' show FieldElement; | 16 import '../../elements/elements.dart' show FieldElement; |
| 17 import '../../js/js.dart' as js; | 17 import '../../js/js.dart' as js; |
| 18 | 18 |
| 19 import '../../js_backend/js_backend.dart' show | 19 import '../../js_backend/js_backend.dart' show |
| 20 JavaScriptBackend, | 20 JavaScriptBackend, |
| 21 Namer; | 21 Namer; |
| 22 | 22 |
| 23 import '../js_emitter.dart' show | 23 import '../js_emitter.dart' show |
| 24 NativeEmitter; | 24 NativeEmitter; |
| 25 | 25 |
| 26 import '../js_emitter.dart' as emitterTask show | 26 import '../js_emitter.dart' as emitterTask show |
| 27 Emitter; | 27 Emitter; |
| 28 | 28 |
| 29 import '../../diagnostics/diagnostic_listener.dart' show |
| 30 DiagnosticReporter; |
| 31 |
| 29 import '../../diagnostics/spannable.dart' show | 32 import '../../diagnostics/spannable.dart' show |
| 30 NO_LOCATION_SPANNABLE; | 33 NO_LOCATION_SPANNABLE; |
| 31 | 34 |
| 32 class Emitter implements emitterTask.Emitter { | 35 class Emitter implements emitterTask.Emitter { |
| 33 final Compiler _compiler; | 36 final Compiler _compiler; |
| 34 final Namer namer; | 37 final Namer namer; |
| 35 final ModelEmitter _emitter; | 38 final ModelEmitter _emitter; |
| 36 | 39 |
| 37 JavaScriptBackend get _backend => _compiler.backend; | 40 JavaScriptBackend get _backend => _compiler.backend; |
| 38 | 41 |
| 39 Emitter(Compiler compiler, Namer namer, NativeEmitter nativeEmitter) | 42 Emitter(Compiler compiler, Namer namer, NativeEmitter nativeEmitter) |
| 40 : this._compiler = compiler, | 43 : this._compiler = compiler, |
| 41 this.namer = namer, | 44 this.namer = namer, |
| 42 _emitter = new ModelEmitter(compiler, namer, nativeEmitter); | 45 _emitter = new ModelEmitter(compiler, namer, nativeEmitter); |
| 43 | 46 |
| 47 DiagnosticReporter get reporter => _compiler.reporter; |
| 48 |
| 44 @override | 49 @override |
| 45 String get patchVersion => "lazy"; | 50 String get patchVersion => "lazy"; |
| 46 | 51 |
| 47 @override | 52 @override |
| 48 int emitProgram(ProgramBuilder programBuilder) { | 53 int emitProgram(ProgramBuilder programBuilder) { |
| 49 Program program = programBuilder.buildProgram(); | 54 Program program = programBuilder.buildProgram(); |
| 50 return _emitter.emitProgram(program); | 55 return _emitter.emitProgram(program); |
| 51 } | 56 } |
| 52 | 57 |
| 53 @override | 58 @override |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 case JsBuiltin.getMetadata: | 179 case JsBuiltin.getMetadata: |
| 175 return _emitter.templateForReadMetadata; | 180 return _emitter.templateForReadMetadata; |
| 176 | 181 |
| 177 case JsBuiltin.getType: | 182 case JsBuiltin.getType: |
| 178 return _emitter.templateForReadType; | 183 return _emitter.templateForReadType; |
| 179 | 184 |
| 180 case JsBuiltin.createDartClosureFromNameOfStaticFunction: | 185 case JsBuiltin.createDartClosureFromNameOfStaticFunction: |
| 181 throw new UnsupportedError('createDartClosureFromNameOfStaticFunction'); | 186 throw new UnsupportedError('createDartClosureFromNameOfStaticFunction'); |
| 182 | 187 |
| 183 default: | 188 default: |
| 184 _compiler.internalError(NO_LOCATION_SPANNABLE, | 189 reporter.internalError(NO_LOCATION_SPANNABLE, |
| 185 "Unhandled Builtin: $builtin"); | 190 "Unhandled Builtin: $builtin"); |
| 186 return null; | 191 return null; |
| 187 } | 192 } |
| 188 } | 193 } |
| 189 | 194 |
| 190 @override | 195 @override |
| 191 void invalidateCaches() { | 196 void invalidateCaches() { |
| 192 } | 197 } |
| 193 } | 198 } |
| OLD | NEW |