Optimization: Special case for simplying recursive let bindings codegen
This commit is contained in:
parent
6f89dfa1c5
commit
b0ccfc6309
5
ir.py
5
ir.py
|
@ -183,7 +183,10 @@ class LetBinding:
|
|||
|
||||
def codegen(self) -> str:
|
||||
rhs_cg = self.rhs.codegen_named(self.lhs) if isinstance(self.rhs, MonoFunc) else self.rhs.codegen()
|
||||
return f'({self.lhs}=>{self.body.codegen()})({rhs_cg})'
|
||||
if self.body == Variable(self.lhs):
|
||||
return rhs_cg
|
||||
else:
|
||||
return f'({self.lhs}=>{self.body.codegen()})({rhs_cg})'
|
||||
|
||||
@dataclass
|
||||
class Application:
|
||||
|
|
Loading…
Reference in a new issue