write a typedef's target as a type
It fell through to the expression walk, which read (* const char) as a dereference and an array as a subscript, and died on a fn type. Fixes #53.
This commit is contained in:
@@ -6,7 +6,8 @@
|
||||
"unsized of a typedef: 1 2"
|
||||
"unsized of a pointer: 5"
|
||||
"named bound: 2 4 b"
|
||||
"unnamed parameters: 7 -1 2")
|
||||
"unnamed parameters: 7 -1 2"
|
||||
"typedefs: hi 4 2")
|
||||
(return 0)
|
||||
|
||||
;;; Three questions about a written type that used to be answered in
|
||||
@@ -22,6 +23,9 @@
|
||||
(struct point ((x int) (y int)))
|
||||
|
||||
(typedef small int)
|
||||
(typedef cstr (* const char))
|
||||
(typedef vec4 (¤ float 4))
|
||||
(typedef unary (fn ((small)) small))
|
||||
|
||||
(define CAP 2)
|
||||
|
||||
@@ -79,4 +83,10 @@
|
||||
;; takes one parameter, not two
|
||||
(var fp (fn ((unsigned int)) int) width)
|
||||
(printf "unnamed parameters: %d %d %d\n" (fp 7) (sign #\a) (twice 1))
|
||||
|
||||
;; a typedef's target is every one of those shapes as well
|
||||
(var greeting cstr "hi")
|
||||
(var v vec4 #(1.0 2.0 3.0 4.0))
|
||||
(var op unary twice)
|
||||
(printf "typedefs: %s %zu %d\n" greeting (/ (sizeof v) (sizeof (¤ v 0))) (op 1))
|
||||
(return 0))
|
||||
|
||||
Reference in New Issue
Block a user