public static string WriteCode(CilMethodInterpreter interpreter, TypeDescriptionTable typeTable, ClosureEntities crRuntime) { var operations = interpreter.MidRepresentation.LocalOperations; var headerSb = new StringBuilder(); var sb = CppWriteSignature.WriteSignature(interpreter, crRuntime); headerSb.Append(sb); headerSb.Append("{"); var bodySb = ComputeBodySb(operations, interpreter.MidRepresentation.Vars, typeTable, interpreter, crRuntime); var variablesSb = ComputeVariableSb(interpreter.MidRepresentation, interpreter, crRuntime); var finalSb = new StringBuilder(); finalSb.AppendLine(headerSb.ToString()); finalSb.AppendLine(variablesSb.ToString()); finalSb.AppendLine(bodySb.ToString()); return(finalSb.ToString()); }
public static string WriteCode(CilMethodInterpreter interpreter, TypeDescriptionTable typeTable, ClosureEntities crRuntime) { var operations = interpreter.MidRepresentation.LocalOperations; var headerSb = new CodeOutput(); CppWriteSignature.WriteSignature(headerSb, interpreter, crRuntime); var bodySb = ComputeBodySb(operations, interpreter.MidRepresentation.Vars, typeTable, interpreter, crRuntime); var variablesSb = ComputeVariableSb(interpreter.MidRepresentation, interpreter, crRuntime); var finalSb = new CodeOutput(); finalSb.Append(headerSb.ToString()) .BracketOpen() .Append(variablesSb.ToString()) .Append(bodySb.ToString()) .BracketClose(); return(finalSb.ToString()); }