work on method wrapper and native function support

This commit is contained in:
William Bell
2025-08-09 06:40:16 +01:00
parent 38e2cad507
commit 0635ba8517
23 changed files with 404 additions and 324 deletions

View File

@@ -12,12 +12,10 @@ ArErr runtime_declaration(Translated *translated, RuntimeState *state,
int64_t offset = pop_bytecode(translated, state);
int64_t prehash = pop_bytecode(translated, state);
int64_t from_register = pop_byte(translated, state);
int64_t source_location_index = pop_bytecode(translated, state);
uint64_t hash = runtime_hash(arena_get(&translated->constants, offset), length, prehash);
ArgonObject * exists = hashmap_lookup_GC(stack->scope, hash);
if (exists) {
SourceLocation *source_location = darray_get(&translated->source_locations, source_location_index);
return create_err(source_location->line, source_location->column, source_location->length, state->path, "Runtime Error", "Identifier '%.*s' has already been declared in the current scope", length, arena_get(&translated->constants, offset));
return create_err(state->source_location.line, state->source_location.column, state->source_location.length, state->path, "Runtime Error", "Identifier '%.*s' has already been declared in the current scope", length, arena_get(&translated->constants, offset));
}
ArgonObject * key = new_string_object(arena_get(&translated->constants, offset), length);
hashmap_insert_GC(stack->scope, hash, key, state->registers[from_register], 0);