7
7
using Rubberduck . VBEditor ;
8
8
using System ;
9
9
using System . Collections . Generic ;
10
+ using System . Diagnostics ;
10
11
using System . Linq ;
11
12
using System . Runtime . InteropServices ;
12
13
using Antlr4 . Runtime . Misc ;
14
+ using NLog ;
13
15
14
16
namespace Rubberduck . Parsing . Symbols
15
17
{
@@ -38,6 +40,9 @@ public DeclarationSymbolsListener(
38
40
IDictionary < Tuple < string , DeclarationType > , Attributes > attributes ,
39
41
Declaration projectDeclaration )
40
42
{
43
+ var log = LogManager . GetCurrentClassLogger ( ) ;
44
+ var stop = Stopwatch . StartNew ( ) ;
45
+
41
46
_state = state ;
42
47
_qualifiedName = qualifiedName ;
43
48
_annotations = annotations ;
@@ -68,6 +73,10 @@ public DeclarationSymbolsListener(
68
73
{
69
74
bool hasDefaultInstanceVariable = type != vbext_ComponentType . vbext_ct_ClassModule && type != vbext_ComponentType . vbext_ct_StdModule ;
70
75
76
+ var stop1 = Stopwatch . StartNew ( ) ;
77
+ var stop2 = new Stopwatch ( ) ;
78
+ var stop3 = new Stopwatch ( ) ;
79
+
71
80
Declaration superType = null ;
72
81
if ( type == vbext_ComponentType . vbext_ct_Document )
73
82
{
@@ -83,7 +92,15 @@ public DeclarationSymbolsListener(
83
92
var allNamesMatch = true ;
84
93
for ( var i = 0 ; i < coclass . Key . Count ; i ++ )
85
94
{
86
- if ( coclass . Key [ i ] != _qualifiedName . Component . Properties . Item ( i + 1 ) . Name )
95
+ stop2 . Start ( ) ;
96
+ var propName = _qualifiedName . Component . Properties . Item ( i + 1 ) . Name ;
97
+ stop2 . Stop ( ) ;
98
+
99
+ stop3 . Start ( ) ;
100
+ var namesMatch = coclass . Key [ i ] != propName ;
101
+ stop3 . Stop ( ) ;
102
+
103
+ if ( namesMatch )
87
104
{
88
105
allNamesMatch = false ;
89
106
break ;
@@ -101,6 +118,10 @@ public DeclarationSymbolsListener(
101
118
}
102
119
}
103
120
}
121
+ stop1 . Stop ( ) ;
122
+ log . Debug ( "{0}ms getting property name" , stop2 . ElapsedMilliseconds ) ;
123
+ log . Debug ( "{0}ms comparing property name" , stop3 . ElapsedMilliseconds ) ;
124
+ log . Debug ( "{0}ms resolving coclass" , stop1 . ElapsedMilliseconds ) ;
104
125
105
126
_moduleDeclaration = new ClassModuleDeclaration (
106
127
_qualifiedName . QualifyMemberName ( _qualifiedName . Component . Name ) ,
@@ -123,6 +144,9 @@ public DeclarationSymbolsListener(
123
144
{
124
145
DeclareControlsAsMembers ( component ) ;
125
146
}
147
+
148
+ stop . Stop ( ) ;
149
+ log . Debug ( "{0}ms in declaration listener ctor" , stop . ElapsedMilliseconds ) ;
126
150
}
127
151
128
152
private IEnumerable < IAnnotation > FindAnnotations ( )
@@ -801,8 +825,8 @@ public override void ExitPrivateTypeDeclaration(VBAParser.PrivateTypeDeclaration
801
825
{
802
826
_parentDeclaration = _moduleDeclaration ;
803
827
}
804
-
805
- public void AddUdtDeclaration ( VBAParser . UdtDeclarationContext udtDeclaration , Accessibility accessibility , ParserRuleContext context )
828
+
829
+ private void AddUdtDeclaration ( VBAParser . UdtDeclarationContext udtDeclaration , Accessibility accessibility , ParserRuleContext context )
806
830
{
807
831
var identifier = Identifier . GetName ( udtDeclaration . untypedIdentifier ( ) ) ;
808
832
var identifierSelection = Identifier . GetNameSelection ( udtDeclaration . untypedIdentifier ( ) ) ;
0 commit comments