mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Fixed an argument list bug, found a casting bug
This commit is contained in:
12
scripts/fib.toy
Normal file
12
scripts/fib.toy
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
fn fib(n : int) {
|
||||||
|
if (n < 2) {
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fib(n-1) + fib(n-2);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < 40; i++) {
|
||||||
|
var res = fib(i);
|
||||||
|
print (string)i + ": " + (string)res;
|
||||||
|
}
|
||||||
@@ -1450,6 +1450,13 @@ static bool execFnCall(Interpreter* interpreter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Literal arg = popLiteralArray(&arguments);
|
Literal arg = popLiteralArray(&arguments);
|
||||||
|
|
||||||
|
if (IS_IDENTIFIER(arg)) {
|
||||||
|
Literal idn = arg;
|
||||||
|
parseIdentifierToValue(interpreter, &arg);
|
||||||
|
freeLiteral(idn);
|
||||||
|
}
|
||||||
|
|
||||||
if (!setScopeVariable(inner.scope, paramArray->literals[i], arg, false)) {
|
if (!setScopeVariable(inner.scope, paramArray->literals[i], arg, false)) {
|
||||||
printf(ERROR "[internal] Could not define parameter (bad type?)\n" RESET);
|
printf(ERROR "[internal] Could not define parameter (bad type?)\n" RESET);
|
||||||
//free, and skip out
|
//free, and skip out
|
||||||
|
|||||||
Reference in New Issue
Block a user