Fixed: control flow graph building for array of functions.
'get' call for array should be get from INDEXED_LVALUE_GET
This commit is contained in:
@@ -875,8 +875,9 @@ public class JetControlFlowProcessor {
|
||||
@Override
|
||||
public void visitArrayAccessExpression(@NotNull JetArrayAccessExpression expression) {
|
||||
mark(expression);
|
||||
if (!generateCall(expression)) {
|
||||
generateArrayAccess(expression, getResolvedCall(expression));
|
||||
ResolvedCall<FunctionDescriptor> getMethodResolvedCall = trace.get(BindingContext.INDEXED_LVALUE_GET, expression);
|
||||
if (!checkAndGenerateCall(expression, getMethodResolvedCall)) {
|
||||
generateArrayAccess(expression, getMethodResolvedCall);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
== test ==
|
||||
fun test(array: Array<(Int)->Unit>) {
|
||||
array[11](3)
|
||||
}
|
||||
---------------------
|
||||
L0:
|
||||
<START>
|
||||
v(array: Array<(Int)->Unit>)
|
||||
w(array)
|
||||
mark({ array[11](3) })
|
||||
mark(array[11](3))
|
||||
mark(array[11])
|
||||
r(array)
|
||||
r(11)
|
||||
call(array[11], get)
|
||||
r(3)
|
||||
call(array[11], <for expression array[11]>)
|
||||
L1:
|
||||
<END> NEXT:[<SINK>]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
@@ -0,0 +1,3 @@
|
||||
fun test(array: Array<(Int)->Unit>) {
|
||||
array[11](3)
|
||||
}
|
||||
@@ -52,6 +52,11 @@ public class ControlFlowTestGenerated extends AbstractControlFlowTest {
|
||||
doTest("compiler/testData/cfg/arrayAccessExpression.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ArrayOfFunctions.kt")
|
||||
public void testArrayOfFunctions() throws Exception {
|
||||
doTest("compiler/testData/cfg/ArrayOfFunctions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("arraySet.kt")
|
||||
public void testArraySet() throws Exception {
|
||||
doTest("compiler/testData/cfg/arraySet.kt");
|
||||
|
||||
Reference in New Issue
Block a user