mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
compiler: work around slightly different generics semantics
Both of these cases are interesting, were not covered by behavior tests, and should be inspected carefully with regards to the language specification.
This commit is contained in:
parent
d15e8f8017
commit
b03d34429d
@ -65,9 +65,13 @@ pub const ExtraIndex = enum(u32) {
|
||||
_,
|
||||
};
|
||||
|
||||
fn ExtraData(comptime T: type) type {
|
||||
return struct { data: T, end: usize };
|
||||
}
|
||||
|
||||
/// Returns the requested data, as well as the new index which is at the start of the
|
||||
/// trailers for the object.
|
||||
pub fn extraData(code: Zir, comptime T: type, index: usize) struct { data: T, end: usize } {
|
||||
pub fn extraData(code: Zir, comptime T: type, index: usize) ExtraData(T) {
|
||||
const fields = @typeInfo(T).Struct.fields;
|
||||
var i: usize = index;
|
||||
var result: T = undefined;
|
||||
|
||||
@ -1802,7 +1802,12 @@ pub const DeclGen = struct {
|
||||
}
|
||||
}
|
||||
|
||||
fn writeCValueMember(dg: *DeclGen, writer: anytype, c_value: CValue, member: CValue) !void {
|
||||
fn writeCValueMember(
|
||||
dg: *DeclGen,
|
||||
writer: anytype,
|
||||
c_value: CValue,
|
||||
member: CValue,
|
||||
) error{ OutOfMemory, AnalysisFail }!void {
|
||||
try dg.writeCValue(writer, c_value);
|
||||
try writer.writeByte('.');
|
||||
try dg.writeCValue(writer, member);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user