diff --git a/lang/compile.py b/lang/compile.py index 0d6ff1d..c386064 100755 --- a/lang/compile.py +++ b/lang/compile.py @@ -349,7 +349,8 @@ new_ir = [] new_ir.append(IRDepthCheck(1)) var_count = len(variables) - 1 # Ignore Return - new_ir.append(IRAllocate(var_count)) + if var_count != 0: + new_ir.append(IRAllocate(var_count)) for node in ir: if isinstance(node, IRLoad): reg = variables[node.variable] @@ -364,7 +365,8 @@ new_ir.append(IRDepthCheck(var_count + 2)) continue elif isinstance(node, IRReturn): - new_ir.append(IRDrop(var_count)) + if var_count != 0: + new_ir.append(IRDrop(var_count)) new_ir.append(IRReturn()) else: new_ir.append(node) diff --git a/lang/modules/main.txt b/lang/modules/main.txt index dff66fa..c2bad56 100644 --- a/lang/modules/main.txt +++ b/lang/modules/main.txt @@ -1,6 +1,5 @@ Function GetHalfish -Set Half To 618 -Return Half +Return 618 EndFunction Function MakeNumber Set Halfish To Self GetHalfish