home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Geek Gadgets 1
/
ADE-1.bin
/
ade-dist
/
gnat-2.06-src.tgz
/
tar.out
/
fsf
/
gnat
/
ada
/
sem_ch12.ads
< prev
next >
Wrap
Text File
|
1996-09-28
|
5KB
|
86 lines
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S E M _ C H 1 2 --
-- --
-- S p e c --
-- --
-- $Revision: 1.8 $ --
-- --
-- Copyright (c) 1992,1993,1994 NYU, All Rights Reserved --
-- --
-- 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- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. --
-- --
------------------------------------------------------------------------------
with Types; use Types;
package Sem_Ch12 is
procedure Analyze_Generic_Package_Declaration (N : Node_Id);
procedure Analyze_Generic_Subprogram_Declaration (N : Node_Id);
procedure Analyze_Package_Instantiation (N : Node_Id);
procedure Analyze_Procedure_Instantiation (N : Node_Id);
procedure Analyze_Function_Instantiation (N : Node_Id);
procedure Analyze_Formal_Object_Declaration (N : Node_Id);
procedure Analyze_Formal_Type_Declaration (N : Node_Id);
procedure Analyze_Formal_Subprogram (N : Node_Id);
procedure Analyze_Formal_Package (N : Node_Id);
function Copy_Generic_Node
(N : Node_Id;
Parent_Id : Node_Id;
Instantiating : Boolean)
return Node_Id;
-- Copy the tree for a generic unit or its body. The unit is copied
-- repeatedly: once to produce a copy on which semantic analysis of
-- the generic is performed, and once for each instantiation. The tree
-- being copied is not semantically analyzed, except that references to
-- global entities are marked on terminal nodes.
procedure Instantiate_Package_Body
(N : Node_Id;
Act_Decl : Node_Id);
-- Called after semantic analysis, to complete the instantiation of
-- package bodies. In this fashion complex cross-dependencies between
-- several package declarations and bodies containing generics can
-- be compiled which otherwise would diagnose spurious circularities.
-- For example, it is possible to compile two packages A and B that
-- have the follwing structure:
--
-- package A is package B is
-- generic ... generic ...
-- package G_A is package G_B is
--
-- with B; with A;
-- package body A is package body B is
-- package N_B is new G_B (..) package N_A is new G_A (..)
procedure Instantiate_Subprogram_Body
(N : Node_Id;
Act_Decl : Node_Id);
-- Called after semantic analysis to complete the instantiation of
-- subprogram bodies.
procedure Save_Global_References (N : Node_Id);
-- Traverse the original generic unit, and capture all references to
-- entities that are defined outside of the generic in the analyzed
-- tree for the template. These references are copied into the original
-- tree, so that they appear automatically in every instantiation.
-- A critical invariant in this approach is that if an id in the generic
-- resolves to a local entity, the corresponding id in the instance
-- will resolve to the homologous entity in the instance, even though
-- the enclosing context for resolution is different, as long as the
-- global references have been captured as described here.
end Sem_Ch12;