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 'dart:io'; | 7 import 'dart:io'; |
8 import 'dart:convert' show JSON; | 8 import 'dart:convert' show JSON; |
9 | 9 |
10 import '../../closure.dart' show ClosureConversionTask, ClosureFieldElement; | 10 import '../../closure.dart' show ClosureConversionTask, ClosureFieldElement; |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 } | 433 } |
434 | 434 |
435 List<StaticField> _buildStaticNonFinalFields(LibrariesMap librariesMap) { | 435 List<StaticField> _buildStaticNonFinalFields(LibrariesMap librariesMap) { |
436 List<FieldEntity> staticNonFinalFields = | 436 List<FieldEntity> staticNonFinalFields = |
437 collector.outputStaticNonFinalFieldLists[librariesMap.outputUnit]; | 437 collector.outputStaticNonFinalFieldLists[librariesMap.outputUnit]; |
438 if (staticNonFinalFields == null) return const <StaticField>[]; | 438 if (staticNonFinalFields == null) return const <StaticField>[]; |
439 | 439 |
440 return staticNonFinalFields.map(_buildStaticField).toList(growable: false); | 440 return staticNonFinalFields.map(_buildStaticField).toList(growable: false); |
441 } | 441 } |
442 | 442 |
443 StaticField _buildStaticField(FieldElement element) { | 443 StaticField _buildStaticField(FieldEntity element) { |
444 ConstantValue initialValue = | 444 ConstantValue initialValue = |
445 _constantHandler.getConstantValue(element.constant); | 445 _worldBuilder.getConstantFieldInitializer(element); |
446 // TODO(zarah): The holder should not be registered during building of | 446 // TODO(zarah): The holder should not be registered during building of |
447 // a static field. | 447 // a static field. |
448 _registry.registerHolder(_namer.globalObjectForConstant(initialValue), | 448 _registry.registerHolder(_namer.globalObjectForConstant(initialValue), |
449 isConstantsHolder: true); | 449 isConstantsHolder: true); |
450 js.Expression code = _task.emitter.constantReference(initialValue); | 450 js.Expression code = _task.emitter.constantReference(initialValue); |
451 js.Name name = _namer.globalPropertyNameForMember(element); | 451 js.Name name = _namer.globalPropertyNameForMember(element); |
452 bool isFinal = false; | 452 bool isFinal = false; |
453 bool isLazy = false; | 453 bool isLazy = false; |
454 | 454 |
455 // TODO(floitsch): we shouldn't update the registry in the middle of | 455 // TODO(floitsch): we shouldn't update the registry in the middle of |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1190 Constant constant = new Constant(name, holder, constantValue); | 1190 Constant constant = new Constant(name, holder, constantValue); |
1191 _constants[constantValue] = constant; | 1191 _constants[constantValue] = constant; |
1192 } | 1192 } |
1193 } | 1193 } |
1194 | 1194 |
1195 Holder _registerStaticStateHolder() { | 1195 Holder _registerStaticStateHolder() { |
1196 return _registry.registerHolder(_namer.staticStateHolder, | 1196 return _registry.registerHolder(_namer.staticStateHolder, |
1197 isStaticStateHolder: true); | 1197 isStaticStateHolder: true); |
1198 } | 1198 } |
1199 } | 1199 } |
OLD | NEW |