| ... | @@ -484,7 +484,17 @@ pub fn lowerUnnamedConst(zig_object: *ZigObject, wasm_file: *Wasm, val: Value, d | ... | @@ -484,7 +484,17 @@ pub fn lowerUnnamedConst(zig_object: *ZigObject, wasm_file: *Wasm, val: Value, d |
| 484 | }); | 484 | }); |
| 485 | defer gpa.free(name); | 485 | defer gpa.free(name); |
| 486 | | 486 | |
| 487 | switch (try zig_object.lowerConst(wasm_file, name, val, decl.navSrcLoc(mod).upgrade(mod))) { | 487 | // We want to lower the source location of `decl`. However, when generating |
| | 488 | // lazy functions (for e.g. `@tagName`), `decl` may correspond to a type |
| | 489 | // rather than a `Nav`! |
| | 490 | // The future split of `Decl` into `Nav` and `Cau` may require rethinking this |
| | 491 | // logic. For now, just get the source location conditionally as needed. |
| | 492 | const decl_src = if (decl.typeOf(mod).toIntern() == .type_type) |
| | 493 | decl.val.toType().srcLoc(mod) |
| | 494 | else |
| | 495 | decl.navSrcLoc(mod); |
| | 496 | |
| | 497 | switch (try zig_object.lowerConst(wasm_file, name, val, decl_src.upgrade(mod))) { |
| 488 | .ok => |atom_index| { | 498 | .ok => |atom_index| { |
| 489 | try wasm_file.getAtomPtr(parent_atom_index).locals.append(gpa, atom_index); | 499 | try wasm_file.getAtomPtr(parent_atom_index).locals.append(gpa, atom_index); |
| 490 | return @intFromEnum(wasm_file.getAtom(atom_index).sym_index); | 500 | return @intFromEnum(wasm_file.getAtom(atom_index).sym_index); |