@@ -89,15 +89,20 @@ public ParseTree visitFunction(BSLParser.FunctionContext ctx) {
89
89
return ctx ;
90
90
}
91
91
92
+ if (!declaration .annotation ().isEmpty ()) {
93
+ startNode = declaration .annotation ().get (0 ).AMPERSAND ();
94
+ }
95
+
92
96
MethodSymbol methodSymbol = createMethodSymbol (
93
97
startNode ,
94
98
stopNode ,
99
+ declaration .FUNCTION_KEYWORD ().getSymbol (),
95
100
declaration .subName ().getStart (),
96
101
declaration .paramList (),
97
102
true ,
98
103
declaration .EXPORT_KEYWORD () != null ,
99
104
getCompilerDirective (declaration .compilerDirective ()),
100
- getAnnotations (declaration .annotation ()));
105
+ createAnnotations (declaration .annotation ()));
101
106
102
107
methods .add (methodSymbol );
103
108
@@ -119,15 +124,20 @@ public ParseTree visitProcedure(BSLParser.ProcedureContext ctx) {
119
124
return ctx ;
120
125
}
121
126
127
+ if (!declaration .annotation ().isEmpty ()) {
128
+ startNode = declaration .annotation ().get (0 ).AMPERSAND ();
129
+ }
130
+
122
131
MethodSymbol methodSymbol = createMethodSymbol (
123
132
startNode ,
124
133
stopNode ,
134
+ declaration .PROCEDURE_KEYWORD ().getSymbol (),
125
135
declaration .subName ().getStart (),
126
136
declaration .paramList (),
127
137
false ,
128
138
declaration .EXPORT_KEYWORD () != null ,
129
139
getCompilerDirective (declaration .compilerDirective ()),
130
- getAnnotations (declaration .annotation ())
140
+ createAnnotations (declaration .annotation ())
131
141
);
132
142
133
143
methods .add (methodSymbol );
@@ -182,14 +192,16 @@ private static Optional<CompilerDirectiveKind> getCompilerDirective(
182
192
private MethodSymbol createMethodSymbol (
183
193
TerminalNode startNode ,
184
194
TerminalNode stopNode ,
195
+ Token startOfMethod ,
185
196
Token subName ,
186
197
BSLParser .ParamListContext paramList ,
187
198
boolean function ,
188
199
boolean export ,
189
200
Optional <CompilerDirectiveKind > compilerDirective ,
190
201
List <Annotation > annotations
191
202
) {
192
- Optional <MethodDescription > description = createDescription (startNode .getSymbol ());
203
+ Optional <MethodDescription > description = createDescription (startOfMethod )
204
+ .or (() -> createDescription (startNode .getSymbol ()));
193
205
boolean deprecated = description
194
206
.map (MethodDescription ::isDeprecated )
195
207
.orElse (false );
@@ -236,7 +248,7 @@ private static List<ParameterDefinition> createParameters(
236
248
.range (getParameterRange (param ))
237
249
.description (getParameterDescription (parameterName , description ))
238
250
.build ();
239
- }).collect ( Collectors . toList () );
251
+ }).toList ();
240
252
}
241
253
242
254
private static ParameterDefinition .DefaultValue getDefaultValue (BSLParser .ParamContext param ) {
@@ -310,10 +322,10 @@ private static Optional<ParameterDescription> getParameterDescription(
310
322
311
323
}
312
324
313
- private static List <Annotation > getAnnotations (List <? extends BSLParser .AnnotationContext > annotationContext ) {
314
- return annotationContext .stream ()
325
+ private static List <Annotation > createAnnotations (List <? extends BSLParser .AnnotationContext > annotationContexts ) {
326
+ return annotationContexts .stream ()
315
327
.map (MethodSymbolComputer ::createAnnotation )
316
- .collect ( Collectors . toList () );
328
+ .toList ();
317
329
}
318
330
319
331
private static Annotation createAnnotation (BSLParser .AnnotationContext annotation ) {
@@ -334,7 +346,7 @@ private static List<AnnotationParameterDefinition> getAnnotationParameter(
334
346
335
347
return annotationParamsContext .annotationParam ().stream ()
336
348
.map (MethodSymbolComputer ::getAnnotationParam )
337
- .collect ( Collectors . toList () );
349
+ .toList ();
338
350
}
339
351
340
352
private static AnnotationParameterDefinition getAnnotationParam (BSLParser .AnnotationParamContext o ) {
0 commit comments