replace fold-right append with flatten in type-convert-to-c

They are not equivalent, but it'll be allright in this
case. Probably. Passes tests at least.
This commit is contained in:
2025-10-30 12:24:38 +03:00
committed by Pavel Kulyov
parent 9e50df5c44
commit c483b81f1c
2 changed files with 24 additions and 3 deletions

View File

@@ -47,6 +47,27 @@
'(%fun void ((int) (%array float) (%array (struct what * const))))
(walk-type '(fn ((int) (¤ float) (¤ (const * struct what))) void)))
(test
'(%array (%fun void ((int) (%array float) (%array (struct what * const)))))
(walk-type '(¤ (fn ((int) (¤ float) (¤ (const * struct what))) void))))
;; Type convert to C
(test
'(int)
(type-convert-to-c '(int)))
(test
'(* int)
(type-convert-to-c '(int *)))
(test
'(* const int)
(type-convert-to-c '(const int *)))
(test
'(const * const char)
(type-convert-to-c '(const char * const)))
;;; Variable defs
(test
'(%var (%array float 8) a)