zig stage 2 compatibility

This commit is contained in:
Robin Voetter
2022-08-20 00:30:17 +02:00
parent 2bd9927cfe
commit 5af6ffe864
4 changed files with 7 additions and 7 deletions

View File

@@ -142,7 +142,6 @@ pub const IdRenderer = struct {
fn renderSnake(self: *IdRenderer, screaming: bool, id: []const u8, tag: ?[]const u8) !void { fn renderSnake(self: *IdRenderer, screaming: bool, id: []const u8, tag: ?[]const u8) !void {
var it = SegmentIterator.init(id); var it = SegmentIterator.init(id);
var first = true; var first = true;
const transform = if (screaming) std.ascii.toUpper else std.ascii.toLower;
while (it.next()) |segment| { while (it.next()) |segment| {
if (first) { if (first) {
@@ -152,7 +151,7 @@ pub const IdRenderer = struct {
} }
for (segment) |c| { for (segment) |c| {
try self.text_cache.append(transform(c)); try self.text_cache.append(if (screaming) std.ascii.toUpper(c) else std.ascii.toLower(c));
} }
} }
@@ -160,7 +159,7 @@ pub const IdRenderer = struct {
try self.text_cache.append('_'); try self.text_cache.append('_');
for (name) |c| { for (name) |c| {
try self.text_cache.append(transform(c)); try self.text_cache.append(if (screaming) std.ascii.toUpper(c) else std.ascii.toLower(c));
} }
} }
} }

View File

@@ -109,8 +109,8 @@ pub const Command = struct {
params: []Param, params: []Param,
return_type: *TypeInfo, return_type: *TypeInfo,
success_codes: [][]const u8, success_codes: []const []const u8,
error_codes: [][]const u8, error_codes: []const []const u8,
}; };
pub const Pointer = struct { pub const Pointer = struct {

View File

@@ -547,7 +547,7 @@ fn Renderer(comptime WriterType: type) type {
if (optional) { if (optional) {
try self.writer.writeByte('?'); try self.writer.writeByte('?');
} }
try self.writer.writeAll("fn("); try self.writer.writeAll("*const fn(");
for (command_ptr.params) |param| { for (command_ptr.params) |param| {
try self.writeIdentifierWithCase(.snake, param.name); try self.writeIdentifierWithCase(.snake, param.name);
try self.writer.writeAll(": "); try self.writer.writeAll(": ");

View File

@@ -56,7 +56,8 @@ pub const Element = struct {
} }
pub fn findChildByTag(self: Element, tag: []const u8) ?*Element { pub fn findChildByTag(self: Element, tag: []const u8) ?*Element {
return self.findChildrenByTag(tag).next(); var it = self.findChildrenByTag(tag);
return it.next();
} }
pub fn findChildrenByTag(self: Element, tag: []const u8) FindChildrenByTagIterator { pub fn findChildrenByTag(self: Element, tag: []const u8) FindChildrenByTagIterator {