OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.startup_emitter; | 5 library dart2js.js_emitter.startup_emitter; |
6 | 6 |
7 import 'package:js_runtime/shared/embedded_names.dart' | 7 import 'package:js_runtime/shared/embedded_names.dart' |
8 show JsBuiltin, METADATA, STATIC_FUNCTION_NAME_TO_CLOSURE, TYPES; | 8 show JsBuiltin, METADATA, STATIC_FUNCTION_NAME_TO_CLOSURE, TYPES; |
9 | 9 |
10 import '../../common.dart'; | 10 import '../../common.dart'; |
11 import '../../compiler.dart' show Compiler; | 11 import '../../compiler.dart' show Compiler; |
12 import '../../constants/values.dart' show ConstantValue; | 12 import '../../constants/values.dart' show ConstantValue; |
13 import '../../deferred_load.dart' show OutputUnit; | 13 import '../../deferred_load.dart' show OutputUnit; |
14 import '../../elements/elements.dart' show ClassElement, MethodElement; | 14 import '../../elements/elements.dart' show ClassElement, 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 '../../world.dart' show ClosedWorld; | 18 import '../../world.dart' show ClosedWorld; |
19 import '../js_emitter.dart' show CodeEmitterTask, NativeEmitter; | 19 import '../js_emitter.dart' show CodeEmitterTask, NativeEmitter; |
20 import '../js_emitter.dart' as emitterTask show EmitterBase, EmitterFactory; | 20 import '../js_emitter.dart' as emitterTask show EmitterBase, EmitterFactory; |
21 import '../model.dart'; | 21 import '../model.dart'; |
22 import '../program_builder/program_builder.dart' show ProgramBuilder; | 22 import '../program_builder/program_builder.dart' show ProgramBuilder; |
| 23 import '../sorter.dart' show Sorter; |
23 import 'model_emitter.dart'; | 24 import 'model_emitter.dart'; |
24 | 25 |
25 class EmitterFactory implements emitterTask.EmitterFactory { | 26 class EmitterFactory implements emitterTask.EmitterFactory { |
26 final bool generateSourceMap; | 27 final bool generateSourceMap; |
27 | 28 |
28 EmitterFactory({this.generateSourceMap}); | 29 EmitterFactory({this.generateSourceMap}); |
29 | 30 |
30 @override | 31 @override |
31 bool get supportsReflection => false; | 32 bool get supportsReflection => false; |
32 | 33 |
33 @override | 34 @override |
34 Emitter createEmitter( | 35 Emitter createEmitter(CodeEmitterTask task, Namer namer, |
35 CodeEmitterTask task, Namer namer, ClosedWorld closedWorld) { | 36 ClosedWorld closedWorld, Sorter sorter) { |
36 return new Emitter(task.compiler, namer, task.nativeEmitter, closedWorld, | 37 return new Emitter(task.compiler, namer, task.nativeEmitter, closedWorld, |
37 task, generateSourceMap); | 38 task, generateSourceMap); |
38 } | 39 } |
39 } | 40 } |
40 | 41 |
41 class Emitter extends emitterTask.EmitterBase { | 42 class Emitter extends emitterTask.EmitterBase { |
42 final Compiler _compiler; | 43 final Compiler _compiler; |
43 final ClosedWorld _closedWorld; | 44 final ClosedWorld _closedWorld; |
44 final Namer namer; | 45 final Namer namer; |
45 final ModelEmitter _emitter; | 46 final ModelEmitter _emitter; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 } | 162 } |
162 } | 163 } |
163 | 164 |
164 @override | 165 @override |
165 int generatedSize(OutputUnit unit) { | 166 int generatedSize(OutputUnit unit) { |
166 Fragment key = _emitter.outputBuffers.keys | 167 Fragment key = _emitter.outputBuffers.keys |
167 .firstWhere((Fragment fragment) => fragment.outputUnit == unit); | 168 .firstWhere((Fragment fragment) => fragment.outputUnit == unit); |
168 return _emitter.outputBuffers[key].length; | 169 return _emitter.outputBuffers[key].length; |
169 } | 170 } |
170 } | 171 } |
OLD | NEW |