mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Fixed chained functions, resolved #52
This commit is contained in:
30
test/scripts/function-within-function-bugfix.toy
Normal file
30
test/scripts/function-within-function-bugfix.toy
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
fn a() {
|
||||
fn b() {
|
||||
return 42;
|
||||
}
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
assert a()() == 42, "function within function failed";
|
||||
}
|
||||
|
||||
{
|
||||
fn a() {
|
||||
fn b() {
|
||||
fn c() {
|
||||
return 42;
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
assert a()()() == 42, "function within function within function failed";
|
||||
}
|
||||
|
||||
|
||||
print "All good";
|
||||
Reference in New Issue
Block a user