start adding set attribute support

This commit is contained in:
2025-09-17 17:24:50 +01:00
parent 4be8e8e32f
commit 3b0ec79955
10 changed files with 96 additions and 133 deletions

View File

@@ -8,25 +8,19 @@
size_t translate_access(Translated *translated, ParsedAccess *access,
ArErr *err) {
set_registers(translated, 1);
uint64_t first = translate_parsed(translated, &access->to_access, err);
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_LOAD_GETATTRIBUTE_METHOD);
push_instruction_byte(translated, OP_INIT_CALL);
push_instruction_code(translated, access->access.size+1);
push_instruction_byte(translated, OP_LOAD_BOOL);
push_instruction_byte(translated, access->access_fields);
push_instruction_code(translated, 1);
translate_parsed(translated, access->access, err);
if (err->exists)
return 0;
push_instruction_byte(translated, OP_INSERT_ARG);
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, 1 + i);
}
push_instruction_byte(translated, OP_SOURCE_LOCATION);
push_instruction_code(translated, access->line);
push_instruction_code(translated, access->column);