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

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

Issue 2942863002: Compile and run Hello World! (Closed)
Patch Set: Rebased 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
« no previous file with comments | « pkg/compiler/lib/src/ssa/ssa.dart ('k') | tests/compiler/dart2js/kernel/compile_from_dill_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « pkg/compiler/lib/src/ssa/ssa.dart ('k') | tests/compiler/dart2js/kernel/compile_from_dill_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698