mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-16 16:01:26 -07:00
Replace x in &y Use &v in y syntax through core & vendor for switch/for statements
This commit is contained in:
@@ -83,7 +83,7 @@ read :: proc(data: []byte, filename := "<input>", print_error := false, allocato
|
||||
meta_data = make([]Meta, int(capacity))
|
||||
count := 0
|
||||
defer meta_data = meta_data[:count]
|
||||
for m in &meta_data {
|
||||
for &m in meta_data {
|
||||
m.name = read_name(r) or_return
|
||||
|
||||
type := read_value(r, Meta_Value_Type) or_return
|
||||
@@ -116,7 +116,7 @@ read :: proc(data: []byte, filename := "<input>", print_error := false, allocato
|
||||
layer_count := 0
|
||||
layers = make(Layer_Stack, stack_count)
|
||||
defer layers = layers[:layer_count]
|
||||
for layer in &layers {
|
||||
for &layer in layers {
|
||||
layer.name = read_name(r) or_return
|
||||
layer.components = read_value(r, u8) or_return
|
||||
type := read_value(r, Layer_Data_Type) or_return
|
||||
|
||||
@@ -72,7 +72,7 @@ unmarshal_string :: proc(data: string, ptr: ^$T, spec := DEFAULT_SPECIFICATION,
|
||||
@(private)
|
||||
assign_bool :: proc(val: any, b: bool) -> bool {
|
||||
v := reflect.any_core(val)
|
||||
switch dst in &v {
|
||||
switch &dst in v {
|
||||
case bool: dst = bool(b)
|
||||
case b8: dst = b8 (b)
|
||||
case b16: dst = b16 (b)
|
||||
@@ -85,7 +85,7 @@ assign_bool :: proc(val: any, b: bool) -> bool {
|
||||
@(private)
|
||||
assign_int :: proc(val: any, i: $T) -> bool {
|
||||
v := reflect.any_core(val)
|
||||
switch dst in &v {
|
||||
switch &dst in v {
|
||||
case i8: dst = i8 (i)
|
||||
case i16: dst = i16 (i)
|
||||
case i16le: dst = i16le (i)
|
||||
@@ -122,7 +122,7 @@ assign_int :: proc(val: any, i: $T) -> bool {
|
||||
@(private)
|
||||
assign_float :: proc(val: any, f: $T) -> bool {
|
||||
v := reflect.any_core(val)
|
||||
switch dst in &v {
|
||||
switch &dst in v {
|
||||
case f16: dst = f16 (f)
|
||||
case f16le: dst = f16le(f)
|
||||
case f16be: dst = f16be(f)
|
||||
@@ -150,7 +150,7 @@ assign_float :: proc(val: any, f: $T) -> bool {
|
||||
@(private)
|
||||
unmarshal_string_token :: proc(p: ^Parser, val: any, str: string, ti: ^reflect.Type_Info) -> bool {
|
||||
val := val
|
||||
switch dst in &val {
|
||||
switch &dst in val {
|
||||
case string:
|
||||
dst = str
|
||||
return true
|
||||
@@ -215,7 +215,7 @@ unmarshal_value :: proc(p: ^Parser, v: any) -> (err: Unmarshal_Error) {
|
||||
}
|
||||
}
|
||||
|
||||
switch dst in &v {
|
||||
switch &dst in v {
|
||||
// Handle json.Value as an unknown type
|
||||
case Value:
|
||||
dst = parse_value(p) or_return
|
||||
|
||||
Reference in New Issue
Block a user