write an empty block as {}
(do), and a for with no body, gave c-begin nothing to begin with, and the writer died on its arity.
This commit is contained in:
@@ -336,6 +336,16 @@
|
||||
(reports? "(fn f () void\n (for ((var i int 0) (< i 4) (++ i)) (g i)))"
|
||||
"codegen.sex:2:")))
|
||||
|
||||
;; a block of nothing had nothing for c-begin to begin with, and the
|
||||
;; writer died on its arity
|
||||
(test-group "empty bodies"
|
||||
(test-assert "an empty block is a pair of braces"
|
||||
(followed-by? (in-fn "(do) (g a)") "{}" "g(a);"))
|
||||
(test-assert "inside another too"
|
||||
(followed-by? (in-fn "(do (do) (g a))") "{}" "g(a);"))
|
||||
(test-assert "and a for with no body has them"
|
||||
(emits? (in-fn "(for (var i int 0) (< i a) (++ i))") "for (int i = 0; i < a; ++i) {}")))
|
||||
|
||||
;; A nested pointer chain used to silently lose a level:
|
||||
;; (var p (* (* char))) emitted `char *p'
|
||||
(test-group "malformed types are rejected"
|
||||
|
||||
Reference in New Issue
Block a user