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 VBAParser.AmbiguousIdentifierContext EnterDictionaryCall(VBAParser.DictionaryCallStmtContext dictionaryCall, VBAParser.AmbiguousIdentifierContext parentIdentifier = null, DeclarationType accessorType = DeclarationType.PropertyGet)
        {
            if (dictionaryCall == null)
            {
                return(null);
            }

            if (parentIdentifier != null)
            {
                var isTarget = accessorType == DeclarationType.PropertyLet || accessorType == DeclarationType.PropertySet;
                if (!EnterIdentifier(parentIdentifier, parentIdentifier.GetSelection(), isTarget, accessorType: accessorType))
                // we're referencing "member" in "member!field"
                {
                    return(null);
                }
            }

            var identifier = dictionaryCall.ambiguousIdentifier();

            if (_declarations.Items.Any(item => item.IdentifierName == identifier.GetText()))
            {
                return(identifier);
            }

            return(null);
        }