Next: Enforcing Constraints
Up: Type Analysis
Previous: Statements
The region that is the field specifier of a field identifier is excluded
from the enclosing scopes.
Thus an applied occurrence of a field identifier must identify a defining
occurrence in a specific record.
Moreover, the record's scope is obtained from the variable whose field is
being accessed:
Qualified identifiers[40]
:
TREE SYMBOL FldIdUse INHERITS IdentOcc, QualIdUse, ChkQualIdUse END;
RULE: variable ::= variable '.' FldIdUse COMPUTE
FldIdUse.ScopeKey=variable[2].Type;
END;
This macro is defined in definitions 40, 42, and 43.
This macro is invoked in definition 1.
This requires another library module:
Instantiate appropriate modules[41]
:
$/Name/ScopeProp.gnrc :inst
This macro is defined in definitions 41 and 44.
This macro is invoked in definition 2.
A record definition exports its field environment.
The key carrying that environment is the type of the record:
Qualified identifiers[42]
:
SYMBOL Record INHERITS ExportRange COMPUTE
SYNT.ScopeKey=THIS.Type;
END;
This macro is defined in definitions 40, 42, and 43.
This macro is invoked in definition 1.
In a WithBody, a field identifier is indistinguishable from
any other identifier.
The WithBody is a region that inherits the record's environment:
Qualified identifiers[43]
:
TREE SYMBOL WithBody INHERITS InhRange END;
TREE SYMBOL WithVar INHERITS InheritScope END;
RULE: statement ::= 'with' WithVar 'do' WithBody COMPUTE
WithBody.GotInh=WithVar.InheritOk;
WithVar.InnerScope=WithBody.Env;
END;
RULE: WithVar ::= variable COMPUTE
WithVar.ScopeKey=variable.Type;
END;
This macro is defined in definitions 40, 42, and 43.
This macro is invoked in definition 1.
Instantiate appropriate modules[44]
:
$/Name/AlgInh.gnrc :inst
This macro is defined in definitions 41 and 44.
This macro is invoked in definition 2.
Next: Enforcing Constraints
Up: Type Analysis
Previous: Statements
2008-08-29