| Index: pkg/compiler/lib/src/universe/codegen_world_builder.dart
|
| diff --git a/pkg/compiler/lib/src/universe/codegen_world_builder.dart b/pkg/compiler/lib/src/universe/codegen_world_builder.dart
|
| index 7df0e20de6ec1083905453b37d35fb6e1673f625..771ebc4e8e95e28644ec0bb18f8b3a7cc6dd47fc 100644
|
| --- a/pkg/compiler/lib/src/universe/codegen_world_builder.dart
|
| +++ b/pkg/compiler/lib/src/universe/codegen_world_builder.dart
|
| @@ -27,9 +27,12 @@ abstract class CodegenWorldBuilder implements WorldBuilder {
|
| void forEachInvokedSetter(
|
| f(String name, Map<Selector, SelectorConstraints> selectors));
|
|
|
| - /// Returns `true` if [field] constant or final with a constant initializer.
|
| + /// Returns `true` if [field] has a constant initializer.
|
| bool hasConstantFieldInitializer(FieldEntity field);
|
|
|
| + /// Returns the constant initializer for [field].
|
| + ConstantValue getConstantFieldInitializer(FieldEntity field);
|
| +
|
| /// Returns `true` if [member] is invoked as a setter.
|
| bool hasInvokedSetter(MemberEntity member, ClosedWorld world);
|
|
|
| @@ -561,6 +564,13 @@ class ElementCodegenWorldBuilderImpl extends CodegenWorldBuilderImpl {
|
| return field.constant != null;
|
| }
|
|
|
| + @override
|
| + ConstantValue getConstantFieldInitializer(FieldElement field) {
|
| + assert(field.constant != null,
|
| + failedAt(field, "Field $field doesn't have a constant initial value."));
|
| + return _constants.getConstantValue(field.constant);
|
| + }
|
| +
|
| /// Calls [f] with every instance field, together with its declarer, in an
|
| /// instance of [cls].
|
| void forEachInstanceField(
|
| @@ -634,6 +644,11 @@ class KernelCodegenWorldBuilder extends CodegenWorldBuilderImpl {
|
| }
|
|
|
| @override
|
| + ConstantValue getConstantFieldInitializer(FieldEntity field) {
|
| + return _elementMap.getConstantFieldInitializer(field);
|
| + }
|
| +
|
| + @override
|
| void forEachParameter(FunctionEntity function,
|
| void f(DartType type, String name, ConstantValue defaultValue)) {
|
| _elementMap.forEachParameter(function, f);
|
|
|