| 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 /** | 5 /** |
| 6 * The [ConstantHandler] keeps track of compile-time constants, | 6 * The [ConstantHandler] keeps track of compile-time constants, |
| 7 * initializations of global and static fields, and default values of | 7 * initializations of global and static fields, and default values of |
| 8 * optional parameters. | 8 * optional parameters. |
| 9 */ | 9 */ |
| 10 class ConstantHandler extends CompilerTask { | 10 class ConstantHandler extends CompilerTask { |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 } | 180 } |
| 181 }); | 181 }); |
| 182 } | 182 } |
| 183 | 183 |
| 184 /** | 184 /** |
| 185 * Returns a [List] of static non final fields that need to be initialized. | 185 * Returns a [List] of static non final fields that need to be initialized. |
| 186 * The list must be evaluated in order since the fields might depend on each | 186 * The list must be evaluated in order since the fields might depend on each |
| 187 * other. | 187 * other. |
| 188 */ | 188 */ |
| 189 List<VariableElement> getStaticNonFinalFieldsForEmission() { | 189 List<VariableElement> getStaticNonFinalFieldsForEmission() { |
| 190 return initialVariableValues.getKeys().filter((element) { | 190 return initialVariableValues.keys.filter((element) { |
| 191 return element.kind == ElementKind.FIELD | 191 return element.kind == ElementKind.FIELD |
| 192 && !element.isInstanceMember() | 192 && !element.isInstanceMember() |
| 193 && !element.modifiers.isFinal(); | 193 && !element.modifiers.isFinal(); |
| 194 }); | 194 }); |
| 195 } | 195 } |
| 196 | 196 |
| 197 /** | 197 /** |
| 198 * Returns a [List] of static const fields that need to be initialized. The | 198 * Returns a [List] of static const fields that need to be initialized. The |
| 199 * list must be evaluated in order since the fields might depend on each | 199 * list must be evaluated in order since the fields might depend on each |
| 200 * other. | 200 * other. |
| 201 */ | 201 */ |
| 202 List<VariableElement> getStaticFinalFieldsForEmission() { | 202 List<VariableElement> getStaticFinalFieldsForEmission() { |
| 203 return initialVariableValues.getKeys().filter((element) { | 203 return initialVariableValues.keys.filter((element) { |
| 204 return element.kind == ElementKind.FIELD | 204 return element.kind == ElementKind.FIELD |
| 205 && !element.isInstanceMember() | 205 && !element.isInstanceMember() |
| 206 && element.modifiers.isFinal(); | 206 && element.modifiers.isFinal(); |
| 207 }); | 207 }); |
| 208 } | 208 } |
| 209 | 209 |
| 210 List<VariableElement> getLazilyInitializedFieldsForEmission() { | 210 List<VariableElement> getLazilyInitializedFieldsForEmission() { |
| 211 return new List<VariableElement>.from(lazyStatics); | 211 return new List<VariableElement>.from(lazyStatics); |
| 212 } | 212 } |
| 213 | 213 |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 // Use the default value. | 808 // Use the default value. |
| 809 fieldValue = compiler.compileConstant(field); | 809 fieldValue = compiler.compileConstant(field); |
| 810 } | 810 } |
| 811 jsNewArguments.add(fieldValue); | 811 jsNewArguments.add(fieldValue); |
| 812 }, | 812 }, |
| 813 includeBackendMembers: true, | 813 includeBackendMembers: true, |
| 814 includeSuperMembers: true); | 814 includeSuperMembers: true); |
| 815 return jsNewArguments; | 815 return jsNewArguments; |
| 816 } | 816 } |
| 817 } | 817 } |
| OLD | NEW |