Description
Integrating libadalang 25.0.0
from libadalang 23.0.0
Calls to Libadalang.Auto_Provider.Get_Unit
and Libadalang.Project_Provider.Get_Unit
explicitly raise Program_Error
exception.
Previously, developer was able to get a unit through the call
declare
Unit : constant Libadalang.Analysis.Analysis_Unit'Class := LAL_Auto_Unit_Provider.Get_Unit
(Context => LAL_Context,
Name => Name,
Kind => Kind);
within the context below
declare
LAL_Auto_Unit_Provider : Libadalang.Auto_Provider.Auto_Unit_Provider;
LAL_Context : Libadalang.Analysis.Analysis_Context;
begin
LAL_Auto_Unit_Provider := Libadalang.Auto_Provider.Create_Auto_Provider (Input_Files => Files);
Unit_Provider_Ref := LAL_Auto_Unit_Provider.Create_Unit_Provider_Reference;
LAL_Context := Libadalang.Analysis.Create_Context (Unit_Provider => Unit_Provider_Ref);
This breaking change is related to the implementation of "PLE root" Langkit mechanism (Commit 1ab5c03
[1])
In order to maintain compatibility, Libadalang.Auto_Provider.Get_Unit
and Libadalang.Project_Provider.Get_Unit
could simply call the class underlying Get_Unit_And_PLE_Root
, with the additional parameters Unit
and PLE_Root_Index
declared in the Get_Unit
function scope, as proposed below instead of explicitly raising a Program_Error
exception
overriding function Get_Unit
(Provider : Auto_Unit_Provider;
Context : Analysis_Context'Class;
Name : Text_Type;
Kind : Analysis_Unit_Kind;
Charset : String := "";
Reparse : Boolean := False) return Analysis_Unit'Class
is
Unit : Analysis_Unit := No_Analysis_Unit;
PLE_Root_Index : Natural := 0;
begin
Provider.Get_Unit_And_PLE_Root
(Context => Context,
Name => Name,
Kind => Kind,
Charset => Charset,
Reparse => Reparse,
Unit => Unit,
PLE_Root_Index => PLE_Root_Index);
return Unit;
end Get_Unit;
[1]
1ab5c03#diff-405ad85e9a2303876561467d05a053fd2d5173d93fc6abd0bd55fd84d36d57c1