walk what an initializer holds
The body walk passed a #(...) by as an atom, so nothing inside one was typed, dispatched or lifted: (. self p) read as self.p with self a pointer, where the same path outside the literal was right. Fixes #45.
This commit is contained in:
@@ -5,7 +5,8 @@
|
||||
"through a pointer 9"
|
||||
"array 10 20 30"
|
||||
"argument 6"
|
||||
"mixed 1 5")
|
||||
"mixed 1 5"
|
||||
"read through a pointer 1 5")
|
||||
(return 0)
|
||||
|
||||
;;; `:' inside #(...) ends a type and makes the rest a C99 compound
|
||||
@@ -46,4 +47,10 @@
|
||||
(var m (struct point) #(struct point : 1 .y 5))
|
||||
(printf "mixed %d %d\n" (. m x) (. m y))
|
||||
|
||||
;; what a literal holds is walked like any expression, so a path in
|
||||
;; it reads through a pointer as it does outside one
|
||||
(var pm (* (struct point)) (& m))
|
||||
(var c (struct point) #(struct point : (. pm x) (. pm y)))
|
||||
(printf "read through a pointer %d %d\n" (. c x) (. c y))
|
||||
|
||||
(return 0))
|
||||
|
||||
Reference in New Issue
Block a user