mirror of
https://github.com/ziglang/zig.git
synced 2026-11-22 04:37:39 -05:00
1 parent
b47e54ed3f
commit
562ac8be48
7 files changed
+83
-18
No files matched your search
+12
-2
@@ -363,11 +363,21 @@ pub fn generateSymbol(
|
||||
const mod = bin_file.options.module.?;
|
||||
const decl = mod.declPtr(decl_index);
|
||||
const addend = blk: {
|
||||
switch (decl.ty.tag()) {
|
||||
.@"struct" => {
|
||||
switch (decl.ty.zigTypeTag()) {
|
||||
.Struct => {
|
||||
const addend = decl.ty.structFieldOffset(field_ptr.field_index, target);
|
||||
break :blk @intCast(u32, addend);
|
||||
},
|
||||
.Pointer => {
|
||||
assert(decl.ty.isSlice());
|
||||
var buf: Type.SlicePtrFieldTypeBuffer = undefined;
|
||||
const addend = switch (field_ptr.field_index) {
|
||||
0 => 0,
|
||||
1 => decl.ty.slicePtrFieldType(&buf).abiSize(target),
|
||||
else => unreachable,
|
||||
};
|
||||
break :blk @intCast(u32, addend);
|
||||
},
|
||||
else => return Result{
|
||||
.fail = try ErrorMsg.create(
|
||||
bin_file.allocator,
|
||||
|
||||
Reference in new issue
Block a user