Print instructions for functions in classes
This commit is contained in:
@@ -12,6 +12,23 @@ error:
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== get ==
|
||||
fun get(_this: Any, p: PropertyMetadata): Int = 0
|
||||
---------------------
|
||||
L0:
|
||||
<START>
|
||||
v(_this: Any)
|
||||
w(_this)
|
||||
v(p: PropertyMetadata)
|
||||
w(p)
|
||||
r(0)
|
||||
L1:
|
||||
<END> NEXT:[<SINK>]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== a ==
|
||||
val a = Delegate()
|
||||
---------------------
|
||||
|
||||
@@ -13,6 +13,32 @@ error:
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== component1 ==
|
||||
fun component1() = 1
|
||||
---------------------
|
||||
L0:
|
||||
<START>
|
||||
r(1)
|
||||
L1:
|
||||
<END> NEXT:[<SINK>]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== component2 ==
|
||||
fun component2() = 2
|
||||
---------------------
|
||||
L0:
|
||||
<START>
|
||||
r(2)
|
||||
L1:
|
||||
<END> NEXT:[<SINK>]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== test ==
|
||||
fun test(c: C) {
|
||||
val (a, b) = c
|
||||
|
||||
@@ -12,6 +12,18 @@ error:
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== foo ==
|
||||
fun foo() : Int
|
||||
---------------------
|
||||
L0:
|
||||
<START>
|
||||
L1:
|
||||
<END> NEXT:[<SINK>]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== B ==
|
||||
class B : A {
|
||||
override fun foo() = 10
|
||||
@@ -28,6 +40,19 @@ sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== foo ==
|
||||
override fun foo() = 10
|
||||
---------------------
|
||||
L0:
|
||||
<START>
|
||||
r(10)
|
||||
L1:
|
||||
<END> NEXT:[<SINK>]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== foo ==
|
||||
fun foo(b: B) : Int {
|
||||
val o = object : A by b {}
|
||||
return o.foo()
|
||||
|
||||
@@ -12,6 +12,18 @@ error:
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== getArray ==
|
||||
abstract fun getArray() : Array<Int>
|
||||
---------------------
|
||||
L0:
|
||||
<START>
|
||||
L1:
|
||||
<END> NEXT:[<SINK>]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== test ==
|
||||
fun test(ab: Ab) {
|
||||
ab.getArray()[1]
|
||||
|
||||
@@ -55,11 +55,15 @@ public abstract class AbstractControlFlowTest extends KotlinTestWithEnvironment
|
||||
List<JetDeclaration> declarations = jetFile.getDeclarations();
|
||||
BindingContext bindingContext = analyzeExhaust.getBindingContext();
|
||||
for (JetDeclaration declaration : declarations) {
|
||||
Pseudocode pseudocode = PseudocodeUtil.generatePseudocode(declaration, bindingContext);
|
||||
data.put(declaration, pseudocode);
|
||||
for (LocalFunctionDeclarationInstruction instruction : pseudocode.getLocalDeclarations()) {
|
||||
Pseudocode localPseudocode = instruction.getBody();
|
||||
data.put(localPseudocode.getCorrespondingElement(), localPseudocode);
|
||||
addDeclaration(data, bindingContext, declaration);
|
||||
|
||||
if (declaration instanceof JetDeclarationContainer) {
|
||||
for (JetDeclaration member : ((JetDeclarationContainer) declaration).getDeclarations()) {
|
||||
// Properties and initializers are processed elsewhere
|
||||
if (member instanceof JetNamedFunction) {
|
||||
addDeclaration(data, bindingContext, member);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +80,15 @@ public abstract class AbstractControlFlowTest extends KotlinTestWithEnvironment
|
||||
}
|
||||
}
|
||||
|
||||
private void addDeclaration(Map<JetElement, Pseudocode> data, BindingContext bindingContext, JetDeclaration declaration) {
|
||||
Pseudocode pseudocode = PseudocodeUtil.generatePseudocode(declaration, bindingContext);
|
||||
data.put(declaration, pseudocode);
|
||||
for (LocalFunctionDeclarationInstruction instruction : pseudocode.getLocalDeclarations()) {
|
||||
Pseudocode localPseudocode = instruction.getBody();
|
||||
data.put(localPseudocode.getCorrespondingElement(), localPseudocode);
|
||||
}
|
||||
}
|
||||
|
||||
private void processCFData(File file, Map<JetElement, Pseudocode> data) throws IOException {
|
||||
Collection<Pseudocode> pseudocodes = data.values();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user