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

Unified Diff: pkg/compiler/lib/src/universe/codegen_world_builder.dart

Issue 2942863002: Compile and run Hello World! (Closed)
Patch Set: Cleanup Created 3 years, 6 months 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 side-by-side diff with in-line comments
Download patch
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 edccc6eed9d3bb5c9e14133453916e0cf5012ac1..36e2905277d81a164fd9b0aa53c3940d3a96f400 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(
@@ -633,6 +643,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);

Powered by Google App Engine
This is Rietveld 408576698