change how access is done and add built in array (need to optimise the size)

This commit is contained in:
William Bell
2025-09-09 06:24:23 +01:00
parent d46a6dc209
commit fc7cfc7cfb
22 changed files with 732 additions and 639 deletions

View File

@@ -8,22 +8,23 @@
size_t translate_access(Translated *translated, ParsedAccess *access,
ArErr *err) {
set_registers(translated, 1);
uint64_t first = push_instruction_byte(translated, OP_LOAD_ACCESS_FUNCTION);
uint64_t first = translate_parsed(translated, &access->to_access, err);
if (err->exists)
return 0;
push_instruction_byte(translated, OP_LOAD_GETATTRIBUTE_FUNCTION);
push_instruction_byte(translated, OP_INIT_CALL);
push_instruction_code(translated, access->access.size + 2);
translate_parsed(translated, &access->to_access, err);
push_instruction_byte(translated, OP_INSERT_ARG);
push_instruction_code(translated, 0);
push_instruction_code(translated, access->access.size+1);
push_instruction_byte(translated, OP_LOAD_BOOL);
push_instruction_byte(translated, access->access_fields);
push_instruction_byte(translated, OP_INSERT_ARG);
push_instruction_code(translated, 1);
push_instruction_code(translated, 0);
for (size_t i = 0; i < access->access.size; i++) {
translate_parsed(translated, darray_get(&access->access, i), err);
if (err->exists)
return 0;
push_instruction_byte(translated, OP_INSERT_ARG);
push_instruction_code(translated, 2+i);
push_instruction_code(translated, 1 + i);
}
push_instruction_byte(translated, OP_SOURCE_LOCATION);