Skip to content

Commit

Permalink
fix: remove excessive NULL from dict delete get operations in tact st…
Browse files Browse the repository at this point in the history
…dlib
  • Loading branch information
Gusarich committed Oct 26, 2024
1 parent e46239e commit 528df58
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/generator/writers/writeStdlib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,15 @@ export function writeStdlib(ctx: WriterContext) {
`(cell, (slice, int)) __tact_dict_delete_get(cell dict, int key_len, slice index)`,
);
ctx.context("stdlib");
ctx.asm("(index dict key_len)", "DICTDELGET NULLSWAPIFNOT2");
ctx.asm("(index dict key_len)", "DICTDELGET NULLSWAPIFNOT");
});

ctx.fun("__tact_dict_delete_get_ref", () => {
ctx.signature(
`(cell, (cell, int)) __tact_dict_delete_get_ref(cell dict, int key_len, slice index)`,
);
ctx.context("stdlib");
ctx.asm("(index dict key_len)", "DICTDELGETREF NULLSWAPIFNOT2");
ctx.asm("(index dict key_len)", "DICTDELGETREF NULLSWAPIFNOT");
});

ctx.fun("__tact_dict_get_ref", () => {
Expand Down Expand Up @@ -1389,6 +1389,8 @@ export function writeStdlib(ctx: WriterContext) {
ctx.body(() => {
ctx.write(`
var (old, ok) = null?(v) ? d~${ctx.used(`__tact_dict_delete_get`)}(kl, k) : d~dict_replaceget?(kl, k, begin_cell().store_int(v, vl).end_cell().begin_parse());
~dump([old, ok]);
dump_stack();
return (d, ok ? old~load_int(vl) : null());
`);
});
Expand Down

0 comments on commit 528df58

Please sign in to comment.