@@ -14,6 +14,7 @@ public class AliasDeclarations : ICustomDeclarationLoader
14
14
private Declaration _fileSystemModule ;
15
15
private Declaration _interactionModule ;
16
16
private Declaration _stringsModule ;
17
+ private Declaration _dateTimeModule ;
17
18
18
19
public AliasDeclarations ( RubberduckParserState state )
19
20
{
@@ -48,7 +49,9 @@ public IReadOnlyList<Declaration> Load()
48
49
Grammar . Tokens . RightB ,
49
50
Grammar . Tokens . RTrim ,
50
51
Grammar . Tokens . String ,
51
- Grammar . Tokens . UCase
52
+ Grammar . Tokens . UCase ,
53
+ Grammar . Tokens . Date ,
54
+ Grammar . Tokens . Time ,
52
55
} ;
53
56
54
57
private IReadOnlyList < Declaration > AddAliasDeclarations ( )
@@ -71,7 +74,7 @@ private IReadOnlyList<Declaration> AddAliasDeclarations()
71
74
var functionAliases = FunctionAliasesWithoutParameters ( ) ;
72
75
AddParametersToAliasesFromReferencedFunctions ( functionAliases , possiblyAliasedFunctions ) ;
73
76
74
- return functionAliases ;
77
+ return functionAliases . Concat < Declaration > ( PropertyGetDeclarations ( ) ) . ToList ( ) ;
75
78
}
76
79
77
80
private void UpdateAliasFunctionModulesFromReferencedProjects ( DeclarationFinder finder )
@@ -88,6 +91,7 @@ private void UpdateAliasFunctionModulesFromReferencedProjects(DeclarationFinder
88
91
_fileSystemModule = finder . FindStdModule ( "FileSystem" , vba , true ) ;
89
92
_interactionModule = finder . FindStdModule ( "Interaction" , vba , true ) ;
90
93
_stringsModule = finder . FindStdModule ( "Strings" , vba , true ) ;
94
+ _dateTimeModule = finder . FindStdModule ( "DateTime" , vba , true ) ;
91
95
}
92
96
93
97
@@ -120,6 +124,50 @@ private List<Declaration> ReferencedBuiltInFunctionsThatMightHaveAnAlias(Rubberd
120
124
return functions . ToList ( ) ;
121
125
}
122
126
127
+ private List < PropertyGetDeclaration > PropertyGetDeclarations ( )
128
+ {
129
+ return new List < PropertyGetDeclaration >
130
+ {
131
+ DatePropertyGet ( ) ,
132
+ TimePropertyGet ( ) ,
133
+ } ;
134
+ }
135
+
136
+ private PropertyGetDeclaration DatePropertyGet ( )
137
+ {
138
+ return new PropertyGetDeclaration (
139
+ new QualifiedMemberName ( _dateTimeModule . QualifiedName . QualifiedModuleName , "Date" ) ,
140
+ _dateTimeModule ,
141
+ _dateTimeModule ,
142
+ "Variant" ,
143
+ null ,
144
+ string . Empty ,
145
+ Accessibility . Global ,
146
+ null ,
147
+ new Selection ( ) ,
148
+ false ,
149
+ true ,
150
+ new List < IAnnotation > ( ) ,
151
+ new Attributes ( ) ) ;
152
+ }
153
+
154
+ private PropertyGetDeclaration TimePropertyGet ( )
155
+ {
156
+ return new PropertyGetDeclaration (
157
+ new QualifiedMemberName ( _dateTimeModule . QualifiedName . QualifiedModuleName , "Time" ) ,
158
+ _dateTimeModule ,
159
+ _dateTimeModule ,
160
+ "Variant" ,
161
+ null ,
162
+ string . Empty ,
163
+ Accessibility . Global ,
164
+ null ,
165
+ new Selection ( ) ,
166
+ false ,
167
+ true ,
168
+ new List < IAnnotation > ( ) ,
169
+ new Attributes ( ) ) ;
170
+ }
123
171
124
172
private List < FunctionDeclaration > FunctionAliasesWithoutParameters ( )
125
173
{
@@ -146,7 +194,7 @@ private List<FunctionDeclaration> FunctionAliasesWithoutParameters()
146
194
RightBFunction ( ) ,
147
195
RTrimFunction ( ) ,
148
196
StringFunction ( ) ,
149
- UCaseFunction ( )
197
+ UCaseFunction ( ) ,
150
198
} ;
151
199
}
152
200
0 commit comments