File tree Expand file tree Collapse file tree 3 files changed +4
-6
lines changed Expand file tree Collapse file tree 3 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -426,9 +426,7 @@ public static IEnumerable<Declaration> FindEventProcedures(this IEnumerable<Decl
426
426
}
427
427
428
428
var items = declarations as IList < Declaration > ?? declarations . ToList ( ) ;
429
- var type = items . SingleOrDefault ( item => item . DeclarationType == DeclarationType . ClassModule
430
- && item . Project != null
431
- && item . IdentifierName == withEventsDeclaration . AsTypeName . Split ( '.' ) . Last ( ) ) ;
429
+ var type = withEventsDeclaration . AsTypeDeclaration ;
432
430
433
431
if ( type == null )
434
432
{
@@ -449,7 +447,7 @@ public static IEnumerable<Declaration> FindEventProcedures(this IEnumerable<Decl
449
447
450
448
private static IEnumerable < Declaration > GetTypeMembers ( this IEnumerable < Declaration > declarations , Declaration type )
451
449
{
452
- return declarations . Where ( item => item . Project != null && item . ProjectId == type . ProjectId && item . ParentScope == type . Scope ) ;
450
+ return declarations . Where ( item => Equals ( item . ParentScopeDeclaration , type ) ) ;
453
451
}
454
452
455
453
/// <summary>
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ public override IEnumerable<InspectionResultBase> GetInspectionResults()
26
26
. Where ( declaration =>
27
27
{
28
28
29
- if ( declaration . DeclarationType != DeclarationType . Variable ||
29
+ if ( declaration . DeclarationType != DeclarationType . Variable || declaration . IsWithEvents ||
30
30
! new [ ] { DeclarationType . ClassModule , DeclarationType . ProceduralModule } . Contains ( declaration . ParentDeclaration . DeclarationType ) )
31
31
{
32
32
return false ;
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ public override IEnumerable<InspectionResultBase> GetInspectionResults()
43
43
. SelectMany ( control => declarations . FindEventHandlers ( control ) ) . ToList ( ) ;
44
44
45
45
var withEventFields = declarations . Where ( item => item . DeclarationType == DeclarationType . Variable && item . IsWithEvents ) ;
46
- handlers . AddRange ( withEventFields . SelectMany ( declarations . FindEventProcedures ) ) ;
46
+ handlers . AddRange ( withEventFields . SelectMany ( Declarations . FindEventProcedures ) ) ;
47
47
48
48
var forms = declarations . Where ( item => item . DeclarationType == DeclarationType . ClassModule
49
49
&& item . QualifiedName . QualifiedModuleName . Component . Type == ComponentType . UserForm )
You can’t perform that action at this time.
0 commit comments