private Declaration ResolveInternal(VBAParser.ICS_S_VariableOrProcedureCallContext context, Declaration localScope, ContextAccessorType accessorType = ContextAccessorType.GetValueOrReference, bool hasExplicitLetStatement = false, bool isAssignmentTarget = false)
        {
            if (context == null)
            {
                return(null);
            }

            var identifierContext = context.ambiguousIdentifier();
            var fieldCall         = context.dictionaryCallStmt();

            return(ResolveInternal(identifierContext, localScope, accessorType, fieldCall, hasExplicitLetStatement, isAssignmentTarget));
        }
        private Declaration Resolve(VBAParser.ICS_S_VariableOrProcedureCallContext context, out VBAParser.AmbiguousIdentifierContext identifierContext, DeclarationType accessorType)
        {
            if (context == null)
            {
                identifierContext = null;
                return(null);
            }

            var identifier = context.ambiguousIdentifier();
            var name       = identifier.GetText();

            var procedure = FindProcedureDeclaration(name, identifier, accessorType);
            var result    = procedure ?? FindVariableDeclaration(name, identifier, accessorType);

            identifierContext = result == null
                ? null
                : result.Context == null
                    ? null
                    : ((dynamic)result.Context).ambiguousIdentifier();
            return(result);
        }