![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Function Body_Stub
function Body_Stub (Declaration : in Asis.Declaration; Library : in Asis.Library) return Asis.Declaration;
function Body_Stub (Declaration : in Asis.Declaration) return Asis.Declaration;Expanded Name Asis.Declarations.Body_Stub
Returns the body-stub declaration from the parent unit corresponding to the specified subunit declaration.
Description
Body stubs and subunits are defined by the following syntax:
Ada83 LRM 10.2, Ada95 LRM 10.1.3
body_stub ::=
subprogram_specification is separate;
| package body package_simple_name
is separate;
| task body task_simple_name is separate;subunit ::=
separate (parent_unit_name) proper bodyThis function returns the body-stub declaration for the specified subunit declaration.
If a non-nil element is returned, the Compilation_Units.Enclosing_Library of the returned element will be the same as the specified library.
Parameters
Declaration : in Asis.Declaration;Specifies the declaration for which the body-stub declaration must be returned. The declaration must represent a subunit (Is_Subunit must return True). The declaration must be of the following kinds:
Element_Kinds Declaration_Kinds
A_Declaration A_Function_Body_Declaration
A_Package_Body_Declaration
A_Procedure_Body_Declaration
A_Task_Body_Declaration
Library : in Asis.Library;Specifies the library from which the declaration must be returned.
If a library is not specified, the Enclosing_Library of the Declaration parameter is assumed. These calls produce identical results:
Decl1 := Asis.Declarations.Body_Stub (Decl);Decl2 := Asis.Declarations.Body_Stub (Decl1, Asis.Compilation_Units.Enclosing_Library (Asis.Compilation_Units. Enclosing_Compilation_Unit (Decl1));
return Asis.Declaration;The returned element is of the following kinds:
Element_Kinds Declaration_Kinds
A_Declaration A_Function_Body_Stub
A_Package_Body_Stub
A_Procedure_Body_Stub
A_Task_Body_Stub
If the parent unit does not exist in the implied or specified library, Asis.Nil_Element is returned.
Errors
Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.
Asis_Inappropriate_Library is raised and Environment.Status is set to Value_Error if a library variable is specified that is no longer open.
Asis_Failed is raised and Environment.Status is set to Obso-
lete_Reference_Error if a parameter is part of an obsolete
compilation unit.Examples
package body Sorting is procedure Quick_Sort (...) is separate;end Sorting;
separate (Sorting)procedure Quick_Sort (...) is ...The element that represents the separate procedure implementation is a Declaration_Kinds of A_Procedure_Body. When the Body_Stub function is called with this element, it returns an element with a Declaration_Kinds of A_Procedure_Body_Stub. This element represents the separate declaration of the procedure within package Sorting.
Cross-References
- function Is_Body_Stub
- function Is_Subunit
- function Subunit
- function Compilation_Units.Enclosing_Compilation_Unit
- function Compilation_Units.Enclosing_Library
- "Processing Body Stubs and Subunits"
- Ada83 LRM 10.2, Ada95 LRM 10.1.3
Function Corresponding_Body
function Corresponding_Body (Declaration : in Asis.Declaration; Library : in Asis.Library) return Asis.Declaration;
function Corresponding_Body (Declaration : in Asis.Declaration) return Asis.Declaration;Expanded Name Asis.Declarations.Corresponding_Body
Returns the corresponding body if the specified declaration is a subprogram, package, or task declaration; returns the expanded generic body template if the specified declaration is a generic instantiation.
Description
If a body declaration is specified, the same element is returned.
If a non-nil element is returned, the Compilation_Units.Enclosing_Library of the returned element will be the same as the specified library.
The specified library need not be the Compilation_Units.Enclosing_Library of the declaration.
If a generic instantiation is specified, the body representing the expanded generic body template is returned as follows:
The Elements.Enclosing_Element of the expanded generic body is the generic instantiation. The Compilation_Units.Enclosing-
_Compilation_Unit of the expanded template is that of the instantiation.Implicit predefined operations and attributes (for example, +, –, 'Image, and so on) do not typically have unit bodies. Explicitly specified overloading of predefined operations will have corresponding bodies.
Predefined operators, attributes, packages, subprograms, and so on, or derived instances of these entities, do not have bodies.
Parameters
Declaration : in Asis.Declaration;Specifies the declaration for which the corresponding body should be returned. The declaration must be of the following kinds for the return of the corresponding specification:
If the declaration represents a body, the same element is returned. The declaration must be of the following kinds:
Library : in Asis.Library;Specifies the library from which the declaration must be returned.
If a library is not specified, the Enclosing_Library of the declaration parameter is assumed. These calls produce identical results:
Decl1 := Asis.Declarations.Corresponding_Body (Decl);Decl2 := Asis.Declarations.Corresponding_Body (Decl1, Asis.Compilation_Units.Enclosing_Library (Asis.Compilation_Units. Enclosing_Compilation_Unit (Decl1));
return Asis.Declaration;The returned element is of the following kinds:
If a corresponding body does not exist in the implied or specified library, Asis.Nil_Element is returned.
Errors
Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.
Asis_Inappropriate_Library is raised and Environment.Status is set to Value_Error if a library variable is specified that is no longer open.
Asis_Failed is raised and Environment.Status is set to Obso-
lete_Reference_Error if a parameter is part of an obsolete
compilation unit.Examples
Cross-References
- function Corresponding_Specification
- function Is_Function
- function Is_Package
- function Is_Procedure
- function Is_Specification
- function Is_Subprogram
- function Is_Task
Function Corresponding_Constant_Declaration
function Corresponding_Constant_Declaration (Name : in Asis.Entity_Name_Definition) return Asis.Declaration;Expanded Name Asis.Declarations.Corresponding_Constant_Declaration
Returns the full constant declaration corresponding to the specified name from a deferred constant declaration or the deferred constant declaration corresponding to the specified name from a full constant declaration.
Description
The name of a declaration can be obtained from the Names or Expressions.Name_Definition functions.
Parameters
Name : in Asis.Entity_Name_Definition;Specifies the constant or deferred constant declaration for which the corresponding declaration must be returned. The name must be of the following kinds:
Element_Kinds
An_Entity_Name_Definition
return Asis.Declaration;The returned element is of the following kinds:
Element_Kinds Declaration_Kinds
A_Declaration A_Constant_Declaration
A_Deferred_Constant_Declaration
If a full constant declaration is specified and a deferred constant declaration does not exist, Asis.Nil_Element is returned.
Errors
Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.
Asis_Failed is raised and Environment.Status is set to Obso-
lete_Reference_Error if a parameter is part of an obsolete
compilation unit.Examples
Cross-References
- function Initial_Value
- function Is_Constant
- function Is_Initialized
- function Is_Variable
- function Names
- function Object_Declaration_Definition
- function Expressions.Name_Definition
Function Corresponding_Equality_Operator
function Corresponding_Equality_Operator (Declaration : in Asis.Declaration) return Asis.Declaration;Expanded Name Asis.Declarations.Corresponding_Equality_Operator
Returns the complementary operator function declaration for the specified equality or inequality declaration.
Description
Given an equality (=) operator declaration, this function returns the corresponding inequality (/=) operator declaration; given an inequality (/=) operator declaration, this function returns the corresponding equality (=) operator declaration.
Parameters
Declaration : in Asis.Declaration;Specifies the equality operator function declaration for which the corresponding declaration must be returned. The declaration must be of the following kinds:
Element_Kinds Declaration_Kinds
A_Declaration A_Function_Declaration (/= or =)
return Asis.Declaration;The returned element is of the following kinds:
Element_Kinds Declaration_Kinds
A_Declaration A_Function_Declaration (/= or =)
If the underlying Ada implementation does not define an implicit inequality operator, Asis.Nil_Element is returned. For a description of the variations in the implementation of equality private-type operators, see "Equality Operators."
Errors
Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.
Asis_Failed is raised and Environment.Status is set to Obso-
lete_Reference_Error if a parameter is part of an obsolete
compilation unit.Examples
Cross-References
- function Corresponding_Type
- function Implicit_Attribute_Functions
- function Implicit_Derived_Subprograms
- function Implicit_Predefined_Operators
- function Is_Part_Of_Derived
- function Is_Part_Of_Implicit
- function Subprogram_Derivation
- function Type_Operators
- "Equality Operators"
- Ada83 LRM 6.7, Ada95 LRM 6.6
Function Corresponding_Generic_Element
function Corresponding_Generic_Element (Reference : in Asis.Element) return Asis.Entity_Name_Definition;Expanded Name Asis.Declarations.Corresponding_Generic_Element
Returns the entity-name definition in a generic template for the specified generic instantiation entity reference.
Description
A generic instantiation creates, implicitly, an expanded generic instance. The instance is created by substituting actual parameters for the formal parameters in the generic template. This function returns the corresponding declaration in the template given an entity from a generic instance.
This function returns the An_Entity_Name_Definition from the generic template that corresponds to the entity referenced. The entity may refer to a subprogram declaration, a derived subprogram declaration, or an implicit operator, attribute, or subprogram declaration.
If the reference does not refer to an entity declared as a subcomponent of a generic package instantiation, Asis.Nil_Element is returned.
Parameters
Reference : in Asis.Element;Specifies an expression that references an entity declared within the implicit specification or body of a generic instantiation. The corresponding generic element is returned for this reference. The reference must be of the following kinds:
Element_Kinds Expression_Kinds
An_Expression A_Character_Literal
A_Simple_Name
An_Enumeration_Literal
An_Operator_Symbol
return Asis.Entity_Name_Definition;The returned element is of the following kind:
Element_Kinds
An_Entity_Name_Definition
Errors
Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.
Asis_Failed is raised and Environment.Status is set to Obso-
lete_Reference_Error if a parameter is part of an obsolete
compilation unit.Examples
genericpackage A_Generic is procedure Abc;end A_Generic;procedure Test is package A_Specific is new A_Generic;begin A_Specific.Abc;end Test;The Abc of A_Specific.Abc is a reference to the Abc that is implicitly declared by the expanded generic instance of A_Generic. Given the reference to A_Specific.Abc, this function returns An_Entity_Name_Definition of Abc in the generic template.
Cross-References
- function Enclosing_Generic
- function Generic_Formal_Parameters
- function Generic_Formal_Subprogram_Default
- function Generic_Formal_Subprogram_Default_Kind
- function Is_Generic
- function Is_Generic_Formal
- function Is_Part_Of_Instance
Function Corresponding_Specification
function Corresponding_Specification (Declaration : in Asis.Declaration; Library : in Asis.Library) return Asis.Declaration;
function Corresponding_Specification (Declaration : in Asis.Declaration) return Asis.Declaration;Expanded Name Asis.Declarations.Corresponding_Specification
Returns the corresponding specification for the specified subprogram, package, or task-body declaration; returns the expanded generic specification template for the specified generic
instantiation.Description
If a specification is specified, the same element is returned.
If the corresponding body does not exist in the implied or specified library, Asis.Nil_Element is returned. If a non-nil element is returned, the Compilation_Units.Enclosing_Library of the returned element will be the same as the specified library.
If a specification does not exist, Asis.Nil_Element is returned. This occurs when a subprogram body is specified without a corresponding subprogram specification.
If the specification is the proper body of a subunit, Asis.Nil_Element is returned. The Subunit function can be called to obtain the specification corresponding to the body.
The specified library need not be the Compilation_Units.Enclosing_Library of the declaration.
If a generic instantiation is specified, the specification representing the instantiation is returned as follows:
Input Declaration_Kinds Returned Declaration_Kinds
A_Function_Instantiation A_Function_Declaration
A_Package_Instantiation A_Package_Declaration
A_Procedure_Instantiation A_Procedure_Declaration
The Elements.Enclosing_Element of the expanded specification is the generic instantiation. The Compilation_Units.Enclosing-
_Compilation_Unit of the expanded template is that of the instantiation.Parameters
Declaration : in Asis.Declaration;Specifies the declaration for which the corresponding specification should be returned.
The declaration must be of the following kinds for the return of the corresponding specification:
If the declaration represents a specification, the same element is returned. The declaration must be of the following kinds:
Library : in Asis.Library;Specifies the library from which the declaration must be returned.
If a library is not specified, the Enclosing_Library of the Declaration parameter is assumed. These calls produce identical results:
Decl1 := Asis.Declarations. Corresponding_Specification (Decl);Decl2 := Asis.Declarations. Corresponding_Specification (Decl1, Asis.Compilation_Units.Enclosing_Library (Asis.Compilation_Units. Enclosing_Compilation_Unit (Decl1));The returned element is of the following kinds:
Errors
Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.
Asis_Inappropriate_Library is raised and Environment.Status is set to Value_Error if a library variable is specified that is no longer open.
Asis_Failed is raised and Environment.Status is set to Obso-
lete_Reference_Error if a parameter is part of an obsolete
compilation unit.Examples
Cross-References
- function Corresponding_Body
- function Is_Function
- function Is_Package
- function Is_Procedure
- function Is_Specification
- function Is_Subprogram
- function Is_Task
- function Subunit
Function Corresponding_Type
function Corresponding_Type (Declaration : in Asis.Declaration) return Asis.Type_Definition;Expanded Name Asis.Declarations.Corresponding_Type
Returns the type definition for which the specified declaration is a subprogram, operator, or attribute-function declaration.
Description
The result of this function is often a derived type.
Subprograms have a corresponding type only when they are implicitly declared as the result of the declaration of a derived type, where there is a subprogram declared in the same scope as the parent type, and the subprogram has a parameter or a return value that is of the parent type. If a corresponding type does not exist, Asis.Nil_Element is returned.
Parameters
Declaration : in Asis.Declaration;Specifies the subprogram, operator, or attribute-function declaration for which the corresponding type declaration must be returned. The declaration must be Is_Part_Of_Implicit. The declaration must be of the following kinds:
Element_Kinds Declaration_Kinds
A_Declaration A_Function_Declaration
A_Procedure_Declaration
return Asis.Type_Definition;The returned element is of the following kinds:
Element_Kinds Declaration_Kinds
A_Declaration Any Type_Definition_Kinds except A_Subtype_Declaration
Errors
Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.
Asis_Failed is raised and Environment.Status is set to Obso-
lete_Reference_Error if a parameter is part of an obsolete
compilation unit.Examples
Cross-References
- function Corresponding_Equality_Operator
- function Implicit_Attribute_Functions
- function Implicit_Derived_Subprograms
- function Implicit_Predefined_Operators
- function Is_Part_Of_Derived
- function Is_Part_Of_Implicit
- function Subprogram_Derivation
- function Type_Operators
- function Type_Definitions.Ground_Type
Function Corresponding_Type_Declaration
function Corresponding_Type_Declaration (Declaration : in Asis.Declaration; Library : in Asis.Library) return Asis.Declaration;
function Corresponding_Type_Declaration (Declaration : in Asis.Declaration) return Asis.Declaration;Expanded Name Asis.Declarations.Corresponding_Type_Declaration
Returns the full-type declaration corresponding to the specified private- or incomplete-type declaration, or returns the private- or incomplete-type declaration corresponding to the specified full- type declaration.
Description
If the specified type declaration does not have a corresponding private or incomplete type declaration, Asis.Nil_Element is returned.
The value of the Library parameter is always checked for validity but otherwise is not used unless the full-type declaration corresponding to an incomplete type is in a corresponding package body (Ada83 LRM 3.8.1, Ada95 LRM 3.10.1).
If the corresponding type definition does not exist in the implied or specified library, Asis.Nil_Element is returned. If a non-nil element is returned, the Compilation_Units.Enclosing_Library of the returned element will be the same as the specified library.
If a non-nil result is returned, the Compilation_Units.Enclosing_Library of the result is the same as the specified library.
Parameters
Declaration : in Asis.Declaration;Specifies the declaration for which the corresponding type declaration must be returned. The declaration must be of the following kinds:
Element_Kinds Declaration_Kinds
A_Declaration A_Full_Type_Declaration
A_Private_Type_Declaration
A_Task_Type_Declaration
An_Incomplete_Type_Declaration
Library : in Asis.Library;Specifies the library from which the corresponding declaration must be returned.
If a library is not specified, the Enclosing_Library of the Declaration parameter is assumed. These calls produce identical results:
Decl1 := Asis.Declarations. Corresponding_Type_Declaration (Decl);Decl2 := Asis.Declarations. Corresponding_Type_Declaration (Decl1, Asis.Compilation_Units.Enclosing_Library (Asis.Compilation_Units. Enclosing_Compilation_Unit (Decl1));
return Asis.Declaration;The returned element is of the following kinds:
Element_Kinds Declaration_Kinds
A_Declaration A_Full_Type_Declaration
A_Private_Type_Declaration
A_Task_Type_Declaration
An_Incomplete_Type_Declaration
Errors
Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.
Asis_Inappropriate_Library is raised and Environment.Status is set to Value_Error if a library variable is specified that is no longer open.
Asis_Failed is raised and Environment.Status is set to Obso-
lete_Reference_Error if a parameter is part of an obsolete
compilation unit.Examples
Cross-References
Rational Software Corporation
http://www.rational.com support@rational.com techpubs@rational.com Copyright © 1993-2001, Rational Software Corporation. All rights reserved. |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |