| ... | ... | @@ -325,14 +325,14 @@ pub const DeclGen = struct { |
| 325 | 325 | /// TODO: Deduplication? |
| 326 | 326 | fn genConstant(self: *DeclGen, ty: Type, val: Value) Error!IdRef { |
| 327 | 327 | if (ty.zigTypeTag() == .Fn) { |
| 328 | | const fn_decl_index = switch (val.tag()) { |
| 329 | | .extern_fn => val.castTag(.extern_fn).?.data.owner_decl, |
| 330 | | .function => val.castTag(.function).?.data.owner_decl, |
| 331 | | else => unreachable, |
| 332 | | }; |
| 333 | | const decl = self.module.declPtr(fn_decl_index); |
| 334 | | self.module.markDeclAlive(decl); |
| 335 | | return decl.fn_link.spirv.id.toRef(); |
| 328 | const fn_decl_index = switch (val.tag()) { |
| 329 | .extern_fn => val.castTag(.extern_fn).?.data.owner_decl, |
| 330 | .function => val.castTag(.function).?.data.owner_decl, |
| 331 | else => unreachable, |
| 332 | }; |
| 333 | const decl = self.module.declPtr(fn_decl_index); |
| 334 | self.module.markDeclAlive(decl); |
| 335 | return decl.fn_link.spirv.id.toRef(); |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | const target = self.getTarget(); |
| ... | ... | @@ -1051,7 +1051,7 @@ pub const DeclGen = struct { |
| 1051 | 1051 | } |
| 1052 | 1052 | const extra_bytes = std.mem.sliceAsBytes(self.air.extra[extra_i..]); |
| 1053 | 1053 | const constraint = std.mem.sliceTo(std.mem.sliceAsBytes(self.air.extra[extra_i..]), 0); |
| 1054 | | const name = std.mem.sliceTo(extra_bytes[constraint.len + 1..], 0); |
| 1054 | const name = std.mem.sliceTo(extra_bytes[constraint.len + 1 ..], 0); |
| 1055 | 1055 | extra_i += (constraint.len + name.len + (2 + 3)) / 4; |
| 1056 | 1056 | // TODO: Record output and use it somewhere. |
| 1057 | 1057 | } |
| ... | ... | @@ -1096,7 +1096,7 @@ pub const DeclGen = struct { |
| 1096 | 1096 | input_extra_i += (constraint.len + name.len + (2 + 3)) / 4; |
| 1097 | 1097 | |
| 1098 | 1098 | const value = try self.resolve(input); |
| 1099 | | try as.value_map.put(as.gpa, name, .{.value = value}); |
| 1099 | try as.value_map.put(as.gpa, name, .{ .value = value }); |
| 1100 | 1100 | } |
| 1101 | 1101 | |
| 1102 | 1102 | as.assemble() catch |err| switch (err) { |
| ... | ... | @@ -1134,7 +1134,7 @@ pub const DeclGen = struct { |
| 1134 | 1134 | _ = output; |
| 1135 | 1135 | const extra_bytes = std.mem.sliceAsBytes(self.air.extra[output_extra_i..]); |
| 1136 | 1136 | const constraint = std.mem.sliceTo(std.mem.sliceAsBytes(self.air.extra[output_extra_i..]), 0); |
| 1137 | | const name = std.mem.sliceTo(extra_bytes[constraint.len + 1..], 0); |
| 1137 | const name = std.mem.sliceTo(extra_bytes[constraint.len + 1 ..], 0); |
| 1138 | 1138 | output_extra_i += (constraint.len + name.len + (2 + 3)) / 4; |
| 1139 | 1139 | |
| 1140 | 1140 | const result = as.value_map.get(name) orelse return { |