private void GenerateLocalExpression(Lifter.IR.LocalExpression local_expr) { if (local_expr.Referenced > 1) { builder.Append(local_expr.ToString()); return; } GenerateExpression(local_expr.expression); }
private void GenerateAssign(Lifter.IR.Assign assign) { Lifter.IR.LocalExpression l = ((Lifter.IR.LocalExpression)assign.value); if (l.expression is Lifter.IR.Function) { builder.Append("function "); GenerateExpression(assign.variable); builder.Append("("); Lifter.IR.Function f = ((Lifter.IR.Function)l.expression); for (int i = 0; i < f.args.Count; ++i) { GenerateExpression(f.args[i]); if (f.args.Count - 1 != i) { builder.Append(", "); } } builder.Append(")\n"); indentation++; GenerateBlock(f.body); indentation--; builder.Append("end\n"); return; } GenerateExpression(assign.variable); builder.Append(" = "); GenerateExpression(assign.value); }