Skip to content

Commit 027103a

Browse files
committed
fixed enum/enum member resolution
1 parent 6e7212b commit 027103a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Rubberduck.Parsing/Binding/SimpleNameDefaultBinding.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,12 @@ within the enclosing project other than the enclosing module.
200200
{
201201
return new SimpleNameExpression(accessibleConstant, ExpressionClassification.Variable, _context);
202202
}
203-
var accessibleType = _declarationFinder.FindMemberEnclosedProjectWithoutEnclosingModule(_project, _module, _parent, _name, DeclarationType.Enumeration);
203+
var accessibleType = _declarationFinder.FindMemberEnclosedProjectWithoutEnclosingModule(_project, _module, _parent, _name, DeclarationType.EnumerationMember);
204204
if (IsValidMatch(accessibleType, _name))
205205
{
206206
return new SimpleNameExpression(accessibleType, ExpressionClassification.Type, _context);
207207
}
208-
var accessibleMember = _declarationFinder.FindMemberEnclosedProjectWithoutEnclosingModule(_project, _module, _parent, _name, DeclarationType.EnumerationMember);
208+
var accessibleMember = _declarationFinder.FindMemberEnclosedProjectWithoutEnclosingModule(_project, _module, _parent, _name, DeclarationType.Enumeration);
209209
if (IsValidMatch(accessibleMember, _name))
210210
{
211211
return new SimpleNameExpression(accessibleMember, ExpressionClassification.Value, _context);
@@ -328,6 +328,7 @@ private IBoundExpression ResolveModuleReferencedProjectNamespace()
328328
{
329329
return new SimpleNameExpression(globalClassModuleSubroutine, ExpressionClassification.Subroutine, _context);
330330
}
331+
331332
return null;
332333
}
333334

@@ -354,7 +355,7 @@ private bool IsValidMatch(Declaration match, string name)
354355
{
355356
return true;
356357
}
357-
if (((IDeclarationWithParameter)match).Parameters.Count() > 0)
358+
if (((IDeclarationWithParameter)match).Parameters.Any())
358359
{
359360
return true;
360361
}

Rubberduck.Parsing/Symbols/DeclarationFinder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ public Declaration FindMemberEnclosedProjectWithoutEnclosingModule(Declaration c
301301
var allMatches = MatchName(memberName);
302302
var memberMatches = allMatches.Where(m =>
303303
m.DeclarationType.HasFlag(memberType)
304-
&& (Declaration.GetModuleParent(m).DeclarationType == DeclarationType.ProceduralModule || m.DeclarationType == DeclarationType.Enumeration)
304+
&& (Declaration.GetModuleParent(m).DeclarationType == DeclarationType.ProceduralModule || memberType == DeclarationType.Enumeration || memberType == DeclarationType.EnumerationMember)
305305
&& Declaration.GetProjectParent(m).Equals(callingProject)
306306
&& !callingModule.Equals(Declaration.GetModuleParent(m)));
307307
var accessibleMembers = memberMatches.Where(m => AccessibilityCheck.IsMemberAccessible(callingProject, callingModule, callingParent, m));

0 commit comments

Comments
 (0)