@@ -14,10 +14,8 @@ namespace Rubberduck.Parsing.Symbols
14
14
{
15
15
public class DeclarationSymbolsListener : VBAParserBaseListener
16
16
{
17
- private readonly RubberduckParserState _state ;
18
17
private readonly QualifiedModuleName _qualifiedName ;
19
18
private readonly Declaration _moduleDeclaration ;
20
- private readonly Declaration _projectDeclaration ;
21
19
22
20
private string _currentScope ;
23
21
private Declaration _currentScopeDeclaration ;
@@ -37,7 +35,6 @@ public DeclarationSymbolsListener(
37
35
IDictionary < Tuple < string , DeclarationType > , Attributes > attributes ,
38
36
Declaration projectDeclaration )
39
37
{
40
- _state = state ;
41
38
_qualifiedName = qualifiedName ;
42
39
_annotations = annotations ;
43
40
_attributes = attributes ;
@@ -46,8 +43,6 @@ public DeclarationSymbolsListener(
46
43
? DeclarationType . ProceduralModule
47
44
: DeclarationType . ClassModule ;
48
45
49
- _projectDeclaration = projectDeclaration ;
50
-
51
46
var key = Tuple . Create ( _qualifiedName . ComponentName , declarationType ) ;
52
47
var moduleAttributes = attributes . ContainsKey ( key )
53
48
? attributes [ key ]
@@ -57,7 +52,7 @@ public DeclarationSymbolsListener(
57
52
{
58
53
_moduleDeclaration = new ProceduralModuleDeclaration (
59
54
_qualifiedName . QualifyMemberName ( _qualifiedName . Component . Name ) ,
60
- _projectDeclaration ,
55
+ projectDeclaration ,
61
56
_qualifiedName . Component . Name ,
62
57
false ,
63
58
FindAnnotations ( ) ,
@@ -70,7 +65,7 @@ public DeclarationSymbolsListener(
70
65
Declaration superType = null ;
71
66
if ( type == vbext_ComponentType . vbext_ct_Document )
72
67
{
73
- foreach ( var coclass in _state . CoClasses )
68
+ foreach ( var coclass in state . CoClasses )
74
69
{
75
70
try
76
71
{
@@ -103,7 +98,7 @@ public DeclarationSymbolsListener(
103
98
104
99
_moduleDeclaration = new ClassModuleDeclaration (
105
100
_qualifiedName . QualifyMemberName ( _qualifiedName . Component . Name ) ,
106
- _projectDeclaration ,
101
+ projectDeclaration ,
107
102
_qualifiedName . Component . Name ,
108
103
false ,
109
104
FindAnnotations ( ) ,
@@ -765,13 +760,16 @@ public override void EnterConstSubStmt(VBAParser.ConstSubStmtContext context)
765
760
var typeHint = Identifier . GetTypeHintValue ( identifier ) ;
766
761
var name = Identifier . GetName ( identifier ) ;
767
762
var value = context . expression ( ) . GetText ( ) ;
763
+ var constStmt = ( VBAParser . ConstStmtContext ) context . Parent ;
764
+
768
765
var declaration = new ConstantDeclaration (
769
766
new QualifiedMemberName ( _qualifiedName , name ) ,
770
767
_parentDeclaration ,
771
768
_currentScope ,
772
769
asTypeName ,
773
770
asTypeClause ,
774
771
typeHint ,
772
+ FindAnnotations ( constStmt . Start . Line ) ,
775
773
accessibility ,
776
774
DeclarationType . Constant ,
777
775
value ,
0 commit comments