Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/node.zig
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,12 @@ pub const Node = extern struct {
return try result.toOwnedSlice(allocator);
}

try result.append(allocator, cursor.currentNode());
try result.append(allocator, cursor.node());
while (cursor.gotoNextSibling()) {
result.appendAssumeCapacity(cursor.currentNode());
result.appendAssumeCapacity(cursor.node());
}

return result.toOwnedSlice();
return result.toOwnedSlice(allocator);
}

/// Iterate over this node's named children.
Expand All @@ -241,7 +241,7 @@ pub const Node = extern struct {
}

while (true) {
var node = cursor.currentNode();
var node = cursor.node();
if (node.isNamed()) {
result.appendAssumeCapacity(node);
}
Expand Down Expand Up @@ -276,15 +276,15 @@ pub const Node = extern struct {
}

while (true) {
if (cursor.currentFieldId() == field_id) {
try result.append(allocator, cursor.currentNode());
if (cursor.fieldId() == field_id) {
try result.append(allocator, cursor.node());
}
if (!cursor.gotoNextSibling()) {
break;
}
}

return result.toOwnedSlice();
return result.toOwnedSlice(allocator);
}

/// Get this node's immediate parent.
Expand Down