Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
-
variable-dcl = typed-variable-dcl / untyped-variable-dcl typed-variable-dcl = TYPED-NAME [array-dim] untyped-variable-dcl = IDENTIFIER [array-clause / as-clause] array-clause = array-dim [as-clause] as-clause = as-auto-object / as-type
-
Static Semantics
A <typed-variable-dcl> defines a variable (section 2.3) whose variable name (section 2.3) is the name value (section 3.3.5.1) of the <TYPED-NAME>.
If the optional <array-dim> is not present the declared type (section 2.2) of the defined variable is the declared type of the <TYPED-NAME>.
If the optional <array-dim> is present and does not include a <bounds-list> then the declared type of the defined variable is resizable array (section 2.2) with an element type (section 2.1.1) that is the declared type of the <TYPED-NAME>.
If the optional <array-dim> is present and includes a <bounds-list> then the declared type of the defined variable is fixed-size array (section 2.2) with an element type that is the declared type of the <TYPED-NAME>. The number of dimensions and the upper bound (section 2.1) and lower bound (section 2.1) for each dimension is as defined by the <bounds-list>.
An <untyped-variable-dcl> that includes an <as-clause> containing an <as-auto-object> element defines an automatic instantiation variable (section 2.5.1). If the <untyped-variable-dcl> also includes an <array-dim> element then each dependent variable (section 2.3.1) of the defined array variable is an automatic instantiation variable.
If the <untyped-variable-dcl> does not include an <as-clause> (either directly or as part of an <array-clause> this is an implicitly typed (section 5.2.2) declaration and its implicit declared type (section 5.2.3.1.5). The following rules apply:
The declared type of a variable defined by an implicitly typed declaration that does not include an <array-clause> is the same as its implicit declared type.
The declared type of a variable defined by an implicitly typed declaration that includes an <array-clause> whose <array-dim> element does not contain a <bounds-list> is resizable array whose declared element type is the same as the implicit declared type.
The declared type of a variable defined by an implicitly typed declaration that includes an <array-clause> whose <array-dim> element contains a <bounds-list> is fixed size array with a declared element type is the same as the implicit declared type. The number of dimensions and the upper bound and lower bound for each dimension is as defined by the <bounds-list>.
If the <untyped-variable-dcl> includes an <array-clause> containing an <as-clause> the following rules apply:
If the <array-dim> of the <array-clause> does not contain a <bounds-list> the declared type of the defined variable is resizable array with a declared element type as the specified type of the <as-clause>.
If the <array-dim> of the <array-clause> contains a <bounds-list> the declared type of the defined variable is fixed size array with a declared element type as the specified type of the <as-clause>. The number of dimensions and the upper and lower bound for each dimension is as defined by the <bounds-list>.
If the <as-clause> consists of an <as-auto-object> each dependent variable of the defined variable is an automatic instantiations variable.
If the <untyped-variable-dcl> includes an <as-clause> but does not include an <array-clause> the following rules apply:
The declared type of the defined variable is the specified type of the <as-clause>.
If the <as-clause> consists of an <as-auto-object> the defined variable is an automatic instantiations variable.