Skip to content

Commit

Permalink
fix: only generate non-modifying native function once (#699)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gusarich authored Aug 16, 2024
1 parent a07f9d6 commit 14d3052
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Remainder fields in the middle of a struct are now forbidden: PR [#697](https://github.com/tact-lang/tact/pull/697)
- Defining two native functions from the same FunC function now does not fail compilation: PR [#699](https://github.com/tact-lang/tact/pull/699)

## [1.4.3] - 2024-08-16

Expand Down
3 changes: 2 additions & 1 deletion src/generator/writers/writeFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ export function writeFunction(f: FunctionDescription, ctx: WriterContext) {

// Do not write native functions
if (f.ast.kind === "native_function_decl") {
if (f.isMutating) {
if (f.isMutating && !ctx.isRendered(idText(f.ast.nativeName))) {
// Write same function in non-mutating form
const nonMutName = ops.nonModifying(idText(f.ast.nativeName));
ctx.fun(nonMutName, () => {
Expand All @@ -544,6 +544,7 @@ export function writeFunction(f: FunctionDescription, ctx: WriterContext) {
);
});
});
ctx.markRendered(idText(f.ast.nativeName));
}
return;
}
Expand Down

0 comments on commit 14d3052

Please sign in to comment.