Exemple #1
0
        public bool TryResolveMethodInfo(
            MethodDeclarationSyntax node,
            out MethodInfo result)
        {
            result = null;

            var resolver = new ResolveUsingsAndNamespacesVisitor();

            resolver.Visit(node);

            return(Context.Library.TryResolveMethod(resolver.Namespaces.Concat(new[] { node.Identifier.ValueText }), out result));
        }
Exemple #2
0
        public bool TryResolveMethodInfo(
            InvocationExpressionSyntax node,
            out MethodInfo result)
        {
            result = null;

            var resolver = new ResolveUsingsAndNamespacesVisitor();

            resolver.Visit(node);

            switch (node.Expression)
            {
            case IdentifierNameSyntax ins:
                // simple invocation like method() on current code block
                return(Context.Library.TryResolveMethod(resolver.Namespaces.Concat(new[] { ins.Identifier.ValueText }), out result));
            }

            return(false);
        }