You've already forked ada_language_server
mirror of
https://github.com/AdaCore/ada_language_server.git
synced 2026-02-12 12:45:50 -08:00
Fix tests failures related to subprogram called on a null entity
Closes eng/ide/ada_language_server#1493
This commit is contained in:
@@ -12,10 +12,6 @@ package LSP.Server_Messages is
|
||||
type Server_Message is abstract tagged limited null record;
|
||||
-- Base class of messages send by a client to a server
|
||||
|
||||
function Assigned (Self : access Server_Message'Class) return Boolean
|
||||
is (Self /= null);
|
||||
-- Check if the argument is not null
|
||||
|
||||
type Server_Message_Access is access all Server_Message'Class;
|
||||
|
||||
procedure Visit_Server_Message_Visitor
|
||||
|
||||
@@ -37,9 +37,11 @@ package body LSP.Job_Schedulers is
|
||||
procedure Complete_Last_Fence_Job
|
||||
(Self : in out Job_Scheduler'Class;
|
||||
Next : LSP.Server_Messages.Server_Message_Access;
|
||||
Waste : out LSP.Server_Messages.Server_Message_Access) is
|
||||
Waste : out LSP.Server_Messages.Server_Message_Access)
|
||||
is
|
||||
use type LSP.Server_Jobs.Server_Job_Access;
|
||||
begin
|
||||
if Self.Done.Assigned then
|
||||
if Self.Done /= null then
|
||||
Self.Done.Complete (Next);
|
||||
Waste := Self.Done.Message;
|
||||
Free (Self.Done);
|
||||
@@ -55,6 +57,7 @@ package body LSP.Job_Schedulers is
|
||||
Message : in out LSP.Server_Messages.Server_Message_Access;
|
||||
Waste : out LSP.Server_Messages.Server_Message_Access)
|
||||
is
|
||||
use type LSP.Server_Jobs.Server_Job_Access;
|
||||
Cursor : constant Handler_Maps.Cursor :=
|
||||
Self.Handlers.Find (Message'Tag);
|
||||
|
||||
@@ -65,7 +68,7 @@ package body LSP.Job_Schedulers is
|
||||
Self.Complete_Last_Fence_Job (Message, Waste);
|
||||
Job := Handler_Maps.Element (Cursor).Create_Job (Message);
|
||||
|
||||
if Job.Assigned then
|
||||
if Job /= null then
|
||||
Message := null;
|
||||
Self.Enqueue (Job);
|
||||
end if;
|
||||
@@ -91,9 +94,11 @@ package body LSP.Job_Schedulers is
|
||||
-- Has_Jobs --
|
||||
--------------
|
||||
|
||||
function Has_Jobs (Self : Job_Scheduler'Class) return Boolean is
|
||||
function Has_Jobs (Self : Job_Scheduler'Class) return Boolean
|
||||
is
|
||||
use type LSP.Server_Jobs.Server_Job_Access;
|
||||
begin
|
||||
return Self.Blocker.Assigned or else
|
||||
return Self.Blocker /= null or else
|
||||
(for some List of Self.Jobs => not List.Is_Empty);
|
||||
end Has_Jobs;
|
||||
|
||||
@@ -121,13 +126,15 @@ package body LSP.Job_Schedulers is
|
||||
is
|
||||
use all type LSP.Server_Jobs.Job_Priority;
|
||||
use all type LSP.Server_Jobs.Execution_Status;
|
||||
use type LSP.Server_Jobs.Server_Job_Access;
|
||||
use type LSP.Server_Messages.Server_Message_Access;
|
||||
|
||||
Job : LSP.Server_Jobs.Server_Job_Access renames Self.Blocker;
|
||||
Status : LSP.Server_Jobs.Execution_Status := Continue;
|
||||
begin
|
||||
Waste := null;
|
||||
|
||||
if not Job.Assigned then
|
||||
if Job = null then
|
||||
return;
|
||||
end if;
|
||||
|
||||
@@ -138,7 +145,7 @@ package body LSP.Job_Schedulers is
|
||||
loop
|
||||
Self.Process_Job (Client, Waste, From => Low);
|
||||
|
||||
if Waste.Assigned then
|
||||
if Waste /= null then
|
||||
return;
|
||||
end if;
|
||||
end loop;
|
||||
@@ -168,11 +175,12 @@ package body LSP.Job_Schedulers is
|
||||
Waste : out LSP.Server_Messages.Server_Message_Access;
|
||||
From : LSP.Server_Jobs.Job_Priority := LSP.Server_Jobs.Lowest)
|
||||
is
|
||||
use type LSP.Server_Messages.Server_Message_Access;
|
||||
Status : LSP.Server_Jobs.Execution_Status;
|
||||
begin
|
||||
Self.Complete_Last_Fence_Job (null, Waste);
|
||||
|
||||
if not Waste.Assigned then
|
||||
if Waste = null then
|
||||
for List of reverse Self.Jobs (From .. LSP.Server_Jobs.High)
|
||||
when not List.Is_Empty
|
||||
loop
|
||||
|
||||
@@ -76,9 +76,6 @@ package LSP.Server_Jobs is
|
||||
return LSP.Server_Messages.Server_Message_Access is abstract;
|
||||
-- Message to be destroyed when the job is done
|
||||
|
||||
function Assigned (Self : access Server_Job'Class) return Boolean is
|
||||
(Self /= null);
|
||||
|
||||
type Server_Job_Access is access all Server_Job'Class;
|
||||
|
||||
end LSP.Server_Jobs;
|
||||
|
||||
@@ -817,6 +817,7 @@ package body LSP.Servers is
|
||||
|
||||
task body Processing_Task_Type is
|
||||
|
||||
use type LSP.Server_Messages.Server_Message_Access;
|
||||
Input_Queue : Input_Message_Queues.Queue renames Server.Input_Queue;
|
||||
|
||||
procedure Process_Message (Message : in out Server_Message_Access);
|
||||
@@ -846,7 +847,7 @@ package body LSP.Servers is
|
||||
-- job if any.
|
||||
Server.Scheduler.Process_Job (Server.all, Waste);
|
||||
|
||||
if Waste.Assigned then
|
||||
if Waste /= null then
|
||||
Server.Destroy_Queue.Enqueue (Waste);
|
||||
end if;
|
||||
|
||||
@@ -869,11 +870,11 @@ package body LSP.Servers is
|
||||
begin
|
||||
Server.Scheduler.Create_Job (Message, Waste);
|
||||
|
||||
if Waste.Assigned then
|
||||
if Waste /= null then
|
||||
Server.Destroy_Queue.Enqueue (Waste);
|
||||
end if;
|
||||
|
||||
if Message.Assigned then
|
||||
if Message /= null then
|
||||
-- Scheduler wasn't able to process message, destroy it
|
||||
Server.Destroy_Queue.Enqueue (Message);
|
||||
end if;
|
||||
@@ -881,7 +882,7 @@ package body LSP.Servers is
|
||||
loop
|
||||
Server.Scheduler.Process_High_Priority_Job (Server.all, Waste);
|
||||
|
||||
exit when not Waste.Assigned;
|
||||
exit when Waste = null;
|
||||
|
||||
Server.Destroy_Queue.Enqueue (Waste);
|
||||
end loop;
|
||||
@@ -919,7 +920,7 @@ package body LSP.Servers is
|
||||
Continue := False;
|
||||
end select;
|
||||
|
||||
if Request.Assigned then
|
||||
if Request /= null then
|
||||
Process_Message (Request);
|
||||
end if;
|
||||
end loop;
|
||||
@@ -930,7 +931,7 @@ package body LSP.Servers is
|
||||
|
||||
Execute_Jobs (Server.Look_Ahead);
|
||||
|
||||
if not Server.Look_Ahead.Assigned then
|
||||
if Server.Look_Ahead = null then
|
||||
-- there is no jobs any more, just wait for input messages
|
||||
|
||||
select
|
||||
@@ -961,7 +962,7 @@ package body LSP.Servers is
|
||||
end;
|
||||
end loop;
|
||||
|
||||
if Server.Look_Ahead.Assigned then
|
||||
if Server.Look_Ahead /= null then
|
||||
Free (Server.Look_Ahead);
|
||||
end if;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user