Do not forget to process rhs on unsupported lhs

This commit is contained in:
Andrey Breslav
2013-12-03 18:39:12 +04:00
parent 6c519bb515
commit e0cf73d989
4 changed files with 28 additions and 2 deletions
@@ -358,11 +358,11 @@ public class JetControlFlowProcessor {
return;
}
generateInstructions(rhs, false);
if (left instanceof JetSimpleNameExpression || left instanceof JetProperty) {
generateInstructions(rhs, false);
// Do nothing, just record write below
}
else if (left instanceof JetQualifiedExpression) {
generateInstructions(rhs, false);
generateInstructions(((JetQualifiedExpression) left).getReceiverExpression(), false);
}
else {
@@ -0,0 +1,18 @@
== bar ==
fun Int.bar(c: C) {
this = c
}
---------------------
L0:
<START> NEXT:[v(c: C)] PREV:[]
v(c: C) NEXT:[w(c)] PREV:[<START>]
w(c) NEXT:[r(c)] PREV:[v(c: C)]
r(c) NEXT:[unsupported(BINARY_EXPRESSION : this = c)] PREV:[w(c)]
unsupported(BINARY_EXPRESSION : this = c) NEXT:[<END>] PREV:[r(c)]
L1:
<END> NEXT:[<SINK>] PREV:[unsupported(BINARY_EXPRESSION : this = c)]
error:
<ERROR> NEXT:[<SINK>] PREV:[]
sink:
<SINK> NEXT:[] PREV:[<ERROR>, <END>]
=====================
@@ -0,0 +1,3 @@
fun Int.bar(c: C) {
this = c
}
@@ -61,6 +61,11 @@ public class ControlFlowTestGenerated extends AbstractControlFlowTest {
doTest("compiler/testData/cfg/arraySetPlusAssign.kt");
}
@TestMetadata("assignmentToThis.kt")
public void testAssignmentToThis() throws Exception {
doTest("compiler/testData/cfg/assignmentToThis.kt");
}
@TestMetadata("Assignments.kt")
public void testAssignments() throws Exception {
doTest("compiler/testData/cfg/Assignments.kt");