fix listToSpan

This commit is contained in:
Motiejus Jakštys
2025-04-24 20:31:11 +00:00
parent c0ec218e42
commit b089809dd1

View File

@@ -50,7 +50,7 @@ static void cleanupScratch(CleanupScratch* c) { c->scratch->len = c->old_len; }
static AstSubRange listToSpan( static AstSubRange listToSpan(
Parser* p, const AstNodeIndex* list, uint32_t count) { Parser* p, const AstNodeIndex* list, uint32_t count) {
SLICE_ENSURE_CAPACITY(AstNodeIndex, &p->extra_data, count); SLICE_ENSURE_CAPACITY(AstNodeIndex, &p->extra_data, count);
memcpy(p->extra_data.arr, list, count * sizeof(AstNodeIndex)); memcpy(p->extra_data.arr + p->extra_data.len, list, count * sizeof(AstNodeIndex));
p->extra_data.len += count; p->extra_data.len += count;
return (AstSubRange) { return (AstSubRange) {
.start = p->extra_data.len - count, .start = p->extra_data.len - count,