Skip to content

Commit 53859ce

Browse files
committed
Merge branch 'topic/fix_gnatcov2' into 'master'
Fix GNAT Cov issue See merge request eng/ide/ada_language_server!1494
2 parents 6991bf3 + 99097c8 commit 53859ce

File tree

5 files changed

+17
-13
lines changed

5 files changed

+17
-13
lines changed

source/ada/lsp-ada_configurations.adb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -347,17 +347,16 @@ package body LSP.Ada_Configurations is
347347
Reload : out Boolean)
348348
is
349349
use all type VSS.JSON.Streams.JSON_Stream_Element_Kind;
350-
Index : Positive := JSON.First_Index;
350+
Index : Positive := JSON.First_Index + 1;
351351

352352
begin
353-
if JSON.Is_Empty or else JSON (Index).Kind /= Start_Object then
354-
Reload := False;
353+
Reload := False;
354+
355+
if JSON.Is_Empty or else JSON.First_Element.Kind /= Start_Object then
355356
return;
356-
else
357-
Index := Index + 1;
358357
end if;
359358

360-
while Index <= JSON.Last_Index
359+
while Index < JSON.Last_Index
361360
and then JSON (Index).Kind = Key_Name
362361
loop
363362
declare
@@ -370,6 +369,7 @@ package body LSP.Ada_Configurations is
370369
JSON (Index).Kind = Start_Object
371370
then
372371
Self.Parse_Ada (JSON, Index, Reload);
372+
exit;
373373
else
374374
Skip_Value (JSON, Index);
375375
end if;

source/ada/lsp-ada_did_change_configurations.adb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ package body LSP.Ada_Did_Change_Configurations is
8383

8484
Reload : Boolean renames Result.Reload;
8585
begin
86-
Result.Configuration := Self.Context.Get_Configuration.all;
86+
Result.Configuration :=
87+
LSP.Ada_Configurations.Configuration
88+
(Self.Context.Get_Configuration.all);
89+
8790
Result.Configuration.Read_JSON (Value.Params.settings, Reload);
8891

8992
-- Always reload project if Project_Tree isn't ready

source/ada/lsp-ada_handlers.adb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4556,9 +4556,9 @@ package body LSP.Ada_Handlers is
45564556

45574557
overriding procedure Set_Configuration
45584558
(Self : in out Message_Handler;
4559-
Value : LSP.Ada_Configurations.Configuration) is
4559+
Value : LSP.Ada_Configurations.Configuration'Class) is
45604560
begin
4561-
Self.Configuration := Value;
4561+
Self.Configuration := LSP.Ada_Configurations.Configuration (Value);
45624562
end Set_Configuration;
45634563

45644564
-----------------------

source/ada/lsp-ada_handlers.ads

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,12 +487,12 @@ private
487487
------------------
488488

489489
overriding function Get_Configuration (Self : Message_Handler)
490-
return access constant LSP.Ada_Configurations.Configuration is
490+
return access constant LSP.Ada_Configurations.Configuration'Class is
491491
(Self.Configuration'Unchecked_Access);
492492

493493
overriding procedure Set_Configuration
494494
(Self : in out Message_Handler;
495-
Value : LSP.Ada_Configurations.Configuration);
495+
Value : LSP.Ada_Configurations.Configuration'Class);
496496

497497
overriding procedure Increment_Project_Timestamp
498498
(Self : in out Message_Handler);

source/ada/lsp-ada_job_contexts.ads

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@ package LSP.Ada_Job_Contexts is
3535
return GNATCOLL.VFS.Virtual_File is abstract;
3636

3737
function Get_Configuration (Self : Ada_Job_Context)
38-
return access constant LSP.Ada_Configurations.Configuration is abstract;
38+
return access constant LSP.Ada_Configurations.Configuration'Class
39+
is abstract;
3940

4041
procedure Set_Configuration
4142
(Self : in out Ada_Job_Context;
42-
Value : LSP.Ada_Configurations.Configuration) is abstract;
43+
Value : LSP.Ada_Configurations.Configuration'Class) is abstract;
4344

4445
procedure Increment_Project_Timestamp (Self : in out Ada_Job_Context)
4546
is abstract;

0 commit comments

Comments
 (0)