Commit 950d3e7d by Ed Schonberg Committed by Arnaud Charlet

sem_ch3.ads, [...] (Build_Discriminal): Add link to original discriminant.

2005-11-14  Ed Schonberg  <schonberg@adacore.com>
	    Javier Miranda  <miranda@adacore.com>

	* sem_ch3.ads, sem_ch3.adb (Build_Discriminal): Add link to original
	discriminant.
	(Build_Private_Derived_Type): The entity of the created full view of the
	derived type does not come from source. If after installing the private
	declarations of the parent scope the parent is still private, use its
	full view to construct the full declaration of the derived type.
	(Build_Derived_Record_Type): Relax the condition that controls the
	execution of the check that verifies that the partial view and
	the full view agree in the set of implemented interfaces. In
	addition, this test now only takes into account the progenitors.
	(Derive_Interface_Subprograms): No need to derive subprograms
	of ancestors that are interfaces.
	(Derive_Subprograms): Remove formal No_Predefined_Prims and the
	associated code.
	Change name Is_Package to Is_Package_Or_Generic_Package
	(Complete_Subprograms_Derivation): Handle the case in which the full
	view is a transitive derivation of the ancestor of the partial view.
	(Process_Full_View): Rename local subprogram Find_Interface_In_
	Descendant to Find_Ancestor_Interface to leave the code more clear.
	Remove wrong code that avoids the generation of an error message
	when the immediate ancestor of the partial view is an interface.
	In addition some minor reorganization of the code has been done to
	leave it more clear.
	(Analyze_Type_Declaration): If type has previous incomplete tagged
	partial view, inherit properly its primitive operations.
	(Collect_Interfaces): Make public, for analysis of formal
	interfaces.
	(Analyze_Interface_Declaration): New procedure for use for regular and
	formal interface declarations.
	(Build_Derived_Record_Type): Add support for private types to the code
	that checks if a tagged type implements abstract interfaces.
	(Check_Aliased_Component_Type): The test applies in the spec of an
	instance as well.
	(Access_Type_Declaration): Clean up declaration of malformed type
	declared as an access to its own classwide type, to prevent cascaded
	crash.
	(Collect_Interfaces): For private extensions and for derived task types
	and derived protected types, the parent may be an interface that must
	be included in the interface list.
	(Access_Definition): If the designated type is an interface that may
	contain tasks, create Master_Id for it before analyzing the expression
	of the declaration, which may be an allocator.
	(Record_Type_Declaration): Set properly the interface kind, for use
	in allocators, the creation of master id's for task interfaces, etc.

From-SVN: r107000
parent 04814dad
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -62,6 +62,9 @@ package Sem_Ch3 is ...@@ -62,6 +62,9 @@ package Sem_Ch3 is
-- Called to analyze a list of declarations (in what context ???). Also -- Called to analyze a list of declarations (in what context ???). Also
-- performs necessary freezing actions (more description needed ???) -- performs necessary freezing actions (more description needed ???)
procedure Analyze_Interface_Declaration (T : Entity_Id; Def : Node_Id);
-- Analyze an interface declaration or a formal interface declaration
procedure Analyze_Per_Use_Expression (N : Node_Id; T : Entity_Id); procedure Analyze_Per_Use_Expression (N : Node_Id; T : Entity_Id);
-- Default and per object expressions do not freeze their components, -- Default and per object expressions do not freeze their components,
-- and must be analyzed and resolved accordingly. The analysis is -- and must be analyzed and resolved accordingly. The analysis is
...@@ -97,6 +100,15 @@ package Sem_Ch3 is ...@@ -97,6 +100,15 @@ package Sem_Ch3 is
-- rather than on the declarations that require completion in the package -- rather than on the declarations that require completion in the package
-- declaration. -- declaration.
procedure Collect_Interfaces
(N : Node_Id;
Derived_Type : Entity_Id);
-- Ada 2005 (AI-251): Subsidiary procedure to Build_Derived_Record_Type
-- and Analyze_Formal_Interface_Type.
-- Collect the list of interfaces that are not already implemented by the
-- ancestors. This is the list of interfaces for which we must provide
-- additional tag components.
procedure Derive_Subprogram procedure Derive_Subprogram
(New_Subp : in out Entity_Id; (New_Subp : in out Entity_Id;
Parent_Subp : Entity_Id; Parent_Subp : Entity_Id;
...@@ -114,8 +126,7 @@ package Sem_Ch3 is ...@@ -114,8 +126,7 @@ package Sem_Ch3 is
(Parent_Type : Entity_Id; (Parent_Type : Entity_Id;
Derived_Type : Entity_Id; Derived_Type : Entity_Id;
Generic_Actual : Entity_Id := Empty; Generic_Actual : Entity_Id := Empty;
No_Predefined_Prims : Boolean := False; No_Predefined_Prims : Boolean := False);
Predefined_Prims_Only : Boolean := False);
-- To complete type derivation, collect/retrieve the primitive operations -- To complete type derivation, collect/retrieve the primitive operations
-- of the parent type, and replace the subsidiary subtypes with the derived -- of the parent type, and replace the subsidiary subtypes with the derived
-- type, to build the specs of the inherited ops. For generic actuals, the -- type, to build the specs of the inherited ops. For generic actuals, the
...@@ -124,9 +135,7 @@ package Sem_Ch3 is ...@@ -124,9 +135,7 @@ package Sem_Ch3 is
-- the derived subprograms are aliased to those of the actual, not those of -- the derived subprograms are aliased to those of the actual, not those of
-- the ancestor. The last two params are used in case of derivation from -- the ancestor. The last two params are used in case of derivation from
-- abstract interface types: No_Predefined_Prims is used to avoid the -- abstract interface types: No_Predefined_Prims is used to avoid the
-- derivation of predefined primitives from the interface, and Predefined -- derivation of predefined primitives from an abstract interface.
-- Prims_Only is used to complete the derivation predefined primitives
-- in case of private tagged types implementing interfaces.
-- --
-- Note: one might expect this to be private to the package body, but -- Note: one might expect this to be private to the package body, but
-- there is one rather unusual usage in package Exp_Dist. -- there is one rather unusual usage in package Exp_Dist.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment