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

Unified Diff: pkg/compiler/lib/src/ssa/builder_kernel.dart

Issue 3005823002: Handle forwarding constructors to unnamed mixin applications (Closed)
Patch Set: Updated cf. comments Created 3 years, 3 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/ssa/builder_kernel.dart
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index 141cda07f84eb7513b3400d8727bf9e2ba0c4030..632a9f1fcf07ae24dfc3ac43ee0301c25ea279ec 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -462,23 +462,28 @@ class KernelSsaGraphBuilder extends ir.Visitor
/// Maps the instance fields of a class to their SSA values.
Map<FieldEntity, HInstruction> _collectFieldValues(ir.Class clazz) {
Map<FieldEntity, HInstruction> fieldValues = <FieldEntity, HInstruction>{};
-
- for (ir.Field node in clazz.fields) {
- if (node.isInstanceMember) {
- FieldEntity field = _elementMap.getField(node);
- if (node.initializer == null) {
- fieldValues[field] = graph.addConstantNull(closedWorld);
- } else {
- // Gotta update the resolvedAst when we're looking at field values
- // outside the constructor.
- inlinedFrom(field, () {
- node.initializer.accept(this);
- fieldValues[field] = pop();
- });
- }
+ ClassEntity cls = _elementMap.getClass(clazz);
+ _worldBuilder.forEachInstanceField(cls, (_, FieldEntity field) {
+ MemberDefinition definition = _elementMap.getMemberDefinition(field);
+ ir.Field node;
+ switch (definition.kind) {
+ case MemberKind.regular:
+ node = definition.node;
+ break;
+ default:
+ failedAt(field, "Unexpected member definition $definition.");
}
- }
-
+ if (node.initializer == null) {
+ fieldValues[field] = graph.addConstantNull(closedWorld);
+ } else {
+ // Gotta update the current member when we're looking at field values
+ // outside the constructor.
+ inlinedFrom(field, () {
+ node.initializer.accept(this);
+ fieldValues[field] = pop();
+ });
+ }
+ });
return fieldValues;
}
@@ -625,12 +630,6 @@ class KernelSsaGraphBuilder extends ir.Visitor
_bindSupertypeTypeParameters(callerClass.mixedInType);
}
- ir.Class cls = target.enclosingClass;
-
- inlinedFrom(_elementMap.getConstructor(target), () {
- fieldValues.addAll(_collectFieldValues(cls));
- });
-
_inlineSuperOrRedirectCommon(
initializer, target, arguments, constructorChain, fieldValues, caller);
}

Powered by Google App Engine
This is Rietveld 408576698