public static string V(ICode c) { var method = c.Ctx.MRef; StringBuilder sb = new StringBuilder(); sb.Append(method.FullName); var seen = new HashSet <ICode>() { c }; var todo = new Queue <Stmt>(); todo.Enqueue((Stmt)c); while (todo.Any()) { var cBlock = todo.Dequeue(); var v = new ShowVisitor(); v.Visit(cBlock); sb.AppendLine(); sb.Append(GetStmtName(cBlock) + ":"); sb.Append(v.Code); foreach (var continuation in v.Continuations) { if (seen.Add(continuation.To)) { todo.Enqueue(continuation.To); } } } sb.AppendLine(); sb.Append("}"); return(sb.ToString()); }
public static string V(ICode c) { var method = c.Ctx.MRef; StringBuilder sb = new StringBuilder(); sb.Append(method.FullName); var seen = new HashSet<ICode>() { c }; var todo = new Queue<Stmt>(); todo.Enqueue((Stmt)c); while (todo.Any()) { var cBlock = todo.Dequeue(); var v = new ShowVisitor(); v.Visit(cBlock); sb.AppendLine(); sb.Append(GetStmtName(cBlock) + ":"); sb.Append(v.Code); foreach (var continuation in v.Continuations) { if (seen.Add(continuation.To)) { todo.Enqueue(continuation.To); } } } sb.AppendLine(); sb.Append("}"); return sb.ToString(); }