| 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_LAZY_EMITTER = const bool.fromEnvironment("dart2js.use.lazy.emitter"); | 7 const USE_LAZY_EMITTER = const bool.fromEnvironment("dart2js.use.lazy.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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 metadataCollector = new MetadataCollector(compiler, emitter); | 53 metadataCollector = new MetadataCollector(compiler, emitter); |
| 54 } | 54 } |
| 55 | 55 |
| 56 String get name => 'Code emitter'; | 56 String get name => 'Code emitter'; |
| 57 | 57 |
| 58 /// Returns the string that is used to find library patches that are | 58 /// Returns the string that is used to find library patches that are |
| 59 /// specialized for the emitter. | 59 /// specialized for the emitter. |
| 60 String get patchVersion => emitter.patchVersion; | 60 String get patchVersion => emitter.patchVersion; |
| 61 | 61 |
| 62 /// Returns the closure expression of a static function. | 62 /// Returns the closure expression of a static function. |
| 63 jsAst.Expression isolateStaticClosureAccess(FunctionElement element) { | 63 jsAst.Expression isolateStaticClosureAccess(MethodElement element) { |
| 64 return emitter.isolateStaticClosureAccess(element); | 64 return emitter.isolateStaticClosureAccess(element); |
| 65 } | 65 } |
| 66 | 66 |
| 67 /// Returns the JS function that must be invoked to get the value of the | 67 /// Returns the JS function that must be invoked to get the value of the |
| 68 /// lazily initialized static. | 68 /// lazily initialized static. |
| 69 jsAst.Expression isolateLazyInitializerAccess(FieldElement element) { | 69 jsAst.Expression isolateLazyInitializerAccess(FieldElement element) { |
| 70 return emitter.isolateLazyInitializerAccess(element); | 70 return emitter.isolateLazyInitializerAccess(element); |
| 71 } | 71 } |
| 72 | 72 |
| 73 /// Returns the JS code for accessing the embedded [global]. | 73 /// Returns the JS code for accessing the embedded [global]. |
| 74 jsAst.Expression generateEmbeddedGlobalAccess(String global) { | 74 jsAst.Expression generateEmbeddedGlobalAccess(String global) { |
| 75 return emitter.generateEmbeddedGlobalAccess(global); | 75 return emitter.generateEmbeddedGlobalAccess(global); |
| 76 } | 76 } |
| 77 | 77 |
| 78 /// Returns the JS code for accessing the given [constant]. | 78 /// Returns the JS code for accessing the given [constant]. |
| 79 jsAst.Expression constantReference(ConstantValue constant) { | 79 jsAst.Expression constantReference(ConstantValue constant) { |
| 80 return emitter.constantReference(constant); | 80 return emitter.constantReference(constant); |
| 81 } | 81 } |
| 82 | 82 |
| 83 jsAst.Expression staticFieldAccess(FieldElement e) { | 83 jsAst.Expression staticFieldAccess(FieldElement e) { |
| 84 return emitter.staticFieldAccess(e); | 84 return emitter.staticFieldAccess(e); |
| 85 } | 85 } |
| 86 | 86 |
| 87 /// Returns the JS function representing the given function. | 87 /// Returns the JS function representing the given function. |
| 88 /// | 88 /// |
| 89 /// The function must be invoked and can not be used as closure. | 89 /// The function must be invoked and can not be used as closure. |
| 90 jsAst.Expression staticFunctionAccess(FunctionElement e) { | 90 jsAst.Expression staticFunctionAccess(MethodElement e) { |
| 91 return emitter.staticFunctionAccess(e); | 91 return emitter.staticFunctionAccess(e); |
| 92 } | 92 } |
| 93 | 93 |
| 94 /// Returns the JS constructor of the given element. | 94 /// Returns the JS constructor of the given element. |
| 95 /// | 95 /// |
| 96 /// The returned expression must only be used in a JS `new` expression. | 96 /// The returned expression must only be used in a JS `new` expression. |
| 97 jsAst.Expression constructorAccess(ClassElement e) { | 97 jsAst.Expression constructorAccess(ClassElement e) { |
| 98 return emitter.constructorAccess(e); | 98 return emitter.constructorAccess(e); |
| 99 } | 99 } |
| 100 | 100 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant); | 203 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant); |
| 204 | 204 |
| 205 /// Returns the JS code for accessing the given [constant]. | 205 /// Returns the JS code for accessing the given [constant]. |
| 206 jsAst.Expression constantReference(ConstantValue constant); | 206 jsAst.Expression constantReference(ConstantValue constant); |
| 207 | 207 |
| 208 /// Returns the JS template for the given [builtin]. | 208 /// Returns the JS template for the given [builtin]. |
| 209 jsAst.Template templateForBuiltin(JsBuiltin builtin); | 209 jsAst.Template templateForBuiltin(JsBuiltin builtin); |
| 210 | 210 |
| 211 void invalidateCaches(); | 211 void invalidateCaches(); |
| 212 } | 212 } |
| OLD | NEW |