add function calling

This commit is contained in:
William Bell
2025-08-04 23:31:25 +01:00
parent 6c05eff6a4
commit a8acafffe9
13 changed files with 177 additions and 2185037 deletions

View File

@@ -22,6 +22,7 @@ void load_argon_function(Translated *translated, RuntimeState *state,
uint64_t offset = pop_bytecode(translated, state);
uint64_t length = pop_bytecode(translated, state);
add_field(object, "__name__", new_string_object(arena_get(&translated->constants, offset), length));
object->value.argon_fn.path = translated->path;
object->value.argon_fn.number_of_parameters = pop_bytecode(translated, state);
object->value.argon_fn.parameters =
ar_alloc(object->value.argon_fn.number_of_parameters * sizeof(struct string_struct));
@@ -35,6 +36,6 @@ void load_argon_function(Translated *translated, RuntimeState *state,
length = pop_bytecode(translated, state);
object->value.argon_fn.bytecode = arena_get(&translated->constants, offset);
object->value.argon_fn.bytecode_length = length;
object->value.argon_fn.stack = *stack;
object->value.argon_fn.stack = stack;
state->registers[0]=object;
}