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

@@ -109,6 +109,7 @@ resets the arguments buffer to NULL
call a function with args
1. the register containing the function to call. (*)
4. the index of the source location.
## OP_SWAP_REGISTERS

View File

@@ -22,6 +22,12 @@ size_t translate_parsed_call(Translated *translated, ParsedCall* call, ArErr *er
return first;
push_instruction_byte(translated, OP_CALL);
push_instruction_byte(translated, 0);
push_instruction_byte(translated, OP_RESET_ARGS);
SourceLocation source_locations = {
call->line,
call->column,
1
};
push_instruction_code(translated, translated->source_locations.size);
darray_push(&translated->source_locations, &source_locations);
return first;
}