@@ -78,10 +78,10 @@ package body LSP.Ada_Contexts is
78
78
-- Return the charset with which the context was initialized
79
79
80
80
procedure Find_All_References_In_Hierarchy
81
- (Self : Context;
82
- Decl : Libadalang.Analysis.Basic_Decl;
83
- Imprecise : in out Libadalang.Common.Ref_Result_Kind;
84
- Callback : not null access procedure
81
+ (Self : Context;
82
+ Decl : Libadalang.Analysis.Basic_Decl;
83
+ Result_Kind : in out Libadalang.Common.Ref_Result_Kind;
84
+ Callback : not null access procedure
85
85
(Base_Id : Libadalang.Analysis.Base_Id;
86
86
Kind : Libadalang.Common.Ref_Result_Kind;
87
87
Cancel : in out Boolean));
@@ -208,15 +208,15 @@ package body LSP.Ada_Contexts is
208
208
-- ----------------------
209
209
210
210
function Find_All_Overrides
211
- (Self : Context;
212
- Decl : Libadalang.Analysis.Basic_Decl;
213
- Imprecise_Results : out Libadalang.Common.Ref_Result_Kind)
211
+ (Self : Context;
212
+ Decl : Libadalang.Analysis.Basic_Decl;
213
+ Result_Kind : out Libadalang.Common.Ref_Result_Kind)
214
214
return Libadalang.Analysis.Basic_Decl_Array
215
215
is
216
216
Units : constant Libadalang.Analysis.Analysis_Unit_Array :=
217
217
Self.Analysis_Units;
218
218
begin
219
- Imprecise_Results := Libadalang.Common.Precise;
219
+ Result_Kind := Libadalang.Common.Precise;
220
220
221
221
if Decl.Is_Null then
222
222
return (1 .. 0 => <>);
@@ -228,13 +228,14 @@ package body LSP.Ada_Contexts is
228
228
return Decl.P_Find_All_Overrides (Units);
229
229
exception
230
230
when E : Libadalang.Common.Property_Error =>
231
- Imprecise_Results := Libadalang.Common.Imprecise;
231
+ Result_Kind := Libadalang.Common.Imprecise;
232
232
Self.Tracer.Trace_Exception (E, " in Find_All_Overrides (precise)" );
233
233
return Decl.P_Find_All_Overrides
234
234
(Units, Imprecise_Fallback => True);
235
235
end ;
236
236
exception
237
237
when E : Libadalang.Common.Property_Error =>
238
+ Result_Kind := Libadalang.Common.Error;
238
239
Self.Tracer.Trace_Exception (E, " in Find_All_Overrides (imprecise)" );
239
240
return (1 .. 0 => <>);
240
241
end Find_All_Overrides ;
@@ -244,9 +245,9 @@ package body LSP.Ada_Contexts is
244
245
-- ------------------------------
245
246
246
247
function Find_All_Base_Declarations
247
- (Self : Context;
248
- Decl : Libadalang.Analysis.Basic_Decl;
249
- Imprecise_Results : out Libadalang.Common.Ref_Result_Kind)
248
+ (Self : Context;
249
+ Decl : Libadalang.Analysis.Basic_Decl;
250
+ Result_Kind : out Libadalang.Common.Ref_Result_Kind)
250
251
return Libadalang.Analysis.Basic_Decl_Array
251
252
is
252
253
use Libadalang.Analysis;
@@ -259,7 +260,7 @@ package body LSP.Ada_Contexts is
259
260
Langkit_Support.Slocs.Start_Sloc (Left.Sloc_Range) =
260
261
Langkit_Support.Slocs.Start_Sloc (Right.Sloc_Range));
261
262
begin
262
- Imprecise_Results := Libadalang.Common.Precise;
263
+ Result_Kind := Libadalang.Common.Precise;
263
264
264
265
if Decl.Is_Null then
265
266
return (1 .. 0 => <>);
@@ -293,7 +294,7 @@ package body LSP.Ada_Contexts is
293
294
exception
294
295
when E : Libadalang.Common.Property_Error =>
295
296
Self.Tracer.Trace_Exception (E, " in Find_All_Base_Declarations" );
296
- Imprecise_Results := Libadalang.Common.Imprecise ;
297
+ Result_Kind := Libadalang.Common.Error ;
297
298
return (1 .. 0 => <>);
298
299
end Find_All_Base_Declarations ;
299
300
@@ -302,10 +303,10 @@ package body LSP.Ada_Contexts is
302
303
-- ------------------------------------
303
304
304
305
procedure Find_All_References_In_Hierarchy
305
- (Self : Context;
306
- Decl : Libadalang.Analysis.Basic_Decl;
307
- Imprecise : in out Libadalang.Common.Ref_Result_Kind;
308
- Callback : not null access procedure
306
+ (Self : Context;
307
+ Decl : Libadalang.Analysis.Basic_Decl;
308
+ Result_Kind : in out Libadalang.Common.Ref_Result_Kind;
309
+ Callback : not null access procedure
309
310
(Base_Id : Libadalang.Analysis.Base_Id;
310
311
Kind : Libadalang.Common.Ref_Result_Kind;
311
312
Cancel : in out Boolean))
@@ -323,31 +324,44 @@ package body LSP.Ada_Contexts is
323
324
else
324
325
Decl);
325
326
327
+ Overriding_Result_Kind : Libadalang.Common.Ref_Result_Kind;
328
+ Bases_Result_Kind : Libadalang.Common.Ref_Result_Kind;
329
+
326
330
Overriding_Decls : constant Libadalang.Analysis.Basic_Decl_Array :=
327
331
Self.Find_All_Overrides
328
332
(Subp_Decl,
329
- Imprecise_Results => Imprecise );
333
+ Result_Kind => Overriding_Result_Kind );
330
334
331
335
Base_Decls : constant Libadalang.Analysis.Basic_Decl_Array :=
332
336
Self.Find_All_Base_Declarations
333
337
(Subp_Decl,
334
- Imprecise_Results => Imprecise);
335
-
336
- Hierarchy : constant Libadalang.Analysis.Basic_Decl_Array :=
337
- Overriding_Decls & Base_Decls;
338
+ Result_Kind => Bases_Result_Kind);
338
339
begin
339
- if Is_Param then
340
- LSP.Ada_Id_Iterators.Find_All_Param_References_In_Hierarchy
341
- (Param => Decl.As_Param_Spec,
342
- Hierarchy => Hierarchy,
343
- Units => Self.Analysis_Units,
344
- Callback => Callback);
345
- else
346
- LSP.Ada_Id_Iterators.Find_All_Subp_References_In_Hierarchy
347
- (Hierarchy => Hierarchy,
348
- Tracer => Self.Tracer.all ,
349
- Callback => Callback);
340
+ if Overriding_Result_Kind in Libadalang.Common.Error
341
+ or else Bases_Result_Kind in Libadalang.Common.Error
342
+ then
343
+ Result_Kind := Libadalang.Common.Error;
344
+ return ;
350
345
end if ;
346
+
347
+ declare
348
+ Hierarchy : constant Libadalang.Analysis.Basic_Decl_Array :=
349
+ Overriding_Decls & Base_Decls;
350
+ begin
351
+
352
+ if Is_Param then
353
+ LSP.Ada_Id_Iterators.Find_All_Param_References_In_Hierarchy
354
+ (Param => Decl.As_Param_Spec,
355
+ Hierarchy => Hierarchy,
356
+ Units => Self.Analysis_Units,
357
+ Callback => Callback);
358
+ else
359
+ LSP.Ada_Id_Iterators.Find_All_Subp_References_In_Hierarchy
360
+ (Hierarchy => Hierarchy,
361
+ Tracer => Self.Tracer.all ,
362
+ Callback => Callback);
363
+ end if ;
364
+ end ;
351
365
end Find_All_References_In_Hierarchy ;
352
366
353
367
-- ------------------
0 commit comments