private static void Traverse(ITreeNode node, StringBuilder sb, int depth, CompletionTargetMarker marker) { if (node.IsWhitespaceToken()) { return; } sb.Indent(depth); sb.ObjectId(node, marker); sb.AppendLine(); foreach (var child in node.Children()) { if (Visited.Contains(child)) { sb.Indent(depth); sb.Append("--> "); sb.ObjectId(node, marker); sb.AppendLine(); } else { Visited.Add(child); Traverse(child, sb, depth + 1, marker); } } }
public static void Dump(ITreeNode node, CompletionTargetMarker marker = null) { var sb = new StringBuilder(); Traverse(node, sb, 0, marker); Console.WriteLine(sb.ToString()); Visited.Clear(); }
private static void PrintType(CSharpCodeCompletionContext context, CompletionTargetMarker marker) { for (var node = context.NodeInFile; node != null; node = node.Parent) { var type = node as ITypeDeclaration; if (type != null) { JetbrainsTreeDebugger.Dump(type, marker); return; } } }
public DeclarationVisitor(KaVELogger logger, ISet <IMethodName> entryPoints, CompletionTargetMarker marker, CancellationToken cancellationToken) { _logger = logger; _entryPoints = entryPoints; _marker = marker; _cancellationToken = cancellationToken; _initVisitor = new ExpressionVisitor(new UniqueVariableNameGenerator(), _marker); _cinitVisitor = new ExpressionVisitor(new UniqueVariableNameGenerator(), _marker); }
private static void ObjectId(this StringBuilder sb, object o, CompletionTargetMarker marker) { var isTarget = o == marker.AffectedNode; if (isTarget) { sb.Append("$$ "); } sb.Append(o.GetType().Name); sb.Append('@'); sb.Append(o.GetHashCode()); if (isTarget) { sb.Append(" $$"); } }
public ExpressionVisitor(UniqueVariableNameGenerator nameGen, CompletionTargetMarker marker) { _nameGen = nameGen; _marker = marker; }
public StatementVisitor(UniqueVariableNameGenerator nameGen, CompletionTargetMarker marker) { _marker = marker; _nameGen = nameGen; _exprVisitor = new ExpressionVisitor(_nameGen, marker); }