tests for local variables
This commit is contained in:
committed by
Vasily Levchenko
parent
8de943bb8a
commit
4078e4004c
@@ -153,6 +153,10 @@ task sum_3const(type: UnitKonanTest) {
|
|||||||
source = "codegen/function/sum_3const.kt"
|
source = "codegen/function/sum_3const.kt"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task local_variable(type: UnitKonanTest) {
|
||||||
|
source = "codegen/basics/local_variable.kt"
|
||||||
|
}
|
||||||
|
|
||||||
//task hello0(type: RunKonanTest) {
|
//task hello0(type: RunKonanTest) {
|
||||||
// source = "runtime/basic/hello0.kt"
|
// source = "runtime/basic/hello0.kt"
|
||||||
//}
|
//}
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
extern void *resolve_symbol(const char*);
|
||||||
|
|
||||||
|
int
|
||||||
|
run_test() {
|
||||||
|
int (*local_variable)(int) = resolve_symbol("kfun:local_variable");
|
||||||
|
|
||||||
|
if (local_variable(3) != 14) return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
fun local_variable(a: Int) : Int {
|
||||||
|
var b = 0
|
||||||
|
b = a + 11
|
||||||
|
return b
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user