Dimb-declor
Disambiguate a declarator.
- Signature
(dimb-declor declor fundefp table)
→
(mv erp new-declor ident table)
- Arguments
- declor — Guard (declorp declor).
- fundefp — Guard (booleanp fundefp).
- table — Guard (dimb-tablep table).
- Returns
- new-declor — Type (declorp new-declor).
- ident — Type (identp ident).
- table — Type (dimb-tablep table).
A declarator adds an identifier to the scope.
This function returns the identifier.
Its addition to the disambiguation table is performed
outside of this function,
after processing the top-level declarator
in the construct of interest.
The pointer part of a declarator does not contribute to the table
and does not need to be disambiguated.
So we recursively disambiguate the direct declarator,
which also gives us the identifier,
and then we re-add the pointer part.
The fundefp flag passed to this function
says whether we are disambiguating
the declarator of a function definition or not.
It is used to determine whether,
when disambiguating the parameters of a function declarator,
the new scope pushed for the function prototype
should be popped at the end of the function declarator or not.
If the declarator is not part of a function definition,
then that scope must be popped;
but if instead the declarator is part of a function definition,
that scope is the block scope of the definition,
and must not be popped.
Here by `part of a function definition' of course we mean
the one that introduces the name of the function being defined.