Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/compile_time_constants.dart

Issue 11412086: Make 'where' lazy. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: FilteredIterable/Iterator -> WhereIterable/Iterator. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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; 5 part of dart2js;
6 6
7 /** 7 /**
8 * The [ConstantHandler] keeps track of compile-time constants, 8 * The [ConstantHandler] keeps track of compile-time constants,
9 * initializations of global and static fields, and default values of 9 * initializations of global and static fields, and default values of
10 * optional parameters. 10 * optional parameters.
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 definitions, 177 definitions,
178 compiler); 178 compiler);
179 return evaluator.evaluate(node); 179 return evaluator.evaluate(node);
180 } on CompileTimeConstantError catch (exn) { 180 } on CompileTimeConstantError catch (exn) {
181 return null; 181 return null;
182 } 182 }
183 }); 183 });
184 } 184 }
185 185
186 /** 186 /**
187 * Returns a [List] of static non final fields that need to be initialized. 187 * Returns an [Iterable] of static non final fields that need to be
188 * The list must be evaluated in order since the fields might depend on each 188 * initialized. The fields list must be evaluated in order since they might
189 * other. 189 * depend on each other.
190 */ 190 */
191 List<VariableElement> getStaticNonFinalFieldsForEmission() { 191 Iterable<VariableElement> getStaticNonFinalFieldsForEmission() {
192 return initialVariableValues.keys.where((element) { 192 return initialVariableValues.keys.where((element) {
193 return element.kind == ElementKind.FIELD 193 return element.kind == ElementKind.FIELD
194 && !element.isInstanceMember() 194 && !element.isInstanceMember()
195 && !element.modifiers.isFinal(); 195 && !element.modifiers.isFinal();
196 }); 196 });
197 } 197 }
198 198
199 /** 199 /**
200 * Returns a [List] of static const fields that need to be initialized. The 200 * Returns an [Iterable] of static const fields that need to be initialized.
201 * list must be evaluated in order since the fields might depend on each 201 * The fields must be evaluated in order since they might depend on each
202 * other. 202 * other.
203 */ 203 */
204 List<VariableElement> getStaticFinalFieldsForEmission() { 204 Iterable<VariableElement> getStaticFinalFieldsForEmission() {
205 return initialVariableValues.keys.where((element) { 205 return initialVariableValues.keys.where((element) {
206 return element.kind == ElementKind.FIELD 206 return element.kind == ElementKind.FIELD
207 && !element.isInstanceMember() 207 && !element.isInstanceMember()
208 && element.modifiers.isFinal(); 208 && element.modifiers.isFinal();
209 }); 209 });
210 } 210 }
211 211
212 List<VariableElement> getLazilyInitializedFieldsForEmission() { 212 List<VariableElement> getLazilyInitializedFieldsForEmission() {
213 return new List<VariableElement>.from(lazyStatics); 213 return new List<VariableElement>.from(lazyStatics);
214 } 214 }
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 // Use the default value. 820 // Use the default value.
821 fieldValue = compiler.compileConstant(field); 821 fieldValue = compiler.compileConstant(field);
822 } 822 }
823 jsNewArguments.add(fieldValue); 823 jsNewArguments.add(fieldValue);
824 }, 824 },
825 includeBackendMembers: true, 825 includeBackendMembers: true,
826 includeSuperMembers: true); 826 includeSuperMembers: true);
827 return jsNewArguments; 827 return jsNewArguments;
828 } 828 }
829 } 829 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698