| ... | ... | @@ -696,10 +696,10 @@ pub fn parse( |
| 696 | 696 | exp.* = .{ |
| 697 | 697 | .name = try wasm.internString(name), |
| 698 | 698 | .pointee = switch (kind) { |
| 699 | | .function => .{ .function = @enumFromInt(functions_start + index) }, |
| 699 | .function => .{ .function = @enumFromInt(functions_start + (index - ss.func_imports.items.len)) }, |
| 700 | 700 | .table => .{ .table = @enumFromInt(tables_start + index) }, |
| 701 | 701 | .memory => .{ .memory = @enumFromInt(memories_start + index) }, |
| 702 | | .global => .{ .global = @enumFromInt(globals_start + index) }, |
| 702 | .global => .{ .global = @enumFromInt(globals_start + (index - ss.global_imports.items.len)) }, |
| 703 | 703 | }, |
| 704 | 704 | }; |
| 705 | 705 | } |
| ... | ... | @@ -827,7 +827,7 @@ pub fn parse( |
| 827 | 827 | gop.value_ptr.source_location.addNote(wasm, &err, "imported as {} here", .{ |
| 828 | 828 | gop.value_ptr.type.fmt(wasm), |
| 829 | 829 | }); |
| 830 | | source_location.addNote(wasm, &err, "imported as {} here", .{fn_ty_index.fmt(wasm)}); |
| 830 | err.addNote("{}: imported as {} here", .{ path, fn_ty_index.fmt(wasm) }); |
| 831 | 831 | continue; |
| 832 | 832 | } |
| 833 | 833 | if (gop.value_ptr.module_name != ptr.module_name.toOptional()) { |
| ... | ... | @@ -838,7 +838,7 @@ pub fn parse( |
| 838 | 838 | } else { |
| 839 | 839 | gop.value_ptr.source_location.addNote(wasm, &err, "no module here", .{}); |
| 840 | 840 | } |
| 841 | | source_location.addNote(wasm, &err, "module '{s}' here", .{ptr.module_name.slice(wasm)}); |
| 841 | err.addNote("{}: module '{s}' here", .{ path, ptr.module_name.slice(wasm) }); |
| 842 | 842 | continue; |
| 843 | 843 | } |
| 844 | 844 | if (symbol.flags.binding == .strong) gop.value_ptr.flags.binding = .strong; |
| ... | ... | @@ -868,7 +868,7 @@ pub fn parse( |
| 868 | 868 | var err = try diags.addErrorWithNotes(2); |
| 869 | 869 | try err.addMsg("symbol '{s}' mismatching global types", .{name.slice(wasm)}); |
| 870 | 870 | gop.value_ptr.source_location.addNote(wasm, &err, "type {s} here", .{@tagName(existing_ty.valtype)}); |
| 871 | | source_location.addNote(wasm, &err, "type {s} here", .{@tagName(ptr.valtype)}); |
| 871 | err.addNote("{}: type {s} here", .{ path, @tagName(ptr.valtype) }); |
| 872 | 872 | continue; |
| 873 | 873 | } |
| 874 | 874 | if (ptr.mutable != existing_ty.mutable) { |
| ... | ... | @@ -877,8 +877,8 @@ pub fn parse( |
| 877 | 877 | gop.value_ptr.source_location.addNote(wasm, &err, "{s} here", .{ |
| 878 | 878 | if (existing_ty.mutable) "mutable" else "not mutable", |
| 879 | 879 | }); |
| 880 | | source_location.addNote(wasm, &err, "{s} here", .{ |
| 881 | | if (ptr.mutable) "mutable" else "not mutable", |
| 880 | err.addNote("{}: {s} here", .{ |
| 881 | path, if (ptr.mutable) "mutable" else "not mutable", |
| 882 | 882 | }); |
| 883 | 883 | continue; |
| 884 | 884 | } |
| ... | ... | @@ -890,7 +890,7 @@ pub fn parse( |
| 890 | 890 | } else { |
| 891 | 891 | gop.value_ptr.source_location.addNote(wasm, &err, "no module here", .{}); |
| 892 | 892 | } |
| 893 | | source_location.addNote(wasm, &err, "module '{s}' here", .{ptr.module_name.slice(wasm)}); |
| 893 | err.addNote("{}: module '{s}' here", .{ path, ptr.module_name.slice(wasm) }); |
| 894 | 894 | continue; |
| 895 | 895 | } |
| 896 | 896 | if (symbol.flags.binding == .strong) gop.value_ptr.flags.binding = .strong; |
| ... | ... | @@ -925,7 +925,7 @@ pub fn parse( |
| 925 | 925 | ptr.type_index.fmt(wasm), |
| 926 | 926 | }); |
| 927 | 927 | const word = if (gop.value_ptr.resolution == .unresolved) "imported" else "exported"; |
| 928 | | source_location.addNote(wasm, &err, "{s} as {} here", .{ word, gop.value_ptr.type.fmt(wasm) }); |
| 928 | err.addNote("{}: {s} as {} here", .{ path, word, gop.value_ptr.type.fmt(wasm) }); |
| 929 | 929 | continue; |
| 930 | 930 | } |
| 931 | 931 | if (gop.value_ptr.resolution == .unresolved or gop.value_ptr.flags.binding == .weak) { |
| ... | ... | @@ -938,7 +938,7 @@ pub fn parse( |
| 938 | 938 | var err = try diags.addErrorWithNotes(2); |
| 939 | 939 | try err.addMsg("symbol collision: {s}", .{name.slice(wasm)}); |
| 940 | 940 | gop.value_ptr.source_location.addNote(wasm, &err, "exported as {} here", .{ptr.type_index.fmt(wasm)}); |
| 941 | | source_location.addNote(wasm, &err, "exported as {} here", .{gop.value_ptr.type.fmt(wasm)}); |
| 941 | err.addNote("{}: exported as {} here", .{ path, gop.value_ptr.type.fmt(wasm) }); |
| 942 | 942 | continue; |
| 943 | 943 | } else { |
| 944 | 944 | gop.value_ptr.* = .{ |
| ... | ... | @@ -993,7 +993,7 @@ pub fn parse( |
| 993 | 993 | inline .function, .table, .memory, .global => |index| { |
| 994 | 994 | const ptr = index.ptr(wasm); |
| 995 | 995 | if (ptr.name == .none) { |
| 996 | | // Missng symbol table entry; use defaults for exported things. |
| 996 | // Missing symbol table entry; use defaults for exported things. |
| 997 | 997 | ptr.name = exp.name.toOptional(); |
| 998 | 998 | ptr.flags.exported = true; |
| 999 | 999 | } |