tests for local variables

This commit is contained in:
Konstantin Anisimov
2016-11-03 16:13:46 +03:00
committed by Vasily Levchenko
parent 8de943bb8a
commit 4078e4004c
3 changed files with 19 additions and 0 deletions
+4
View File
@@ -153,6 +153,10 @@ task sum_3const(type: UnitKonanTest) {
source = "codegen/function/sum_3const.kt"
}
task local_variable(type: UnitKonanTest) {
source = "codegen/basics/local_variable.kt"
}
//task hello0(type: RunKonanTest) {
// 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
}