| author | |
| committer | |
| log | b03d34429d059dc3f6056d7f780dc623c96523b4 |
| tree | 481abfc5bf9ba31e2e9934c4c2616861010df40b |
| parent | d15e8f8017758fb77dd6e839ef3f39b174522c5c |
Both of these cases are interesting, were not covered by behavior tests,
and should be inspected carefully with regards to the language
specification.2 files changed, 11 insertions(+), 2 deletions(-)
src/Zir.zig+5-1| ... | @@ -65,9 +65,13 @@ pub const ExtraIndex = enum(u32) { | ... | @@ -65,9 +65,13 @@ pub const ExtraIndex = enum(u32) { |
| 65 | _, | 65 | _, |
| 66 | }; | 66 | }; |
| 67 | 67 | ||
| 68 | fn ExtraData(comptime T: type) type { | ||
| 69 | return struct { data: T, end: usize }; | ||
| 70 | } | ||
| 71 | |||
| 68 | /// Returns the requested data, as well as the new index which is at the start of the | 72 | /// Returns the requested data, as well as the new index which is at the start of the |
| 69 | /// trailers for the object. | 73 | /// trailers for the object. |
| 70 | pub fn extraData(code: Zir, comptime T: type, index: usize) struct { data: T, end: usize } { | 74 | pub fn extraData(code: Zir, comptime T: type, index: usize) ExtraData(T) { |
| 71 | const fields = @typeInfo(T).Struct.fields; | 75 | const fields = @typeInfo(T).Struct.fields; |
| 72 | var i: usize = index; | 76 | var i: usize = index; |
| 73 | var result: T = undefined; | 77 | var result: T = undefined; |
src/codegen/c.zig+6-1| ... | @@ -1802,7 +1802,12 @@ pub const DeclGen = struct { | ... | @@ -1802,7 +1802,12 @@ pub const DeclGen = struct { |
| 1802 | } | 1802 | } |
| 1803 | } | 1803 | } |
| 1804 | 1804 | ||
| 1805 | fn writeCValueMember(dg: *DeclGen, writer: anytype, c_value: CValue, member: CValue) !void { | 1805 | fn writeCValueMember( |
| 1806 | dg: *DeclGen, | ||
| 1807 | writer: anytype, | ||
| 1808 | c_value: CValue, | ||
| 1809 | member: CValue, | ||
| 1810 | ) error{ OutOfMemory, AnalysisFail }!void { | ||
| 1806 | try dg.writeCValue(writer, c_value); | 1811 | try dg.writeCValue(writer, c_value); |
| 1807 | try writer.writeByte('.'); | 1812 | try writer.writeByte('.'); |
| 1808 | try dg.writeCValue(writer, member); | 1813 | try dg.writeCValue(writer, member); |