public void Resolve(VBAParser.ICS_B_MemberProcedureCallContext context) { if (_alreadyResolved.Contains(context)) { return; } var parentScope = ResolveInternal(context.implicitCallStmt_InStmt(), _currentScope, ContextAccessorType.GetValueOrReference); var parentType = ResolveType(parentScope); if (_withBlockQualifiers.Any()) { parentType = _withBlockQualifiers.Peek(); parentScope = ResolveInternal(context.implicitCallStmt_InStmt(), parentType, ContextAccessorType.GetValueOrReference) ?? ResolveInternal(context.ambiguousIdentifier(), parentType); parentType = ResolveType(parentScope); } if (parentType == null) { return; } var identifierContext = context.ambiguousIdentifier(); var member = _declarations[identifierContext.GetText()].SingleOrDefault(item => item.ComponentName == parentType.ComponentName); if (member != null) { var reference = CreateReference(identifierContext, member); member.AddReference(reference); _alreadyResolved.Add(reference.Context); } var fieldCall = context.dictionaryCallStmt(); ResolveInternal(fieldCall, member); }
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)); }