- if (destructor)
- {
- if (type->destructor)
- semantic_type_redeclaration (type, "%destructor",
- type->destructor_location, loc);
- type->destructor = destructor;
- type->destructor_location = loc;
- }
-}
-
-/*---------------------------------------.
-| Get the computed %destructor for SYM. |
-`---------------------------------------*/
-
-const char *
-symbol_destructor_get (symbol *sym)
-{
- /* Per-symbol %destructor. */
- if (sym->destructor != NULL)
- return sym->destructor;
-
- /* Per-type %destructor. */
- if (sym->type_name)
- {
- semantic_type *type = semantic_type_get (sym->type_name);
- if (type->destructor)
- return type->destructor;
- }
-
- /* Apply default %destructor's only to user-defined symbols. */
- if (sym->tag[0] == '$' || sym == errtoken)
- return NULL;
-
- if (sym->type_name)
- return default_tagged_destructor;
- return default_tagless_destructor;
-}
-
-/*---------------------------------------------------------------.
-| Get the grammar location of the %destructor computed for SYM. |
-`---------------------------------------------------------------*/
-
-location
-symbol_destructor_location_get (symbol *sym)
-{
- if (sym->destructor != NULL)
- return sym->destructor_location;
- if (sym->type_name)
- {
- semantic_type *type = semantic_type_get (sym->type_name);
- if (type->destructor)
- return type->destructor_location;
- return default_tagged_destructor_location;
- }
- return default_tagless_destructor_location;
-}
-
-/*---------------------------------------------------------------.
-| Set the PRINTER associated with SYM. Do nothing if passed 0. |
-`---------------------------------------------------------------*/
-
-void
-symbol_printer_set (symbol *sym, const char *printer, location loc)
-{
- if (printer)
- {
- if (sym->printer)
- symbol_redeclaration (sym, "%printer", sym->printer_location, loc);
- sym->printer = printer;
- sym->printer_location = loc;
- }
-}
-
-/*----------------------------------------------------------------.
-| Set the PRINTER associated with TYPE. Do nothing if passed 0. |
-`----------------------------------------------------------------*/
-
-void
-semantic_type_printer_set (semantic_type *type, const char *printer,
- location loc)
-{
- if (printer)
- {
- if (type->printer)
- semantic_type_redeclaration (type, "%printer", type->printer_location,
- loc);
- type->printer = printer;
- type->printer_location = loc;
- }