Some fixes and added in globals
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
same_file: 5
|
||||
diff_file: 7
|
||||
diff_file: 13
|
||||
diff_file: 1337
|
||||
@@ -1,34 +0,0 @@
|
||||
import c_passthrough_diff
|
||||
|
||||
|
||||
__if_comp__ __C__ simple_passthrough """
|
||||
#include <stdio.h>
|
||||
int same = 5;
|
||||
"""
|
||||
|
||||
fun main(): int {
|
||||
|
||||
__if_comp__ __C__ simple_passthrough """
|
||||
printf("same_file: %d\n", same);
|
||||
"""
|
||||
|
||||
c_passthrough_diff::print_it();
|
||||
var i: int = 7;
|
||||
var j: int = 6;
|
||||
__if_comp__ __C__ simple_passthrough(i = i, j = j : j = j:) """
|
||||
j = i + j;
|
||||
"""
|
||||
c_passthrough_diff::print_it(j)
|
||||
|
||||
// test new shorthand for same name assignments
|
||||
var r: int = 1000;
|
||||
var s: int = 337;
|
||||
__if_comp__ __C__ simple_passthrough(r, s : s:) """
|
||||
s = r + s;
|
||||
"""
|
||||
c_passthrough_diff::print_it(s)
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
yeah new syntax: 7, 6
|
||||
yeah new syntax: 8, 8.000000
|
||||
@@ -1,20 +0,0 @@
|
||||
|
||||
fun withParams(a: int, b: float) : void {
|
||||
simple_passthrough(a = a, b = b::) """
|
||||
printf("yeah new syntax: %d, %f\n", a, b);
|
||||
"""
|
||||
}
|
||||
|
||||
|
||||
fun main() : int {
|
||||
var i: int = 7;
|
||||
var j: int = 6;
|
||||
simple_passthrough(i = i, j = j::) """
|
||||
printf("yeah new syntax: %d, %d\n", i, j);
|
||||
"""
|
||||
var a: int = 8
|
||||
var b: float = 8
|
||||
withParams(a,b)
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
yeah new syntax: 7, 6
|
||||
yeah new syntax: 6, 7
|
||||
yeah new syntax: 7, 6
|
||||
@@ -1,36 +0,0 @@
|
||||
|
||||
|
||||
obj Swapper<T> {
|
||||
fun doit(a: *T, b: *T) : void {
|
||||
var temp: T = *a;
|
||||
*a = *b;
|
||||
*b = temp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun swap<T>(a: *T, b: *T) : void {
|
||||
var temp: T = *a
|
||||
*a = *b
|
||||
*b = temp;
|
||||
}
|
||||
|
||||
fun print2int(a: int, b: int) : void {
|
||||
simple_passthrough(a = a, b = b::) """
|
||||
printf("yeah new syntax: %d, %d\n", a, b);
|
||||
"""
|
||||
}
|
||||
|
||||
|
||||
fun main() : int {
|
||||
var i: int = 7;
|
||||
var j: int = 6;
|
||||
print2int(i,j)
|
||||
swap<int>(&i, &j)
|
||||
print2int(i,j)
|
||||
var it: Swapper<int>
|
||||
it.doit(&i,&j);
|
||||
print2int(i,j)
|
||||
return 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user