+2009-05-06 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch12.adb (Build_Instance_Compilation_Unit_Nodes): Revert previous
+ change. The context clause of a generic instance declaration must be
+ preserved until the end of the compilation, because it may have to be
+ installed/removed repeatedly.
+ The latest change to sem.adb ensures that the context of both spec and
+ body of an instance is traversed before the instance itself, making
+ this patch redundant.
+
+2009-05-06 Robert Dewar <dewar@adacore.com>
+
+ * sem_aggr.adb: Minor code clean-up
+
2009-05-06 Gary Dismukes <dismukes@adacore.com>
* sem_aggr.adb: Fix typo.
if Nkind (N) = N_Extension_Aggregate then
- -- If the ancestor part is a C++ constructor we must handle
- -- here that it is a function returning a class-wide type
+ -- If the ancestor part is a C++ constructor, then it must be a
+ -- function returning a class-wide type, so check that here.
- if Is_CPP_Constructor_Call (Ancestor_Part (N)) then
- pragma Assert
- (Is_Class_Wide_Type (Etype (Ancestor_Part (N))));
- Root_Typ := Root_Type (Etype (Ancestor_Part (N)));
- else
- Root_Typ := Base_Type (Etype (Ancestor_Part (N)));
- end if;
+ pragma Assert
+ (not Is_CPP_Constructor_Call (Ancestor_Part (N))
+ or else Is_Class_Wide_Type (Etype (Ancestor_Part (N))));
+
+ Root_Typ := Base_Type (Etype (Ancestor_Part (N)));
else
Root_Typ := Root_Type (Typ);
begin
-- A new compilation unit node is built for the instance declaration.
- -- Place the context of the compilation this declaration, so that it
- -- it is processed before the instance in CodePeer.
Decl_Cunit :=
Make_Compilation_Unit (Sloc (N),
- Context_Items => Context_Items (Parent (N)),
+ Context_Items => Empty_List,
Unit => Act_Decl,
Aux_Decls_Node =>
Make_Compilation_Unit_Aux (Sloc (N)));
Set_Parent_Spec (Act_Decl, Parent_Spec (N));
- Set_Context_Items (Parent (N), Empty_List);
-- The new compilation unit is linked to its body, but both share the
-- same file, so we do not set Body_Required on the new unit so as not
Act_Decl : constant Node_Id := Body_Info.Act_Decl;
Inst_Node : constant Node_Id := Body_Info.Inst_Node;
Loc : constant Source_Ptr := Sloc (Inst_Node);
- Gen_Id : constant Node_Id := Name (Inst_Node);
- Gen_Unit : constant Entity_Id := Get_Generic_Entity (Inst_Node);
- Gen_Decl : constant Node_Id := Unit_Declaration_Node (Gen_Unit);
- Anon_Id : constant Entity_Id :=
+ Gen_Id : constant Node_Id := Name (Inst_Node);
+ Gen_Unit : constant Entity_Id := Get_Generic_Entity (Inst_Node);
+ Gen_Decl : constant Node_Id := Unit_Declaration_Node (Gen_Unit);
+ Anon_Id : constant Entity_Id :=
Defining_Unit_Name (Specification (Act_Decl));
- Pack_Id : constant Entity_Id :=
+ Pack_Id : constant Entity_Id :=
Defining_Unit_Name (Parent (Act_Decl));
Decls : List_Id;
Gen_Body : Node_Id;