Better types #15

Merged
alex-eg merged 27 commits from better-types into main 2025-10-30 16:05:44 +01:00
2 changed files with 13 additions and 4 deletions
Showing only changes of commit c48ebc7585 - Show all commits

View File

@@ -141,10 +141,11 @@
;; * const char -> const char * ;; * const char -> const char *
;; const * const char -> const char * const ;; const * const char -> const char * const
(if (atom? type) (atom-to-fmt-c type) (if (atom? type) (atom-to-fmt-c type)
(tree-map atom-to-fmt-c (flatten
(fold-right append (list) (tree-map atom-to-fmt-c
(list-join (reverse (list-split type '*)) (fold-right append (list)
'(*)))))) (list-join (reverse (list-split type '*))
'(*)))))))
(define (walk-fn-def form) (define (walk-fn-def form)
(match form (match form

View File

@@ -64,6 +64,14 @@
'(%var (struct suc) s) '(%var (struct suc) s)
(walk-var '(var s (struct suc)))) (walk-var '(var s (struct suc))))
(test
'(%var (const struct suc *) s s1)
(walk-var '(var s (* const struct suc) s1)))
(test
'(%var (const struct suc *) s s1)
(walk-var '(var s (* (const struct suc)) s1)))
(test (test
'(%var (struct suc) s (hoge piyo)) '(%var (struct suc) s (hoge piyo))
(walk-var '(var s (struct suc) (hoge piyo)))) (walk-var '(var s (struct suc) (hoge piyo))))