public List <SyntaxNode> GetSyntaxNodesFromClass(ClassDeclarationSyntax node, TaggedSyntaxLibrary lib) { List <SyntaxNode> nodes = new List <SyntaxNode>(); INamedTypeSymbol classSymbol = this.symbolHelper.GetSymbol(node) as INamedTypeSymbol; if (classSymbol != null) { List <ISymbol> symbols = new List <ISymbol>(); INamedTypeSymbol baseType = classSymbol.BaseType; if (baseType != null) { symbols.Add(baseType); } ImmutableArray <INamedTypeSymbol> interfaces = classSymbol.Interfaces; if (interfaces != null && interfaces.Count() > 0) { foreach (INamedTypeSymbol inter in interfaces) { if (inter != null) { symbols.Add(inter); } } } // check for override methods List <IMethodSymbol> oMethods = this.getOverrideMethodSymbolsFromClass(node); if (oMethods != null && oMethods.Count() > 0) { foreach (IMethodSymbol oMethod in oMethods) { IMethodSymbol overridden = oMethod.OverriddenMethod; if (overridden != null) { List <SyntaxNode> oNodes = ScriptAnalyzerResourceHelper.GetSyntaxNodesFromSymbol(overridden); if (oNodes != null && oNodes.Count() > 0) { MethodDeclarationSyntax oNode = oNodes.First() as MethodDeclarationSyntax; if (oNode != null) { TaggedSyntaxTree tTree = lib.GetTreeFromNode(oNode); if (tTree != null && tTree.IsTagged(oNode)) { symbols.Add(oMethod); } } } } } } nodes = ScriptAnalyzerResourceHelper.GetSyntaxNodesFromSymbols(symbols); } return(nodes); }
public List <SyntaxNode> GetSyntaxNodesFromObjectCreation(ObjectCreationExpressionSyntax node) { List <SyntaxNode> nodes = new List <SyntaxNode>(); ISymbol symbol = this.SymbolHelper.GetSymbolInfo(node).Symbol; if (symbol != null) { nodes = ScriptAnalyzerResourceHelper.GetSyntaxNodesFromSymbol(symbol); } return(nodes); }
public List <SyntaxNode> GetSyntaxNodesFromIdentifier(IdentifierNameSyntax node) { List <SyntaxNode> nodes = new List <SyntaxNode>(); ISymbol symbol = this.SymbolHelper.GetSymbolInfo(node).Symbol; if (symbol != null) { nodes = ScriptAnalyzerResourceHelper.GetSyntaxNodesFromSymbol(symbol); } return(nodes); }
public List <SyntaxNode> GetSyntaxNodesFromConstructorInitializer(ConstructorInitializerSyntax node) { List <SyntaxNode> nodes = new List <SyntaxNode>(); ISymbol symbol = this.symbolHelper.GetSymbolInfo(node).Symbol; if (symbol != null) { nodes = ScriptAnalyzerResourceHelper.GetSyntaxNodesFromSymbol(symbol); } return(nodes); }
public static List <SyntaxNode> GetSyntaxNodesFromSymbols(List <ISymbol> symbols) { List <SyntaxNode> nodes = new List <SyntaxNode>(); if (symbols != null && symbols.Count() > 0) { // filter duplicate symbols symbols = ScriptAnalyzerResourceHelper.filterSymbols(symbols); foreach (ISymbol symbol in symbols) { List <SyntaxNode> newNodes = ScriptAnalyzerResourceHelper.GetSyntaxNodesFromSymbol(symbol); if (newNodes.Count() > 0) { nodes.AddRange(newNodes); } } } return(nodes); }