walk the values of a brace literal
The walk stopped at a vector, so whatever a literal held reached the
writer as written: #(v : (.get a)) was (v){.get(a)}, and a path through
a pointer inside one read it as a value.
This commit is contained in:
@@ -160,6 +160,12 @@
|
||||
"(ops meters (fn half ((self meters)) meters (return self)))"
|
||||
"(fn f () void (var x km 1.0) (var y km (.half x)))")
|
||||
"metersːhalf(x)"))
|
||||
(test-assert "a method call inside a literal is still a call"
|
||||
(emits? (ops-src "(var w vec2 #(vec2 : (.length v) 1.0))")
|
||||
"(vec2){vec2ːlength(&v), 1.0}"))
|
||||
(test-assert "however deep"
|
||||
(emits? (ops-src "(var ws [vec2 1] #(#(vec2 : (.length p) 1.0)))")
|
||||
"{(vec2){vec2ːlength(p), 1.0}}"))
|
||||
(test-assert "an address cannot be taken of a call"
|
||||
(reports? (ops-src "(.length (mk))") "receiver is not an lvalue"))
|
||||
;; the inner call has to be typed to find the outer one's receiver
|
||||
|
||||
Reference in New Issue
Block a user