Fix bug: Recursion shares a single variable between all stack frames when compiling to JS

This commit is contained in:
Emi Simpson 2024-03-16 09:18:41 -04:00
parent 2238d363e5
commit 79deebabf4
Signed by: Emi
GPG Key ID: A12F2C2FFDC3D847
1 changed files with 1 additions and 1 deletions

2
ir.py
View File

@ -162,7 +162,7 @@ class LetBinding:
def codegen(self) -> str:
rhs_cg = self.rhs.codegen_named(self.lhs) if isinstance(self.rhs, Function) else self.rhs.codegen()
return f'({self.lhs}={rhs_cg},{self.body.codegen()})'
return f'({self.lhs}=>{self.body.codegen()})({rhs_cg})'
@dataclass
class Application: