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