===================================================================
@@ -1428,7 +1428,7 @@
if Present (Project_Of_Renamed_Package) then
- -- Renamed package
+ -- Renamed or extending package
declare
Project_Name : constant Name_Id :=
@@ -1466,8 +1466,6 @@
In_Tree => In_Tree);
end;
- -- Standard package declaration, not renaming
-
else
-- Set the default values of the attributes
@@ -1482,19 +1480,22 @@
(Current_Item, From_Project_Node_Tree)),
Project_Level => False);
- -- And process declarative items of the new package
+ end if;
- Process_Declarative_Items
- (Project => Project,
- In_Tree => In_Tree,
- Flags => Flags,
- From_Project_Node => From_Project_Node,
- From_Project_Node_Tree => From_Project_Node_Tree,
- Pkg => New_Pkg,
- Item =>
- First_Declarative_Item_Of
- (Current_Item, From_Project_Node_Tree));
- end if;
+ -- Process declarative items (nothing to do when the
+ -- package is renaming, as the first declarative item is
+ -- null).
+
+ Process_Declarative_Items
+ (Project => Project,
+ In_Tree => In_Tree,
+ Flags => Flags,
+ From_Project_Node => From_Project_Node,
+ From_Project_Node_Tree => From_Project_Node_Tree,
+ Pkg => New_Pkg,
+ Item =>
+ First_Declarative_Item_Of
+ (Current_Item, From_Project_Node_Tree));
end;
end if;
===================================================================
@@ -1027,8 +1027,9 @@
First_Attribute : Attribute_Node_Id := Empty_Attribute;
Current_Package : Package_Node_Id := Empty_Package;
First_Declarative_Item : Project_Node_Id := Empty_Node;
-
Package_Location : constant Source_Ptr := Token_Ptr;
+ Renaming : Boolean := False;
+ Extending : Boolean := False;
begin
Package_Declaration :=
@@ -1149,13 +1150,20 @@
end if;
if Token = Tok_Renames then
+ Renaming := True;
+ elsif Token = Tok_Extends then
+ Extending := True;
+ end if;
+
+ if Renaming or else Extending then
if Is_Config_File then
Error_Msg
(Flags,
- "no package renames in configuration projects", Token_Ptr);
+ "no package rename or extension in configuration projects",
+ Token_Ptr);
end if;
- -- Scan past "renames"
+ -- Scan past "renames" or "extends"
Scan (In_Tree);
@@ -1249,7 +1257,9 @@
end if;
end if;
end if;
+ end if;
+ if Renaming then
Expect (Tok_Semicolon, "`;`");
Set_End_Of_Line (Package_Declaration);
Set_Previous_Line_Node (Package_Declaration);
@@ -1305,7 +1315,7 @@
Remove_Next_End_Node;
else
- Error_Msg (Flags, "expected IS or RENAMES", Token_Ptr);
+ Error_Msg (Flags, "expected IS", Token_Ptr);
end if;
end Parse_Package_Declaration;