Skip to content

Commit

Permalink
feat: rework identifiers map and handle duplicate source ids
Browse files Browse the repository at this point in the history
  • Loading branch information
Gusarich committed Oct 14, 2024
1 parent 23168ec commit f1b2c45
Show file tree
Hide file tree
Showing 9 changed files with 254 additions and 175 deletions.
8 changes: 4 additions & 4 deletions src/generator/writers/writeFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,10 +475,10 @@ export function writeStatement(
}
const ty = getType(ctx.ctx, t.name);
const ids = ty.fields.map((field) => {
const id = Array.from(f.identifiers.entries()).find(
([key, val]) => val.text !== "_" && key.text === field.name,
);
return id ? funcIdOf(id[1]) : "_";
const id = f.identifiers.get(field.name);
return id === undefined || isWildcard(id[1])
? "_"
: funcIdOf(id[1]);
});
ctx.append(
`var (${ids.join(", ")}) = ${writeCastedExpression(f.expression, t, ctx)};`,
Expand Down
Loading

0 comments on commit f1b2c45

Please sign in to comment.