private Declaration ResolveInternal(VBAParser.DictionaryCallStmtContext fieldCall, Declaration parent, bool hasExplicitLetStatement = false, bool isAssignmentTarget = false)
        {
            if (fieldCall == null)
            {
                return(null);
            }

            var parentType = ResolveType(parent);

            if (parentType == null)
            {
                return(null);
            }

            var members   = _declarations.FindMembers(parentType);
            var fieldName = fieldCall.ambiguousIdentifier().GetText();

            var result = members.SingleOrDefault(member => member.IdentifierName == fieldName);

            if (result == null)
            {
                return(null);
            }

            var identifierContext = fieldCall.ambiguousIdentifier();
            var reference         = CreateReference(identifierContext, result, isAssignmentTarget, hasExplicitLetStatement);

            result.AddReference(reference);
            _alreadyResolved.Add(reference.Context);

            return(result);
        }
        private Declaration Resolve(VBAParser.ICS_B_MemberProcedureCallContext context)
        {
            var parent     = context.implicitCallStmt_InStmt();
            var parentCall = Resolve(parent.iCS_S_VariableOrProcedureCall())
                             ?? Resolve(parent.iCS_S_ProcedureOrArrayCall())
                             ?? Resolve(parent.iCS_S_DictionaryCall())
                             ?? Resolve(parent.iCS_S_MembersCall());

            if (parentCall == null)
            {
                return(null);
            }

            var type = _declarations[parentCall.AsTypeName].SingleOrDefault(item =>
                                                                            item.DeclarationType == DeclarationType.Class ||
                                                                            item.DeclarationType == DeclarationType.UserDefinedType);

            var members = _declarations.FindMembers(type);
            var name    = context.ambiguousIdentifier().GetText();

            return(members.SingleOrDefault(m => m.IdentifierName == name));
        }