Class_Present : Boolean := False;
Or_Rep_Item : Boolean := False) return Node_Id;
-- Find the aspect specification of aspect A (or A'Class if Class_Present)
- -- associated with entity I.
+ -- associated with entity Id.
-- If found, then return the aspect specification.
-- If not found and Or_Rep_Item is true, then look for a representation
-- item (as opposed to an N_Aspect_Specification node) which specifies
function Base_Type (Id : E) return E is
begin
- if Is_Base_Type (Id) then
- return Id;
- else
- pragma Assert (Is_Type (Id));
- return Etype (Id);
- end if;
+ return Result : E do
+ if Is_Base_Type (Id) then
+ Result := Id;
+ else
+ pragma Assert (Is_Type (Id));
+ Result := Etype (Id);
+ if False then
+ pragma Assert (Is_Base_Type (Result));
+ -- ???It seems like Base_Type should return a base type,
+ -- but this assertion is disabled because it is not always
+ -- true. Hence the need to say "Base_Type (Base_Type (...))"
+ -- in some cases; Base_Type is not idempotent as one might
+ -- expect.
+ end if;
+ end if;
+ end return;
end Base_Type;
----------------------
----------------
function Next_Index (Id : N) return Node_Id is
- begin
pragma Assert (Nkind (Id) in N_Is_Index);
- pragma Assert (No (Next (Id)) or else Nkind (Next (Id)) in N_Is_Index);
- return Next (Id);
+ Result : constant Node_Id := Next (Id);
+ pragma Assert (No (Result) or else Nkind (Result) in N_Is_Index);
+ begin
+ return Result;
end Next_Index;
------------------
-- First_Component (synthesized)
-- Applies to incomplete, private, protected, record and task types.
-- Returns the first component by following the chain of declared
--- entities for the type a component is found (one with an Ekind of
+-- entities for the type until a component is found (one with an Ekind of
-- E_Component). The discriminants are skipped. If the record is null,
-- then Empty is returned.
-- Similar to First_Component, but discriminants are not skipped, so will
-- find the first discriminant if discriminants are present.
+-- First_Discriminant (synthesized)
+-- Defined for types with discriminants or unknown discriminants.
+-- Returns the first in the Next_Discriminant chain; see Sem_Aux.
+
-- First_Entity
-- Defined in all entities that act as scopes to which a list of
-- associated entities is attached, and also in all [sub]types. Some
-- First_Index
-- Defined in array types and subtypes. By introducing implicit subtypes
-- for the index constraints, we have the same structure for constrained
--- and unconstrained arrays, subtype marks and discrete ranges are
--- both represented by a subtype. This function returns the tree node
--- corresponding to an occurrence of the first index (NOT the entity for
--- the type). Subsequent indices are obtained using Next_Index. Note that
--- this field is defined for the case of string literal subtypes, but is
--- always Empty.
+-- and unconstrained arrays, subtype marks and discrete ranges are both
+-- represented by a subtype. This function returns the N_Is_Index tree
+-- node corresponding to the first index (not an entity). Subsequent
+-- indices are obtained using Next_Index. Note that this field is defined
+-- for the case of string literal subtypes, but is always Empty.
-- First_Literal
-- Defined in all enumeration types, including character and boolean
-- all the extra formals (see description of Extra_Formal field)
-- Next_Index (synthesized)
--- Applies to array types and subtypes and to string types and
--- subtypes. Yields the next index. The first index is obtained by
--- using the First_Index attribute, and then subsequent indexes are
--- obtained by applying Next_Index to the previous index. Empty is
--- returned to indicate that there are no more indexes. Note that
--- unlike most attributes in this package, Next_Index applies to
--- nodes for the indexes, not to entities.
+-- Applies to the N_Is_Index node returned by First_Index/Next_Index;
+-- returns the next N_Is_Index node in the chain. Empty is returned to
+-- indicate that there are no more indexes. Note that unlike most
+-- attributes in this package, Next_Index applies to nodes for the
+-- indexes, not to entities.
-- Next_Inlined_Subprogram
-- Defined in subprograms. Used to chain inlined subprograms used in
-- If the aspect is inherited, convert the pointer to the
-- parent type that specifies the contract.
-- If the original access_to_subprogram has defaults for
- -- in_parameters, the call may include named associations, so
- -- we create one for the pointer as well.
+ -- in-mode parameters, the call may include named associations,
+ -- so we create one for the pointer as well.
if Is_Derived_Type (Ptr_Type)
and then Ptr_Type /= Etype (Last_Formal (Wrapper))
Cc (N_Generic_Package_Declaration, N_Generic_Declaration,
(Sy (Specification, Node_Id),
Sy (Generic_Formal_Declarations, List_Id),
- Sy (Aspect_Specifications, List_Id, Default_No_List),
- Sm (Activation_Chain_Entity, Node_Id)));
+ Sy (Aspect_Specifications, List_Id, Default_No_List)));
Cc (N_Generic_Subprogram_Declaration, N_Generic_Declaration,
(Sy (Specification, Node_Id),
-- to incomplete types declared in some enclosing scope, not to limited
-- views from other packages.
- -- Prior to Ada 2012, access to functions parameters must be of mode
- -- 'in'.
+ -- Prior to Ada 2012, all parameters of an access-to-function type must
+ -- be of mode 'in'.
if Present (Formals) then
Formal := First_Formal (Desig_Type);
-- scope all use this field to reference the corresponding scope entity.
-- See Einfo for further details.
+ -- Selector_Name
+ -- Present in N_Expanded_Name N_Selected_Component,
+ -- N_Generic_Association, and N_Parameter_Association nodes.
+
-- Shift_Count_OK
-- A flag present in shift nodes to indicate that the shift count is
-- known to be in range, i.e. is in the range from zero to word length
-- GENERIC_FORMAL_PART SUBPROGRAM_SPECIFICATION
-- [ASPECT_SPECIFICATIONS];
- -- Note: Generic_Formal_Declarations can include pragmas
+ -- Note: Generic_Formal_Declarations can include pragmas and use clauses
-- N_Generic_Subprogram_Declaration
-- Sloc points to GENERIC
-- GENERIC_FORMAL_PART PACKAGE_SPECIFICATION
-- [ASPECT_SPECIFICATIONS];
- -- Note: when we do generics right, the Activation_Chain_Entity entry
- -- for this node can be removed (since the expander won't see generic
- -- units any more)???.
-
- -- Note: Generic_Formal_Declarations can include pragmas
+ -- Note: Generic_Formal_Declarations can include pragmas and use clauses
-- N_Generic_Package_Declaration
-- Sloc points to GENERIC
-- Corresponding_Body
-- Generic_Formal_Declarations from generic formal part
-- Parent_Spec
- -- Activation_Chain_Entity
-------------------------------
-- 12.1 Generic Formal Part --
-- Note: unlike the procedure call case, a generic association node
-- is generated for every association, even if no formal parameter
- -- selector name is present. In this case the parser will leave the
- -- Selector_Name field set to Empty, to be filled in later by the
- -- semantic pass.
+ -- selector name is present, in which case Selector_Name is Empty.
-- In Ada 2005, a formal may be associated with a box, if the
-- association is part of the list of actuals for a formal package.
- -- If the association is given by OTHERS => <>, the association is
+ -- If the association is given by OTHERS => <>, the association is
-- an N_Others_Choice (not an N_Generic_Association whose Selector_Name
-- is an N_Others_Choice).
+ -- In source nodes, either Explicit_Generic_Actual_Parameter is present,
+ -- or Box_Present is True. However, Sem_Ch12 generates "dummy" nodes
+ -- with Explicit_Generic_Actual_Parameter = Empty and Box_Present =
+ -- False.
+
-- N_Generic_Association
-- Sloc points to first token of generic association
-- Selector_Name (set to Empty if no formal
-- Default_Name (set to Empty if no subprogram default)
-- Box_Present
-- Expression (set to Empty if no expression present)
+ -- If the default is "is null", then Null_Present is set
+ -- on the Specification of this node.
-- Note: If no subprogram default is present, then Name is set
-- to Empty, and Box_Present is False.
- -- Note: The Expression field is only used for the GNAT extension
- -- that allows a FORMAL_CONCRETE_SUBPROGRAM_DECLARATION to specify
- -- an expression default for generic formal functions.
+ -- Note: The Expression field is for the GNAT extension that allows a
+ -- FORMAL_CONCRETE_SUBPROGRAM_DECLARATION to specify an expression
+ -- default for generic formal functions.
--------------------------------------------------
-- 12.6 Formal Abstract Subprogram Declaration --