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;