Skip to content

Commit 3cf107e

Browse files
committed
fixes #2601; all tests pass if you re-run them individually.
1 parent 3f4ea30 commit 3cf107e

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

Rubberduck.Parsing/Symbols/DeclarationFinder.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ public IEnumerable<Declaration> Undeclared
131131
get { return _undeclared.AllValues(); }
132132
}
133133

134+
public IEnumerable<Declaration> Members(Declaration module)
135+
{
136+
return _declarations[module.QualifiedName.QualifiedModuleName];
137+
}
138+
134139
private IEnumerable<Declaration> _nonBaseAsType;
135140
public IEnumerable<Declaration> FindDeclarationsWithNonBaseAsType()
136141
{

Rubberduck.Parsing/Symbols/IdentifierReferenceResolver.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System.Collections.Generic;
99
using System.Linq;
1010
using System.Threading;
11+
using Rubberduck.Parsing.VBA;
1112

1213
namespace Rubberduck.Parsing.Symbols
1314
{
@@ -173,7 +174,17 @@ private void ResolveDefault(
173174
expression.GetText()));
174175
}
175176
}
176-
_boundExpressionVisitor.AddIdentifierReferences(boundExpression, _qualifiedModuleName, _currentScope, _currentParent, isAssignmentTarget, hasExplicitLetStatement);
177+
178+
var hasDefaultMember = false;
179+
if (boundExpression.ReferencedDeclaration != null
180+
&& boundExpression.ReferencedDeclaration.DeclarationType != DeclarationType.Project
181+
&& boundExpression.ReferencedDeclaration.AsTypeDeclaration != null)
182+
{
183+
var module = boundExpression.ReferencedDeclaration.AsTypeDeclaration;
184+
var members = _declarationFinder.Members(module);
185+
hasDefaultMember = members.Any(m => m.Attributes.Any(kvp => kvp.Key == m.IdentifierName + ".VB_UserMemId" && kvp.Value.FirstOrDefault() == "0"));
186+
}
187+
_boundExpressionVisitor.AddIdentifierReferences(boundExpression, _qualifiedModuleName, _currentScope, _currentParent, !hasDefaultMember && isAssignmentTarget, hasExplicitLetStatement);
177188
}
178189

179190
private void ResolveType(ParserRuleContext expression)

0 commit comments

Comments
 (0)