Skip to content

Commit c292a0e

Browse files
committed
Close #1845
1 parent a9db860 commit c292a0e

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

Rubberduck.Parsing/Symbols/ClassModuleDeclaration.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,19 @@ public bool IsGlobalClassModule
104104
attributeIsGlobalClassModule = value.Single() == "True";
105105
}
106106
_isGlobal = attributeIsGlobalClassModule;
107+
108+
if (!_isGlobal.Value)
109+
{
110+
foreach (var type in Subtypes)
111+
{
112+
if (type is ClassModuleDeclaration && ((ClassModuleDeclaration) type).IsGlobalClassModule)
113+
{
114+
_isGlobal = true;
115+
break;
116+
}
117+
}
118+
}
119+
107120
return _isGlobal.Value;
108121
}
109122
}

Rubberduck.Parsing/Symbols/DeclarationFinder.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,23 @@ private Declaration FindInReferencedProjectByPriority(Declaration enclosingProje
376376

377377
private IEnumerable<Declaration> FindAllInReferencedProjectByPriority(Declaration enclosingProject, string name, Func<Declaration, bool> predicate)
378378
{
379+
var v =
380+
MatchName(name)
381+
.Where(
382+
p =>
383+
p.DeclarationType.HasFlag(DeclarationType.Property) &&
384+
(Declaration.GetModuleParent(p) == null ||
385+
Declaration.GetModuleParent(p).DeclarationType == DeclarationType.ClassModule) &&
386+
((ClassModuleDeclaration) Declaration.GetModuleParent(p)).IsGlobalClassModule);
387+
388+
var x =
389+
MatchName(name)
390+
.Where(
391+
p =>
392+
p.DeclarationType.HasFlag(DeclarationType.Property) &&
393+
(Declaration.GetModuleParent(p) == null ||
394+
Declaration.GetModuleParent(p).DeclarationType == DeclarationType.ClassModule));
395+
379396
var interprojectMatches = MatchName(name).Where(predicate).ToList();
380397
var projectReferences = ((ProjectDeclaration)enclosingProject).ProjectReferences.ToList();
381398
if (interprojectMatches.Count == 0)

Rubberduck.Parsing/Symbols/ReferencedDeclarationsCollector.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,11 @@ public List<Declaration> GetDeclarationsForReference(Reference reference)
207207
attributes.AddPredeclaredIdTypeAttribute();
208208
}
209209

210+
if (typeAttributes.wTypeFlags.HasFlag(TYPEFLAGS.TYPEFLAG_FAPPOBJECT))
211+
{
212+
attributes.AddGlobalClassAttribute();
213+
}
214+
210215
Declaration moduleDeclaration;
211216
switch (typeDeclarationType)
212217
{

Rubberduck.Parsing/VBA/Attributes.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,10 @@ public void AddPredeclaredIdTypeAttribute()
3939
{
4040
Add("VB_PredeclaredId", new[] {"True"});
4141
}
42+
43+
public void AddGlobalClassAttribute()
44+
{
45+
Add("VB_GlobalNamespace", new[] {"True"});
46+
}
4247
}
4348
}

0 commit comments

Comments
 (0)