Merge pull request #53 from Avokadoen/zig-stage1-compat

fix compile errors on stage1
This commit is contained in:
Robin Voetter
2022-09-01 22:13:45 +02:00
committed by GitHub
3 changed files with 7 additions and 6 deletions

View File

@@ -139,7 +139,7 @@ pub const IdRenderer = struct {
self.text_cache.deinit(); self.text_cache.deinit();
} }
fn renderSnake(self: *IdRenderer, screaming: bool, id: []const u8, tag: ?[]const u8) !void { fn renderSnake(self: *IdRenderer, comptime 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; const transform = if (screaming) std.ascii.toUpper else std.ascii.toLower;

View File

@@ -468,12 +468,12 @@ fn parseCommand(allocator: Allocator, elem: *xml.Element) !registry.Declaration
const return_type = try allocator.create(registry.TypeInfo); const return_type = try allocator.create(registry.TypeInfo);
return_type.* = command_decl.decl_type.typedef; return_type.* = command_decl.decl_type.typedef;
const success_codes = if (elem.getAttribute("successcodes")) |codes| const success_codes: [][]const u8 = if (elem.getAttribute("successcodes")) |codes|
try splitCommaAlloc(allocator, codes) try splitCommaAlloc(allocator, codes)
else else
&[_][]const u8{}; &[_][]const u8{};
const error_codes = if (elem.getAttribute("errorcodes")) |codes| const error_codes: [][]const u8 = if (elem.getAttribute("errorcodes")) |codes|
try splitCommaAlloc(allocator, codes) try splitCommaAlloc(allocator, codes)
else else
&[_][]const u8{}; &[_][]const u8{};

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 children = self.findChildrenByTag(tag);
return children.next();
} }
pub fn findChildrenByTag(self: Element, tag: []const u8) FindChildrenByTagIterator { pub fn findChildrenByTag(self: Element, tag: []const u8) FindChildrenByTagIterator {
@@ -435,7 +436,7 @@ fn parseElement(parser: *Parser, alloc: Allocator, comptime kind: ElementKind) !
return null; return null;
}; };
break :blk tag; break :blk tag;
} },
}; };
var attributes = std.ArrayList(Attribute).init(alloc); var attributes = std.ArrayList(Attribute).init(alloc);
@@ -474,7 +475,7 @@ fn parseElement(parser: *Parser, alloc: Allocator, comptime kind: ElementKind) !
_ = parser.eatWs(); _ = parser.eatWs();
try parser.expect('>'); try parser.expect('>');
} }
} },
} }
const element = try alloc.create(Element); const element = try alloc.create(Element);