From 313339c0cbd752dad1b83c6300ced5068bce01b7 Mon Sep 17 00:00:00 2001 From: nicosammito Date: Tue, 2 Jun 2026 18:20:15 +0200 Subject: [PATCH] feat: refactor return statement to assign function result to variable before returning --- src/utils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils.ts b/src/utils.ts index 890281b..2942141 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -155,7 +155,8 @@ export function generateFlowSourceCode( let code = `${indent}`; if (node.functionDefinition.identifier === "std::control::return") { - code += `return /* @pos ${id} null */ ${funcName}(${args.join(", ")})${needsAnyCast ? "" : ""} ;\n` + code += `const ${varName} = /* @pos ${id} null */ ${funcName}(${args.join(", ")})${needsAnyCast ? "" : ""} ;\n` + code += `return ${varName};\n` } else if (node.functionDefinition.identifier === "std::control::if") { code += `const ${varName} = /* @pos ${id} null */ ${funcName}(${args.join(", ")})${needsAnyCast ? "" : ""} ;\n` code += `if(${args[0]}) {