| ... | @@ -205,13 +205,62 @@ pub fn generateSymbol( | ... | @@ -205,13 +205,62 @@ pub fn generateSymbol( |
| 205 | .appended => {}, | 205 | .appended => {}, |
| 206 | .externally_managed => |slice| { | 206 | .externally_managed => |slice| { |
| 207 | code.appendSliceAssumeCapacity(slice); | 207 | code.appendSliceAssumeCapacity(slice); |
| 208 | return Result{ .appended = {} }; | | |
| 209 | }, | 208 | }, |
| 210 | .fail => |em| return Result{ .fail = em }, | 209 | .fail => |em| return Result{ .fail = em }, |
| 211 | } | 210 | } |
| 212 | } | 211 | } |
| 213 | return Result{ .appended = {} }; | 212 | return Result{ .appended = {} }; |
| 214 | }, | 213 | }, |
| | 214 | .repeated => { |
| | 215 | const array = typed_value.val.castTag(.repeated).?.data; |
| | 216 | const elem_ty = typed_value.ty.childType(); |
| | 217 | const sentinel = typed_value.ty.sentinel(); |
| | 218 | const len = typed_value.ty.arrayLen(); |
| | 219 | |
| | 220 | var index: u64 = 0; |
| | 221 | while (index < len) : (index += 1) { |
| | 222 | switch (try generateSymbol(bin_file, parent_atom_index, src_loc, .{ |
| | 223 | .ty = elem_ty, |
| | 224 | .val = array, |
| | 225 | }, code, debug_output)) { |
| | 226 | .appended => {}, |
| | 227 | .externally_managed => |slice| { |
| | 228 | code.appendSliceAssumeCapacity(slice); |
| | 229 | }, |
| | 230 | .fail => |em| return Result{ .fail = em }, |
| | 231 | } |
| | 232 | } |
| | 233 | |
| | 234 | if (sentinel) |sentinel_val| { |
| | 235 | switch (try generateSymbol(bin_file, parent_atom_index, src_loc, .{ |
| | 236 | .ty = elem_ty, |
| | 237 | .val = sentinel_val, |
| | 238 | }, code, debug_output)) { |
| | 239 | .appended => {}, |
| | 240 | .externally_managed => |slice| { |
| | 241 | code.appendSliceAssumeCapacity(slice); |
| | 242 | }, |
| | 243 | .fail => |em| return Result{ .fail = em }, |
| | 244 | } |
| | 245 | } |
| | 246 | |
| | 247 | return Result{ .appended = {} }; |
| | 248 | }, |
| | 249 | .empty_array_sentinel => { |
| | 250 | const elem_ty = typed_value.ty.childType(); |
| | 251 | const sentinel_val = typed_value.ty.sentinel().?; |
| | 252 | switch (try generateSymbol(bin_file, parent_atom_index, src_loc, .{ |
| | 253 | .ty = elem_ty, |
| | 254 | .val = sentinel_val, |
| | 255 | }, code, debug_output)) { |
| | 256 | .appended => {}, |
| | 257 | .externally_managed => |slice| { |
| | 258 | code.appendSliceAssumeCapacity(slice); |
| | 259 | }, |
| | 260 | .fail => |em| return Result{ .fail = em }, |
| | 261 | } |
| | 262 | return Result{ .appended = {} }; |
| | 263 | }, |
| 215 | else => return Result{ | 264 | else => return Result{ |
| 216 | .fail = try ErrorMsg.create( | 265 | .fail = try ErrorMsg.create( |
| 217 | bin_file.allocator, | 266 | bin_file.allocator, |