From 66155fa213b47e9205f697376b3476078bfd9c53 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Fri, 10 Apr 2026 16:19:03 +1000 Subject: [PATCH] Tweak, but I need a decompiler now --- scripts/hello_world.toy | 22 ++++++++++++++++++---- source/toy_compiler.c | 2 +- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/scripts/hello_world.toy b/scripts/hello_world.toy index 30471b6..4b018ae 100644 --- a/scripts/hello_world.toy +++ b/scripts/hello_world.toy @@ -1,6 +1,20 @@ -print "Hello world"; -var answer = 42; -var question = 69; -print answer + question; \ No newline at end of file +/* +{ + fn hello() { + print "Hello world"; + } + hello(); +} +*/ + +{ + fn hello(arg) { + print arg; + } + + hello("world"); +} + + diff --git a/source/toy_compiler.c b/source/toy_compiler.c index ff8aedf..3caf966 100644 --- a/source/toy_compiler.c +++ b/source/toy_compiler.c @@ -209,7 +209,7 @@ static unsigned int emitParameters(Toy_Bytecode* mb, Toy_Ast* ast) { //emit to the param index EMIT_INT(&mb, param, dataAddr); - EMIT_INT(&mb, param, TOY_VALUE_UNKNOWN); //TODO: encode function parameter types properly + EMIT_INT(&mb, param, ast->value.value.type); //this returns the number of written parameters return 1;