| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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.code_emitter_task; | 5 library dart2js.js_emitter.code_emitter_task; |
| 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 '../common/tasks.dart' show CompilerTask; | 10 import '../common/tasks.dart' show CompilerTask; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 } else if (useStartupEmitter) { | 60 } else if (useStartupEmitter) { |
| 61 _emitterFactory = new startup_js_emitter.EmitterFactory( | 61 _emitterFactory = new startup_js_emitter.EmitterFactory( |
| 62 generateSourceMap: generateSourceMap); | 62 generateSourceMap: generateSourceMap); |
| 63 } else { | 63 } else { |
| 64 _emitterFactory = new full_js_emitter.EmitterFactory( | 64 _emitterFactory = new full_js_emitter.EmitterFactory( |
| 65 generateSourceMap: generateSourceMap); | 65 generateSourceMap: generateSourceMap); |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 | 68 |
| 69 NativeEmitter get nativeEmitter { | 69 NativeEmitter get nativeEmitter { |
| 70 assert(invariant(NO_LOCATION_SPANNABLE, _nativeEmitter != null, | 70 assert( |
| 71 message: "NativeEmitter has not been created yet.")); | 71 _nativeEmitter != null, |
| 72 failedAt( |
| 73 NO_LOCATION_SPANNABLE, "NativeEmitter has not been created yet.")); |
| 72 return _nativeEmitter; | 74 return _nativeEmitter; |
| 73 } | 75 } |
| 74 | 76 |
| 75 Emitter get emitter { | 77 Emitter get emitter { |
| 76 assert(invariant(NO_LOCATION_SPANNABLE, _emitter != null, | 78 assert(_emitter != null, |
| 77 message: "Emitter has not been created yet.")); | 79 failedAt(NO_LOCATION_SPANNABLE, "Emitter has not been created yet.")); |
| 78 return _emitter; | 80 return _emitter; |
| 79 } | 81 } |
| 80 | 82 |
| 81 /// Returns the [Sorter] use for ordering elements in the generated | 83 /// Returns the [Sorter] use for ordering elements in the generated |
| 82 /// JavaScript. | 84 /// JavaScript. |
| 83 // TODO(johnniwinther): Switch this based on the used entity model. | 85 // TODO(johnniwinther): Switch this based on the used entity model. |
| 84 Sorter get sorter => const ElementSorter(); | 86 Sorter get sorter => const ElementSorter(); |
| 85 | 87 |
| 86 String get name => 'Code emitter'; | 88 String get name => 'Code emitter'; |
| 87 | 89 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 281 |
| 280 /// Returns the JS code for accessing the given [constant]. | 282 /// Returns the JS code for accessing the given [constant]. |
| 281 jsAst.Expression constantReference(ConstantValue constant); | 283 jsAst.Expression constantReference(ConstantValue constant); |
| 282 | 284 |
| 283 /// Returns the JS template for the given [builtin]. | 285 /// Returns the JS template for the given [builtin]. |
| 284 jsAst.Template templateForBuiltin(JsBuiltin builtin); | 286 jsAst.Template templateForBuiltin(JsBuiltin builtin); |
| 285 | 287 |
| 286 /// Returns the size of the code generated for a given output [unit]. | 288 /// Returns the size of the code generated for a given output [unit]. |
| 287 int generatedSize(OutputUnit unit); | 289 int generatedSize(OutputUnit unit); |
| 288 } | 290 } |
| OLD | NEW |