public override void VisitClassDeclaration(ClassDeclarationSyntax node) { var clsname = node.Identifier.ToString(); var nl = OurLine.NewLine(LineKind.Decl, "ClassDeclaration"); OurLine.AddEssentialInfo(ref nl, "name:" + clsname); if (node.BaseList != null) { var baseTypes = node.BaseList.Types.ToString(); //.Select((t) => t.Type.Identifier.Text.ToString()).Join(", "); if (debug) { System.Console.WriteLine(baseTypes); } OurLine.AddEssentialInfo(ref nl, "basetypes:" + baseTypes); } // nl.Source = node.ToFullString(); // currentClass = node; var modifiers = node.Modifiers; OurLine.AddExtraInfo(ref nl, "modifiers:" + modifiers.ToString()); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); StartBlock("ClassDeclaration"); base.VisitClassDeclaration(node); EndBlock("ClassDeclaration"); }
public override void VisitAccessorDeclaration(AccessorDeclarationSyntax node) { if (debug) { Console.WriteLine(node.ToFullString()); } var nl = OurLine.NewLine(LineKind.Decl, "AccessorDeclaration"); var stms = node?.Body?.Statements.Select((x) => x.ToString()); OurLine.AddEssentialInfo(ref nl, "keyword:" + node.Keyword.Text); if (stms != null) { var statements = string.Join("###", stms); OurLine.AddEssentialInfo(ref nl, "statements:" + statements); } OurLine.AddEssentialInfo(ref nl, "modifiers:" + node.Modifiers.ToString()); OurLine.AddEssentialInfo(ref nl, "expressionBody:" + node.ExpressionBody?.ToString() ?? ""); nl.Source = node.ToFullString(); // nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); StartBlock("AccessorDeclaration"); base.VisitAccessorDeclaration(node); EndBlock("AccessorDeclaration"); }
public override void VisitTryStatement(TryStatementSyntax node) { if (debug) { Console.WriteLine(node.ToFullString()); } var nl = OurLine.NewLine(LineKind.Decl, "TryStatement"); if (node.Finally != null) { OurLine.AddEssentialInfo(ref nl, "finally:" + node.Finally.ToString()); } if (node.Catches != null) { OurLine.AddEssentialInfo(ref nl, "catches:" + node.Catches.ToString()); } // we get the details later on. nl.Source = node.ToFullString(); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); StartBlock("TryStatement"); base.VisitTryStatement(node); EndBlock("TryStatement"); }
public override void VisitIfStatement(IfStatementSyntax node) { if (debug) { Console.WriteLine(node.ToFullString()); } var nl = OurLine.NewLine(LineKind.Decl, "IfStatement"); // condition, statement, else.statement nl.Source = node.ToFullString(); OurLine.AddEssentialInfo(ref nl, "condition:" + node.Condition.ToString()); OurLine.AddEssentialInfo(ref nl, "statement:" + node.Statement.ToString()); var elsey = node.Else?.Statement; if (elsey != null) { OurLine.AddEssentialInfo(ref nl, "else:" + elsey.ToString()); } nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); StartBlock("IfStatement"); base.VisitIfStatement(node); EndBlock("IfStatement"); }
public override void VisitArgumentList(ArgumentListSyntax node) { var args = node.Arguments.ToString(); var nl = OurLine.NewLine(LineKind.Decl, "ArgumentList"); OurLine.AddEssentialInfo(ref nl, "arguments:" + args); nl.Source = node.ToFullString(); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); base.VisitArgumentList(node); }
public override void VisitLiteralExpression(LiteralExpressionSyntax node) { var token = node.Token.ToString(); var nl = OurLine.NewLine(LineKind.Decl, "LiteralExpression"); OurLine.AddEssentialInfo(ref nl, "token:" + token); nl.Source = node.ToFullString(); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); base.VisitLiteralExpression(node); }
public override void VisitQualifiedName(QualifiedNameSyntax node) { var text = node.ToString(); var nl = OurLine.NewLine(LineKind.Decl, "QualifiedName"); OurLine.AddEssentialInfo(ref nl, "name:" + text); // nl.Source = node.ToFullString(); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); base.VisitQualifiedName(node); }
// string currentBlock = ""; public void StartBlock(string desc) { blockCount++; // currentBlock = desc; var nl = OurLine.NewLine(LineKind.Decl, "BlockStarts"); OurLine.AddEssentialInfo(ref nl, blockCount.ToString()); if (desc != "") { OurLine.AddExtraInfo(ref nl, desc); } LogCommand(nl); }
public override void VisitBaseList(BaseListSyntax node) { if (debug) { Console.WriteLine(node.ToFullString()); } var nl = OurLine.NewLine(LineKind.Decl, "BaseList"); nl.Source = node.ToFullString(); OurLine.AddEssentialInfo(ref nl, node.Types.ToString()); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); base.VisitBaseList(node); }
public override void VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax node) { if (debug) { Console.WriteLine(node.ToFullString()); } Todo("AnonymousMethodExpression"); var nl = OurLine.NewLine(LineKind.Decl, "AnonymousMethodExpression"); nl.Source = node.ToFullString(); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); StartBlock("AnonymousMethodExpression"); base.VisitAnonymousMethodExpression(node); EndBlock("AnonymousMethodExpression"); }
// TODO: well, we probably have the same info later on, with MemberAccessExpression etc. public override void VisitInvocationExpression(InvocationExpressionSyntax node) { var expr = node.Expression; // var argList = node.ArgumentList; var nl = OurLine.NewLine(LineKind.Decl, "InvocationExpression"); OurLine.AddEssentialInfo(ref nl, "expression:" + expr.ToString()); nl.Source = node.ToFullString(); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); base.VisitInvocationExpression(node); }
public override void VisitForEachStatement(ForEachStatementSyntax node) { if (debug) { Console.WriteLine(node.ToFullString()); } Todo("ForEachStatement"); var nl = OurLine.NewLine(LineKind.Decl, "ForEachStatement"); nl.Source = node.ToFullString(); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); StartBlock("ForEachStatement"); base.VisitForEachStatement(node); EndBlock("ForEachStatement"); }
// TODO(mostused) public override void VisitExpressionStatement(ExpressionStatementSyntax node) { if (debug) { Console.WriteLine(node.ToFullString()); } var nl = OurLine.NewLine(LineKind.Decl, "ExpressionStatement"); nl.Source = node.ToFullString(); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); base.VisitExpressionStatement(node); }
public override void VisitVariableDeclaration(VariableDeclarationSyntax node) { var t = node.Type.ToString(); var vars = node.Variables; var varName = vars[0].Identifier.ToString(); var nl = OurLine.NewLine(LineKind.Decl, "VariableDeclaration"); OurLine.AddEssentialInfo(ref nl, "type:" + t); OurLine.AddEssentialInfo(ref nl, "name:" + varName); nl.Source = node.ToFullString(); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); base.VisitVariableDeclaration(node); }
public override void VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node) { if (debug) { Console.WriteLine(node.ToFullString()); } Todo("ConversionOperatorDeclaration"); var nl = OurLine.NewLine(LineKind.Decl, "ConversionOperatorDeclaration"); nl.Source = node.ToFullString(); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); StartBlock("ConversionOperatorDeclaration"); base.VisitConversionOperatorDeclaration(node); EndBlock("ConversionOperatorDeclaration"); }
public override void VisitIdentifierName(IdentifierNameSyntax node) { if (debug) { Console.WriteLine(node.ToFullString()); } var nl = OurLine.NewLine(LineKind.Decl, "IdentifierName"); nl.Source = node.ToFullString(); OurLine.AddEssentialInfo(ref nl, "name:" + node.Identifier.ToString()); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); base.VisitIdentifierName(node); }
public override void VisitCatchClause(CatchClauseSyntax node) { if (debug) { Console.WriteLine(node.ToFullString()); } var nl = OurLine.NewLine(LineKind.Decl, "CatchClause"); nl.Source = node.ToFullString(); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); StartBlock("CatchClause"); base.VisitCatchClause(node); EndBlock("CatchClause"); }
public override void VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) { var name = node.Name.ToString(); // currentNamespace = null; var nl = OurLine.NewLine(LineKind.Decl, "NamespaceDeclaration"); OurLine.AddEssentialInfo(ref nl, "name:" + name); // nl.Source = node.ToFullString(); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); // currentNamespace = node; StartBlock("NamespaceDeclaration"); // worked wonderfully! base.VisitNamespaceDeclaration(node); EndBlock("NamespaceDeclaration"); // god is good! }
public override void VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax node) { if (debug) { Console.WriteLine(node.ToFullString()); } var nl = OurLine.NewLine(LineKind.Decl, "ExplicitInterfaceSpecifier"); OurLine.AddEssentialInfo(ref nl, "name:" + node.Name.ToString().TrimEnd('.')); // System.Console.WriteLine(node.Name.ToString()); nl.Source = node.ToFullString(); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); base.VisitExplicitInterfaceSpecifier(node); }
public override void VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) { if (debug) { Console.WriteLine(node.ToFullString()); } var nl = OurLine.NewLine(LineKind.Decl, "ObjectCreationExpression"); OurLine.AddEssentialInfo(ref nl, "type:" + node.Type.ToString()); // # the rest come later. (i think) nl.Source = node.ToFullString(); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); base.VisitObjectCreationExpression(node); }
public override void VisitParameter(ParameterSyntax node) { var nl = OurLine.NewLine(LineKind.Decl, "Parameter"); OurLine.AddEssentialInfo(ref nl, "name:" + node.Identifier.Text); OurLine.AddEssentialInfo(ref nl, "type:" + node.Type?.GetText().ToString()); if (node.Modifiers.Count > 0) { OurLine.AddExtraInfo(ref nl, "modifiers:" + node.Modifiers.ToString()); } nl.Source = node.ToFullString(); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); base.VisitParameter(node); }
public override void VisitPredefinedType(PredefinedTypeSyntax node) { if (debug) { Console.WriteLine(node.ToFullString()); } var nl = OurLine.NewLine(LineKind.Decl, "PredefinedType"); OurLine.AddEssentialInfo(ref nl, "keyword:" + node.Keyword.ToString()); nl.Source = node.ToFullString(); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); base.VisitPredefinedType(node); }
public override void VisitCastExpression(CastExpressionSyntax node) { if (debug) { Console.WriteLine(node.ToFullString()); } // Todo("CastExpression"); var nl = OurLine.NewLine(LineKind.Decl, "CastExpression"); nl.Source = node.ToFullString(); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; OurLine.AddEssentialInfo(ref nl, "type:" + node.Type.ToString()); OurLine.AddEssentialInfo(ref nl, "expr:" + node.Expression.ToString()); LogCommand(nl); base.VisitCastExpression(node); }
public override void VisitConstructorDeclaration(ConstructorDeclarationSyntax node) { if (debug) { Console.WriteLine(node.ToFullString()); } var nl = OurLine.NewLine(LineKind.Decl, "ConstructorDeclaration"); nl.Source = node.ToFullString(); OurLine.AddEssentialInfo(ref nl, "name:" + node.Identifier.Text); OurLine.AddEssentialInfo(ref nl, "modifiers:" + node.Modifiers.ToString()); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); StartBlock("ConstructorDeclaration"); base.VisitConstructorDeclaration(node); EndBlock("ConstructorDeclaration"); }
public override void VisitConditionalExpression(ConditionalExpressionSyntax node) { if (debug) { Console.WriteLine(node.ToFullString()); } // Todo("ConditionalExpression"); var nl = OurLine.NewLine(LineKind.Decl, "ConditionalExpression"); OurLine.AddEssentialInfo(ref nl, "condition:" + node.Condition.ToString()); OurLine.AddEssentialInfo(ref nl, "whentrue:" + node.WhenTrue.ToString()); OurLine.AddEssentialInfo(ref nl, "whenfalse:" + node.WhenFalse.ToString()); nl.Source = node.ToFullString(); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); base.VisitConditionalExpression(node); }
// TODO(mostused) public override void VisitAssignmentExpression(AssignmentExpressionSyntax node) { if (debug) { Console.WriteLine(node.ToFullString()); } var nl = OurLine.NewLine(LineKind.Decl, "AssignmentExpression"); OurLine.AddEssentialInfo(ref nl, "left:" + node.Left.ToString()); OurLine.AddEssentialInfo(ref nl, "op:" + node.OperatorToken.ToString()); OurLine.AddEssentialInfo(ref nl, "right:" + node.Right.ToString()); nl.Source = node.ToFullString(); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); base.VisitAssignmentExpression(node); }
public override void VisitFieldDeclaration(FieldDeclarationSyntax node) { if (debug) { Console.WriteLine(node.ToFullString()); } var nl = OurLine.NewLine(LineKind.Decl, "FieldDeclaration"); OurLine.AddEssentialInfo(ref nl, "modifiers:" + node.Modifiers.ToString()); OurLine.AddEssentialInfo(ref nl, "type:" + node.Declaration.Type.ToString()); OurLine.AddEssentialInfo(ref nl, "variables:" + node.Declaration.Variables.ToString()); nl.Source = node.ToFullString(); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); base.VisitFieldDeclaration(node); }
public override void VisitGenericName(GenericNameSyntax node) { if (debug) { Console.WriteLine(node.ToFullString()); } var nl = OurLine.NewLine(LineKind.Decl, "GenericName"); nl.Source = node.ToFullString(); OurLine.AddEssentialInfo(ref nl, "arity:" + node.Arity.ToString()); OurLine.AddEssentialInfo(ref nl, "identifier:" + node.Identifier.ToString()); OurLine.AddEssentialInfo(ref nl, "typeArgumentList:" + node.TypeArgumentList.ToString()); OurLine.AddEssentialInfo(ref nl, "typeArgumentListArgs:" + node.TypeArgumentList.Arguments.ToString()); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); base.VisitGenericName(node); }
public override void VisitUsingDirective(UsingDirectiveSyntax node) { var name = node.Name.ToString(); if (debug) { Console.WriteLine(node.ToFullString()); } var nl = OurLine.NewLine(LineKind.Decl, "UsingDirective"); OurLine.AddEssentialInfo(ref nl, "name:" + name); OurLine.AddEssentialInfo(ref nl, "staticKeyword:" + node.StaticKeyword.Text); nl.Source = node.ToFullString(); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); // System.Console.WriteLine("info: " + nodeContent); base.VisitUsingDirective(node); }
// TODO(mostused) public override void VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) { if (debug) { Console.WriteLine(node.ToFullString()); } var nl = OurLine.NewLine(LineKind.Decl, "LocalDeclarationStatement"); var typ = node.Declaration.Type.ToString(); var names = node.Declaration.Variables.Select((x) => x.Identifier.Text).ToList(); // left hand side comes later. OurLine.AddEssentialInfo(ref nl, "names:" + string.Join(", ", names)); OurLine.AddEssentialInfo(ref nl, "type:" + typ); nl.Source = node.ToFullString(); nl.ParentKind = node.Parent.RawKind; nl.RawKind = node.RawKind; LogCommand(nl); base.VisitLocalDeclarationStatement(node); }