write a typedef's target as a type

It fell through to the expression walk, which read (* const char) as a
dereference and an array as a subscript, and died on a fn type.

Fixes #53.
This commit is contained in:
2026-10-09 15:58:01 +03:00
parent bc5f23881f
commit 6f29a9c203
3 changed files with 27 additions and 1 deletions

View File

@@ -194,6 +194,9 @@ forms, and what remains."
;; path lowers to where the thing it reads from is a pointer
(('%-> . rest) (cons '%-> (map walk-expr rest)))
(('var . _) (walk-var form))
;; semen has already put the target first, the way C writes it
(('typedef type name)
`(typedef ,(walk-type type) ,(atom-to-fmt-c name)))
;; An expression has no room for a statement, so a comment in a
;; cast is dropped rather than relocated.
(('cast . rest)