kym-tables-overhaul #30

Merged
kayomn merged 12 commits from kym-tables-overhaul into main 2023-08-12 15:20:18 +02:00
1 changed files with 4 additions and 4 deletions
Showing only changes of commit 4ee0bcab67 - Show all commits

View File

@ -378,6 +378,10 @@ fn execute(self: *Self, env: *kym.RuntimeEnv) kym.RuntimeError!?*kym.RuntimeRef
}, },
.set_dynamic => { .set_dynamic => {
const value_ref = try env.pop_local();
defer env.discard(value_ref);
const index_ref = try env.pop_local() orelse { const index_ref = try env.pop_local() orelse {
return env.raise(error.TypeMismatch, "nil is not a valid index"); return env.raise(error.TypeMismatch, "nil is not a valid index");
}; };
@ -390,10 +394,6 @@ fn execute(self: *Self, env: *kym.RuntimeEnv) kym.RuntimeError!?*kym.RuntimeRef
defer env.discard(indexable_ref); defer env.discard(indexable_ref);
const value_ref = try env.pop_local();
defer env.discard(value_ref);
try env.set_dynamic(try kym.unbox_dynamic(env, indexable_ref), index_ref, value_ref); try env.set_dynamic(try kym.unbox_dynamic(env, indexable_ref), index_ref, value_ref);
}, },