Go to the first, previous, next, last section, table of contents.


8.1 Declarative Region

Static Semantics

  1. For each of the following constructs, there is a portion of the program text called its declarative region, within which nested declarations can occur:
    1. any declaration, other than that of an enumeration type, that is not a completion of a previous declaration;
    2. a block_statement;
    3. a loop_statement;
    4. an accept_statement;
    5. an exception_handler.

  1. The declarative region includes the text of the construct together with additional text determined (recursively), as follows:
    1. If a declaration is included, so is its completion, if any.
    2. If the declaration of a library unit (including Standard -- See section 10.1.1 Compilation Units - Library Units, is included, so are the declarations of any child units (and their completions, by the previous rule). The child declarations occur after the declaration.
    3. If a body_stub is included, so is the corresponding subunit.
    4. If a type_declaration is included, then so is a corresponding record_representation_clause, if any.

  1. The declarative region of a declaration is also called the declarative region of any view or entity declared by the declaration.
  2. A declaration occurs immediately within a declarative region if this region is the innermost declarative region that encloses the declaration (the immediately enclosing declarative region), not counting the declarative region (if any) associated with the declaration itself.
  3. A declaration is local to a declarative region if the declaration occurs immediately within the declarative region. An entity is local to a declarative region if the entity is declared by a declaration that is local to the declarative region.
  4. A declaration is global to a declarative region if the declaration occurs immediately within another declarative region that encloses the declarative region. An entity is global to a declarative region if the entity is declared by a declaration that is global to the declarative region.

    NOTES

  5. (1) The children of a parent library unit are inside the parent's declarative region, even though they do not occur inside the parent's declaration or body. This implies that one can use (for example) "P.Q" to refer to a child of P whose defining name is Q, and that after "use P;" Q can refer (directly) to that child.
  6. (2) As explained above and in See section 10.1.1 Compilation Units - Library Units, all library units are descendants of Standard, and so are contained in the declarative region of Standard. They are not inside the declaration or body of Standard, but they are inside its declarative region.
  7. (3) For a declarative region that comes in multiple parts, the text of the declarative region does not contain any text that might appear between the parts. Thus, when a portion of a declarative region is said to extend from one place to another in the declarative region, the portion does not contain any text that might appear between the parts of the declarative region.


Go to the first, previous, next, last section, table of contents.