spell an array bound as an expression
It went to fmt-c unwalked, so a bound named CHUNK-AREA kept its dash while the same name in an expression became CHUNK_AREA. Fixes #50.
This commit is contained in:
@@ -678,6 +678,11 @@ compiles."
|
||||
(emits? "(define N 4) (struct s ((a (¤ char (* 2 N)))))" "char a[2 * N]"))
|
||||
(test-assert "an integer bound still works"
|
||||
(emits? "(struct s ((a (¤ int 4))))" "int a[4]"))
|
||||
;; ...and it is spelled the way the same name is in an expression
|
||||
(test-assert "a bound's name is converted"
|
||||
(emits? (in-fn "(var xs (¤ u16 CHUNK-AREA))") "u16 xs[CHUNK_AREA]"))
|
||||
(test-assert "so is one inside an expression bound"
|
||||
(emits? (in-fn "(var xs (¤ u16 (* 2 CHUNK-AREA)))") "u16 xs[2 * CHUNK_AREA]"))
|
||||
;; a multi-word type is keywords all the way down, so a trailing
|
||||
;; keyword belongs to the type and leaves the array unsized
|
||||
(test-assert "a multi-word type is not a bound"
|
||||
|
||||
Reference in New Issue
Block a user