-- The usual approach is to build a new node using this function and
-- then, using the value returned, use the Set_xxx functions to set
-- fields of the node as required. New_Node can only be used for
- -- non-entity nodes, i.e. it never generates an extended node.
+ -- non-entity nodes.
--
-- If we are currently parsing, as indicated by a previous call to
-- Set_Comes_From_Source_Default (True), then this call also resets
-- returns Empty, and New_Copy (Error) returns Error. Note that, unlike
-- Copy_Separate_Tree, New_Copy does not recursively copy any descendants,
-- so in general parent pointers are not set correctly for the descendants
- -- of the copied node. Both normal and extended nodes (entities) may be
- -- copied using New_Copy.
+ -- of the copied node.
function Relocate_Node (Source : Node_Id) return Node_Id;
-- Source is a non-entity node that is to be relocated. A new node is
-- caller, according to context.
procedure Extend_Node (Source : Node_Id);
- -- This turns a node into an entity; it function is used only by Sinfo.CN.
+ -- This turns a node into an entity; it is only used by Sinfo.CN.
type Ignored_Ghost_Record_Proc is access procedure (N : Node_Or_Entity_Id);
-- newly constructed replacement subtree. The actual mechanism is to swap
-- the contents of these two nodes fixing up the parent pointers of the
-- replaced node (we do not attempt to preserve parent pointers for the
- -- original node). Neither Old_Node nor New_Node can be extended nodes.
+ -- original node).
-- ??? The above explanation is incorrect, instead Copy_Node is called.
--
-- Note: New_Node may not contain references to Old_Node, for example as
-- for this purpose, so e.g. in X := (if A then B else C);
-- Paren_Count for the right side will be 1.
- -- Comes_From_Check_Or_Contract
- -- This flag is present in all N_If_Statement nodes and
- -- gets set when an N_If_Statement is generated as part of
- -- the expansion of a Check, Assert, or contract-related
- -- pragma.
-
-- Comes_From_Source
-- This flag is present in all nodes. It is set if the
-- node is built by the scanner or parser, and clear if
-- attribute definition clause is given, rather than testing this at the
-- freeze point.
+ -- Comes_From_Check_Or_Contract
+ -- This flag is present in all N_If_Statement nodes and
+ -- gets set when an N_If_Statement is generated as part of
+ -- the expansion of a Check, Assert, or contract-related
+ -- pragma.
+
-- Comes_From_Extended_Return_Statement
-- Present in N_Simple_Return_Statement nodes. True if this node was
-- constructed as part of the N_Extended_Return_Statement expansion.
-- fields are defined (and access subprograms declared) in package
-- Einfo.
- -- Note: N_Defining_Identifier is an extended node whose fields are
- -- deliberately laid out to match the layout of fields in an ordinary
- -- N_Identifier node allowing for easy alteration of an identifier
- -- node into a defining identifier node. For details, see procedure
- -- Sinfo.CN.Change_Identifier_To_Defining_Identifier.
-
-- N_Defining_Identifier
-- Sloc points to identifier
-- Chars contains the Name_Id for the identifier
-- additional fields are defined (and access subprograms declared)
-- in package Einfo.
- -- Note: N_Defining_Character_Literal is an extended node whose fields
- -- are deliberately laid out to match layout of fields in an ordinary
- -- N_Character_Literal node, allowing for easy alteration of a character
- -- literal node into a defining character literal node. For details, see
- -- Sinfo.CN.Change_Character_Literal_To_Defining_Character_Literal.
-
-- N_Defining_Character_Literal
-- Sloc points to literal
-- Chars contains the Name_Id for the identifier
-- additional fields are defined (and access subprograms declared)
-- in package Einfo.
- -- Note: N_Defining_Operator_Symbol is an extended node whose fields
- -- are deliberately laid out to match the layout of fields in an
- -- ordinary N_Operator_Symbol node allowing for easy alteration of
- -- an operator symbol node into a defining operator symbol node.
- -- See Sinfo.CN.Change_Operator_Symbol_To_Defining_Operator_Symbol
- -- for further details.
-
-- N_Defining_Operator_Symbol
-- Sloc points to literal
-- Chars contains the Name_Id for the operator symbol
subtype Entity_Id is Node_Id;
-- A synonym for node types, used in the Einfo package to refer to nodes
- -- that are entities (i.e. nodes with an Nkind of N_Defining_xxx). All such
- -- nodes are extended nodes and these are the only extended nodes, so that
- -- in practice entity and extended nodes are synonymous.
+ -- that are entities (i.e. nodes with an Nkind of N_Defining_xxx).
--
-- Note that Sinfo.Nodes.N_Entity_Id is the same as Entity_Id, except it
-- has a predicate requiring the correct Nkind. Opt_N_Entity_Id is the same