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 1c922e588b2fe72a419162e15ca7ff77c7b30b37..af0193a51325fabdfcd864560c899661b374f537 100644 |
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart |
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart |
@@ -125,6 +125,10 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
openFunction(); |
if (field.initializer != null) { |
field.initializer.accept(this); |
+ HInstruction fieldValue = pop(); |
+ HInstruction checkInstruction = typeBuilder.potentiallyCheckOrTrustType( |
+ fieldValue, astAdapter.getDartType(field.type)); |
+ stack.add(checkInstruction); |
} else { |
stack.add(graph.addConstantNull(compiler)); |
} |
@@ -926,7 +930,6 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
HInstruction initialValue = graph.addConstantNull(compiler); |
localsHandler.updateLocal(local, initialValue); |
} else { |
- // TODO(het): handle case where the variable is top-level or static |
declaration.initializer.accept(this); |
HInstruction initialValue = pop(); |
@@ -938,7 +941,6 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
} |
void _visitLocalSetter(ir.VariableDeclaration variable, HInstruction value) { |
- // TODO(het): handle case where the variable is top-level or static |
LocalElement local = astAdapter.getElement(variable); |
// Give the value a name if it doesn't have one already. |