| 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 part of dart2js.js_emitter; | 5 library dart2js.js_emitter.code_emitter_task; |
| 6 |
| 7 import 'package:js_runtime/shared/embedded_names.dart' show JsBuiltin; |
| 8 |
| 9 import '../common.dart'; |
| 10 import '../common/tasks.dart' show CompilerTask; |
| 11 import '../compiler.dart' show Compiler; |
| 12 import '../constants/values.dart'; |
| 13 import '../elements/elements.dart' |
| 14 show |
| 15 ClassElement, |
| 16 Entity, |
| 17 FieldElement, |
| 18 FunctionElement, |
| 19 MethodElement, |
| 20 TypeVariableElement; |
| 21 import '../js/js.dart' as jsAst; |
| 22 import '../js_backend/js_backend.dart' |
| 23 show |
| 24 JavaScriptBackend, |
| 25 Namer; |
| 26 import '../world.dart' show ClosedWorld; |
| 27 import 'full_emitter/emitter.dart' as full_js_emitter; |
| 28 import 'lazy_emitter/emitter.dart' as lazy_js_emitter; |
| 29 import 'program_builder/program_builder.dart'; |
| 30 import 'startup_emitter/emitter.dart' as startup_js_emitter; |
| 31 |
| 32 import 'metadata_collector.dart' show MetadataCollector; |
| 33 import 'native_emitter.dart' show NativeEmitter; |
| 34 import 'type_test_registry.dart' show TypeTestRegistry; |
| 6 | 35 |
| 7 const USE_LAZY_EMITTER = const bool.fromEnvironment("dart2js.use.lazy.emitter"); | 36 const USE_LAZY_EMITTER = const bool.fromEnvironment("dart2js.use.lazy.emitter"); |
| 8 | 37 |
| 9 /** | 38 /** |
| 10 * Generates the code for all used classes in the program. Static fields (even | 39 * Generates the code for all used classes in the program. Static fields (even |
| 11 * in classes) are ignored, since they can be treated as non-class elements. | 40 * in classes) are ignored, since they can be treated as non-class elements. |
| 12 * | 41 * |
| 13 * The code for the containing (used) methods must exist in the `universe`. | 42 * The code for the containing (used) methods must exist in the `universe`. |
| 14 */ | 43 */ |
| 15 class CodeEmitterTask extends CompilerTask { | 44 class CodeEmitterTask extends CompilerTask { |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant); | 252 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant); |
| 224 | 253 |
| 225 /// Returns the JS code for accessing the given [constant]. | 254 /// Returns the JS code for accessing the given [constant]. |
| 226 jsAst.Expression constantReference(ConstantValue constant); | 255 jsAst.Expression constantReference(ConstantValue constant); |
| 227 | 256 |
| 228 /// Returns the JS template for the given [builtin]. | 257 /// Returns the JS template for the given [builtin]. |
| 229 jsAst.Template templateForBuiltin(JsBuiltin builtin); | 258 jsAst.Template templateForBuiltin(JsBuiltin builtin); |
| 230 | 259 |
| 231 void invalidateCaches(); | 260 void invalidateCaches(); |
| 232 } | 261 } |
| OLD | NEW |