mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Fixed native function issues
This commit is contained in:
@@ -30,6 +30,18 @@ var tally = make();
|
||||
assert tally() == 1 && tally() == 2, "Closures failed";
|
||||
|
||||
|
||||
//test closures self-capture
|
||||
fn capture(count: int) {
|
||||
if (count > 5) {
|
||||
return count;
|
||||
}
|
||||
|
||||
return capture(count + 1);
|
||||
}
|
||||
|
||||
assert capture(0) == 5, "Self capture failed";
|
||||
|
||||
|
||||
//test expressions as arguments
|
||||
fn argFn() {
|
||||
return 42;
|
||||
|
||||
Reference in New Issue
Block a user