fix nested types producing wrong C code
This commit was merged in pull request #18.
This commit is contained in:
@@ -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)
|
||||||
|
(flatten
|
||||||
(tree-map atom-to-fmt-c
|
(tree-map atom-to-fmt-c
|
||||||
(fold-right append (list)
|
(fold-right append (list)
|
||||||
(list-join (reverse (list-split type '*))
|
(list-join (reverse (list-split type '*))
|
||||||
'(*))))))
|
'(*)))))))
|
||||||
|
|
||||||
(define (walk-fn-def form)
|
(define (walk-fn-def form)
|
||||||
(match form
|
(match form
|
||||||
|
|||||||
@@ -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))))
|
||||||
|
|||||||
Reference in New Issue
Block a user