public static ISymbol GetDeclaredOriginalSymbol()

in src/Analysis/Codelyzer.Analysis.CSharp/SemanticHelper.cs [146:167]


        public static ISymbol GetDeclaredOriginalSymbol(SyntaxNode syntaxNode,
            SemanticModel semanticModel,
            SemanticModel preportSemanticModel = null)
        {
            if (semanticModel == null && preportSemanticModel == null) return null;

            var symbol = semanticModel?.GetDeclaredSymbol(syntaxNode);
            if (symbol == null && preportSemanticModel != null)
            {
                try
                {
                    symbol = preportSemanticModel.GetDeclaredSymbol(syntaxNode);
                }
                catch (Exception)
                {
                    //When looking for a symbol, and the semantic model is not passed, this generates an error.
                    //We don't log this error because this is an expected behavior when there's no previous semantic models
                }
            }

            return symbol;
        }