public static void VisitAnonimClass(SyntaxNode node) { if (instance == null) { instance = new AnonymousVisitor(); } instance.Visit(node); }
/// <summary> /// Node's line informations will be collected. /// </summary> /// <param name="node"></param> public static void CollectLineInfos(SyntaxNode node) { if (node.Kind() != SyntaxKind.DelegateDeclaration && MainDeclaration.Instance.MethodStack.Count == 0) { InsertLLOCMap(node.GetLocation()); } if (node.Parent != null && (node is BaseMethodDeclarationSyntax || node.Parent.Parent is BasePropertyDeclarationSyntax || node is AnonymousFunctionExpressionSyntax)) { StatementVisitor.VisitStatement(node); } else if (node.Kind() == SyntaxKind.AnonymousObjectCreationExpression || node.Kind() == SyntaxKind.AnonymousObjectMemberDeclarator) { AnonymousVisitor.VisitAnonimClass(node); } else if (node.Kind() == SyntaxKind.EnumDeclaration) { EnumVisitor.VisitEnum(node); } else if (node is TypeDeclarationSyntax) { TypeVisitor.VisitType(node); } else if (node.Kind() == SyntaxKind.NamespaceDeclaration) { NamespaceDeclarationSyntax ns = node as NamespaceDeclarationSyntax; InsertLLOCMap(ns.OpenBraceToken.GetLocation()); } else if (node.Kind( ) == SyntaxKind.DelegateDeclaration) { var localNode = node as DelegateDeclarationSyntax; InsertLLOCMap(localNode.GetLocation()); foreach (var modifier in localNode.Modifiers) { InsertLLOCMap(modifier.GetLocation()); } foreach (var attributeListSyntax in localNode.AttributeLists) { InsertLLOCMap(attributeListSyntax.GetLocation()); } foreach (var typeParameterConstraintClauseSyntax in localNode.ConstraintClauses) { InsertLLOCMap(typeParameterConstraintClauseSyntax.GetLocation()); } foreach (var parameterSyntax in localNode.ParameterList.Parameters) { InsertLLOCMap(parameterSyntax.GetLocation()); } } }