Esempio n. 1
0
        private static string?GetNameOfInvokedExpression(ISyntaxFacts syntaxFacts, SyntaxNode invokedExpression)
        {
            if (syntaxFacts.IsSimpleMemberAccessExpression(invokedExpression))
            {
                return(syntaxFacts.GetIdentifierOfSimpleName(syntaxFacts.GetNameOfMemberAccessExpression(invokedExpression)).ValueText);
            }

            if (syntaxFacts.IsMemberBindingExpression(invokedExpression))
            {
                invokedExpression = syntaxFacts.GetNameOfMemberBindingExpression(invokedExpression);
            }

            if (syntaxFacts.IsIdentifierName(invokedExpression))
            {
                return(syntaxFacts.GetIdentifierOfSimpleName(invokedExpression).ValueText);
            }

            return(null);
        }