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 part of dart2js.js_emitter; |
6 | 6 |
7 const USE_NEW_EMITTER = const bool.fromEnvironment("dart2js.use.new.emitter"); | 7 const USE_NEW_EMITTER = const bool.fromEnvironment("dart2js.use.new.emitter"); |
8 | 8 |
9 /** | 9 /** |
10 * Generates the code for all used classes in the program. Static fields (even | 10 * Generates the code for all used classes in the program. Static fields (even |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 return emitter.interceptorClassAccess(e); | 117 return emitter.interceptorClassAccess(e); |
118 } | 118 } |
119 | 119 |
120 /// Returns the JS expression representing the type [e]. | 120 /// Returns the JS expression representing the type [e]. |
121 /// | 121 /// |
122 /// The given type [e] might be a Typedef. | 122 /// The given type [e] might be a Typedef. |
123 jsAst.Expression typeAccess(Element e) { | 123 jsAst.Expression typeAccess(Element e) { |
124 return emitter.typeAccess(e); | 124 return emitter.typeAccess(e); |
125 } | 125 } |
126 | 126 |
| 127 /// Returns the JS template for the given [builtin]. |
| 128 jsAst.Template builtinTemplateFor(JsBuiltin builtin) { |
| 129 return emitter.templateForBuiltin(builtin); |
| 130 } |
| 131 |
127 void registerReadTypeVariable(TypeVariableElement element) { | 132 void registerReadTypeVariable(TypeVariableElement element) { |
128 readTypeVariables.add(element); | 133 readTypeVariables.add(element); |
129 } | 134 } |
130 | 135 |
131 Set<ClassElement> computeInterceptorsReferencedFromConstants() { | 136 Set<ClassElement> computeInterceptorsReferencedFromConstants() { |
132 Set<ClassElement> classes = new Set<ClassElement>(); | 137 Set<ClassElement> classes = new Set<ClassElement>(); |
133 JavaScriptConstantCompiler handler = backend.constants; | 138 JavaScriptConstantCompiler handler = backend.constants; |
134 List<ConstantValue> constants = handler.getConstantsForEmission(); | 139 List<ConstantValue> constants = handler.getConstantsForEmission(); |
135 for (ConstantValue constant in constants) { | 140 for (ConstantValue constant in constants) { |
136 if (constant is InterceptorConstantValue) { | 141 if (constant is InterceptorConstantValue) { |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 | 447 |
443 /// Returns the JS expression representing a function that returns 'null' | 448 /// Returns the JS expression representing a function that returns 'null' |
444 jsAst.Expression generateFunctionThatReturnsNull(); | 449 jsAst.Expression generateFunctionThatReturnsNull(); |
445 | 450 |
446 int compareConstants(ConstantValue a, ConstantValue b); | 451 int compareConstants(ConstantValue a, ConstantValue b); |
447 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant); | 452 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant); |
448 | 453 |
449 /// Returns the JS code for accessing the given [constant]. | 454 /// Returns the JS code for accessing the given [constant]. |
450 jsAst.Expression constantReference(ConstantValue constant); | 455 jsAst.Expression constantReference(ConstantValue constant); |
451 | 456 |
| 457 /// Returns the JS template for the given [builtin]. |
| 458 jsAst.Template templateForBuiltin(JsBuiltin builtin); |
| 459 |
452 void invalidateCaches(); | 460 void invalidateCaches(); |
453 } | 461 } |
OLD | NEW |