| 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'; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 EmitterFactory({this.generateSourceMap}); | 29 EmitterFactory({this.generateSourceMap}); |
| 30 | 30 |
| 31 @override | 31 @override |
| 32 bool get supportsReflection => false; | 32 bool get supportsReflection => false; |
| 33 | 33 |
| 34 @override | 34 @override |
| 35 Emitter createEmitter(CodeEmitterTask task, Namer namer, | 35 Emitter createEmitter(CodeEmitterTask task, Namer namer, |
| 36 ClosedWorld closedWorld, Sorter sorter) { | 36 ClosedWorld closedWorld, Sorter sorter) { |
| 37 return new Emitter(task.compiler, namer, task.nativeEmitter, closedWorld, | 37 return new Emitter(task.compiler, namer, task.nativeEmitter, closedWorld, |
| 38 task, generateSourceMap); | 38 sorter, task, generateSourceMap); |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 | 41 |
| 42 class Emitter extends emitterTask.EmitterBase { | 42 class Emitter extends emitterTask.EmitterBase { |
| 43 final Compiler _compiler; | 43 final Compiler _compiler; |
| 44 final ClosedWorld _closedWorld; | 44 final ClosedWorld _closedWorld; |
| 45 final Namer namer; | 45 final Namer namer; |
| 46 final ModelEmitter _emitter; | 46 final ModelEmitter _emitter; |
| 47 | 47 |
| 48 JavaScriptBackend get _backend => _compiler.backend; | 48 JavaScriptBackend get _backend => _compiler.backend; |
| 49 | 49 |
| 50 Emitter(this._compiler, this.namer, NativeEmitter nativeEmitter, | 50 Emitter( |
| 51 this._closedWorld, CodeEmitterTask task, bool shouldGenerateSourceMap) | 51 this._compiler, |
| 52 this.namer, |
| 53 NativeEmitter nativeEmitter, |
| 54 this._closedWorld, |
| 55 Sorter sorter, |
| 56 CodeEmitterTask task, |
| 57 bool shouldGenerateSourceMap) |
| 52 : _emitter = new ModelEmitter(_compiler, namer, nativeEmitter, | 58 : _emitter = new ModelEmitter(_compiler, namer, nativeEmitter, |
| 53 _closedWorld, task, shouldGenerateSourceMap); | 59 _closedWorld, sorter, task, shouldGenerateSourceMap); |
| 54 | 60 |
| 55 DiagnosticReporter get reporter => _compiler.reporter; | 61 DiagnosticReporter get reporter => _compiler.reporter; |
| 56 | 62 |
| 57 @override | 63 @override |
| 58 int emitProgram(ProgramBuilder programBuilder) { | 64 int emitProgram(ProgramBuilder programBuilder) { |
| 59 Program program = programForTesting = programBuilder.buildProgram(); | 65 Program program = programForTesting = programBuilder.buildProgram(); |
| 60 return _emitter.emitProgram(program); | 66 return _emitter.emitProgram(program); |
| 61 } | 67 } |
| 62 | 68 |
| 63 @override | 69 @override |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 168 } |
| 163 } | 169 } |
| 164 | 170 |
| 165 @override | 171 @override |
| 166 int generatedSize(OutputUnit unit) { | 172 int generatedSize(OutputUnit unit) { |
| 167 Fragment key = _emitter.outputBuffers.keys | 173 Fragment key = _emitter.outputBuffers.keys |
| 168 .firstWhere((Fragment fragment) => fragment.outputUnit == unit); | 174 .firstWhere((Fragment fragment) => fragment.outputUnit == unit); |
| 169 return _emitter.outputBuffers[key].length; | 175 return _emitter.outputBuffers[key].length; |
| 170 } | 176 } |
| 171 } | 177 } |
| OLD | NEW |