| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library dart2js.js_emitter.program_builder; | 5 library dart2js.js_emitter.program_builder; |
| 6 | 6 |
| 7 import '../js_emitter.dart' show | 7 import '../js_emitter.dart' show |
| 8 ClassStubGenerator, | 8 ClassStubGenerator, |
| 9 CodeEmitterTask, | 9 CodeEmitterTask, |
| 10 computeMixinClass, | 10 computeMixinClass, |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 // the holder-instance. | 305 // the holder-instance. |
| 306 return new StaticField(element, | 306 return new StaticField(element, |
| 307 name, _registerStaticStateHolder(), code, | 307 name, _registerStaticStateHolder(), code, |
| 308 isFinal, isLazy); | 308 isFinal, isLazy); |
| 309 } | 309 } |
| 310 | 310 |
| 311 List<StaticField> _buildStaticLazilyInitializedFields( | 311 List<StaticField> _buildStaticLazilyInitializedFields( |
| 312 LibrariesMap librariesMap) { | 312 LibrariesMap librariesMap) { |
| 313 JavaScriptConstantCompiler handler = backend.constants; | 313 JavaScriptConstantCompiler handler = backend.constants; |
| 314 DeferredLoadTask loadTask = _compiler.deferredLoadTask; | 314 DeferredLoadTask loadTask = _compiler.deferredLoadTask; |
| 315 List<VariableElement> lazyFields = handler | 315 Iterable<VariableElement> lazyFields = handler |
| 316 .getLazilyInitializedFieldsForEmission() | 316 .getLazilyInitializedFieldsForEmission() |
| 317 .where((element) => | 317 .where((element) => |
| 318 loadTask.outputUnitForElement(element) == librariesMap.outputUnit); | 318 loadTask.outputUnitForElement(element) == librariesMap.outputUnit); |
| 319 return Elements.sortedByPosition(lazyFields) | 319 return Elements.sortedByPosition(lazyFields) |
| 320 .map(_buildLazyField) | 320 .map(_buildLazyField) |
| 321 .where((field) => field != null) // Happens when the field was unused. | 321 .where((field) => field != null) // Happens when the field was unused. |
| 322 .toList(growable: false); | 322 .toList(growable: false); |
| 323 } | 323 } |
| 324 | 324 |
| 325 StaticField _buildLazyField(Element element) { | 325 StaticField _buildLazyField(Element element) { |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1011 Constant constant = new Constant(name, holder, constantValue); | 1011 Constant constant = new Constant(name, holder, constantValue); |
| 1012 _constants[constantValue] = constant; | 1012 _constants[constantValue] = constant; |
| 1013 } | 1013 } |
| 1014 } | 1014 } |
| 1015 | 1015 |
| 1016 Holder _registerStaticStateHolder() { | 1016 Holder _registerStaticStateHolder() { |
| 1017 return _registry.registerHolder( | 1017 return _registry.registerHolder( |
| 1018 namer.staticStateHolder, isStaticStateHolder: true); | 1018 namer.staticStateHolder, isStaticStateHolder: true); |
| 1019 } | 1019 } |
| 1020 } | 1020 } |
| OLD | NEW |