#union switch a in b failing to declare variable (???)

1 messages · Page 1 of 1 (latest)

nimble quest
#

ok im really confused here
i have basically the exact same code twice, and it works in one but not the other?

working:

pos_arr := str.types[i]
#partial switch pos in pos_arr.variant {
case: assert(type_of(pos_arr.variant) == runtime.Type_Info_Array)
case runtime.Type_Info_Array:
    pos_ptr := (^rawptr)(uintptr(obj.data) + str.offsets[i])

    switch pos.count {
    ... do whatever

not working:

pos_arr := str.types[i]
#partial switch pos in pos_arr.variant {
case:
case runtime.Type_Info_Array:
    ptr := (^rawptr)(uintptr(obj.data) + str.offsets[i])

    switch pos.count {
    ... do different whatever

i get this error message:

 ceat $ odin run examples/foreign/odin/object
/media/storage/projects/ceat/bindings/odin/eau/eau.odin(384:24) Error: Undeclared name: pos
        switch pos.count {
               ^~^
#

also i tried defining pos aswell, and that just spat out "redecl of 'pos' in this scope" so im confused

#

union switch a in b failing to declare variable (???)