| ... | @@ -387,36 +387,26 @@ pub fn generateSymbol( | ... | @@ -387,36 +387,26 @@ pub fn generateSymbol( |
| 387 | } | 387 | } |
| 388 | }, | 388 | }, |
| 389 | .aggregate => |aggregate| switch (mod.intern_pool.indexToKey(typed_value.ty.toIntern())) { | 389 | .aggregate => |aggregate| switch (mod.intern_pool.indexToKey(typed_value.ty.toIntern())) { |
| 390 | .array_type => |array_type| { | 390 | .array_type => |array_type| switch (aggregate.storage) { |
| 391 | switch (aggregate.storage) { | 391 | .bytes => |bytes| try code.appendSlice(bytes), |
| 392 | .bytes => |bytes| try code.appendSlice(bytes), | 392 | .elems, .repeated_elem => { |
| 393 | .elems, .repeated_elem => { | 393 | var index: u64 = 0; |
| 394 | var index: u64 = 0; | 394 | var len_including_sentinel = |
| 395 | while (index < array_type.len) : (index += 1) { | 395 | array_type.len + @boolToInt(array_type.sentinel != .none); |
| 396 | switch (try generateSymbol(bin_file, src_loc, .{ | 396 | while (index < len_including_sentinel) : (index += 1) { |
| 397 | .ty = array_type.child.toType(), | 397 | switch (try generateSymbol(bin_file, src_loc, .{ |
| 398 | .val = switch (aggregate.storage) { | 398 | .ty = array_type.child.toType(), |
| 399 | .bytes => unreachable, | 399 | .val = switch (aggregate.storage) { |
| 400 | .elems => |elems| elems[@intCast(usize, index)], | 400 | .bytes => unreachable, |
| 401 | .repeated_elem => |elem| elem, | 401 | .elems => |elems| elems[@intCast(usize, index)], |
| 402 | }.toValue(), | 402 | .repeated_elem => |elem| elem, |
| 403 | }, code, debug_output, reloc_info)) { | 403 | }.toValue(), |
| 404 | .ok => {}, | 404 | }, code, debug_output, reloc_info)) { |
| 405 | .fail => |em| return .{ .fail = em }, | 405 | .ok => {}, |
| 406 | } | 406 | .fail => |em| return .{ .fail = em }, |
| 407 | } | 407 | } |
| 408 | }, | | |
| 409 | } | | |
| 410 | | | |
| 411 | if (array_type.sentinel != .none) { | | |
| 412 | switch (try generateSymbol(bin_file, src_loc, .{ | | |
| 413 | .ty = array_type.child.toType(), | | |
| 414 | .val = array_type.sentinel.toValue(), | | |
| 415 | }, code, debug_output, reloc_info)) { | | |
| 416 | .ok => {}, | | |
| 417 | .fail => |em| return .{ .fail = em }, | | |
| 418 | } | 408 | } |
| 419 | } | 409 | }, |
| 420 | }, | 410 | }, |
| 421 | .vector_type => |vector_type| { | 411 | .vector_type => |vector_type| { |
| 422 | switch (aggregate.storage) { | 412 | switch (aggregate.storage) { |