Dimb-declor
Disambiguate a declarator.
- Signature
(dimb-declor declor fundef-params-p table)
→
(mv erp new-declor new-fundef-params-p ident table)
- Arguments
- declor — Guard (declorp declor).
- fundef-params-p — Guard (booleanp fundef-params-p).
- table — Guard (dimb-tablep table).
- Returns
- new-declor — Type (declorp new-declor).
- new-fundef-params-p — Type (booleanp new-fundef-params-p).
- 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 fundef-params-p flag is t
when this function is called
to disambiguate the declarator of a function definition,
and only when the parameters of the function
have not been disambiguated yet.
Its new value new-fundef-params-p, returned as result,
stays t if the parameters of the function
have still not been disambiguated yet,
because they are not found in this declarator;
otherwise, its new value is nil.
If the input fundef-params-p is nil,
then new-fundef-params-p is nil as well.
The exact handling of this flag,
and the exact treatment of the parameters of function declarations,
are explained in dimb-dirdeclor.
We also pass the fundef-params-p flag to dimb-dirdeclor,
and relay the new-fundef-params-p output.
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.