The template part of the new syntax! Gotta go transform all of stdlib and the tests now and see if any other bugs pop up

This commit is contained in:
Nathan Braswell
2015-05-09 03:13:40 -04:00
parent 08431aa748
commit c22cadeed7
10 changed files with 94 additions and 93 deletions

View File

@@ -0,0 +1,36 @@
typedef 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
}