Index: pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart |
diff --git a/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart b/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart |
index 84c5200515ff58d2f8c9d1082a5874ac7c05177c..11c10225418418f3d0057e467765597fa79b10a6 100644 |
--- a/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart |
+++ b/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart |
@@ -107,10 +107,16 @@ class Builder implements cps_ir.Visitor/*<NodeCallback|Node>*/ { |
/// This increments the reference count for the given variable, so the |
/// returned expression must be used in the tree. |
Expression getVariableUse(cps_ir.Reference<cps_ir.Primitive> reference) { |
- if (thisParameter != null && reference.definition == thisParameter) { |
+ cps_ir.Primitive prim = reference.definition.effectiveDefinition; |
+ if (thisParameter != null && prim == thisParameter) { |
return new This(); |
} |
- return new VariableUse(getVariable(reference.definition)); |
+ return new VariableUse(getVariable(prim)); |
+ } |
+ |
+ Expression getVariableUseOrNull( |
+ cps_ir.Reference<cps_ir.Primitive> reference) { |
+ return reference == null ? null : getVariableUse(reference); |
} |
Label getLabel(cps_ir.Continuation cont) { |
@@ -496,10 +502,6 @@ class Builder implements cps_ir.Visitor/*<NodeCallback|Node>*/ { |
); |
} |
- FunctionDefinition makeSubFunction(cps_ir.FunctionDefinition function) { |
- return createInnerBuilder().buildFunction(function); |
- } |
- |
Expression visitReifyRuntimeType(cps_ir.ReifyRuntimeType node) { |
return new ReifyRuntimeType( |
getVariableUse(node.value), node.sourceInformation); |
@@ -643,6 +645,15 @@ class Builder implements cps_ir.Visitor/*<NodeCallback|Node>*/ { |
} |
} |
+ visitNullCheck(cps_ir.NullCheck node) => (Statement next) { |
+ return new NullCheck( |
+ condition: getVariableUseOrNull(node.condition), |
+ value: getVariableUse(node.value), |
+ selector: node.selector, |
+ next: next, |
+ sourceInformation: node.sourceInformation); |
+ }; |
+ |
Expression visitGetLazyStatic(cps_ir.GetLazyStatic node) { |
// In the tree IR, GetStatic handles lazy fields because we do not need |
// as fine-grained control over side effects. |