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
- erp — Type (maybe-msgp erp).
- 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 is t
when this function is called
to disambiguate the declarator of a function definition.
We also pass the fundefp flag to dimb-dirdeclor.
The reason is that, after peeling off the pointers,
which refine the return result of the function,
the direct declarator is still expected to be for a function,
and we have not disambiguated the parameters yet.