string pool

This commit is contained in:
2026-07-22 00:49:56 +02:00
parent 1d719c6a42
commit 596183b9a0
3 changed files with 90 additions and 5 deletions
+7
View File
@@ -62,6 +62,13 @@ append func($T type, list @mut ArrayList(T), value T) void ! mem.AllocError {
return
}
pop func($T type, list @mut ArrayList(T)) ?T {
if (list.items.len == 0) return null
value :: list.items[list.items.len - 1]
list.items = list.items.ptr[..list.items.len - 1]
return value
}
clear func($T type, list @mut ArrayList(T)) void {
list.items = list.items.ptr[..0]
}
+3 -5
View File
@@ -38,11 +38,9 @@ expect_equal func($T type, expected, actual T, location SourceLocation) void ! E
debug.print("{s}:{d}:{d}: expected and actual slices differ\n", {location.file, location.line, location.column})
return .expectation_failed
}
else: {
if expected != actual {
debug.print("{s}:{d}:{d}: expected {}, found {}\n", {location.file, location.line, location.column, expected, actual})
return .expectation_failed
}
else: if expected != actual {
debug.print("{s}:{d}:{d}: expected {}, found {}\n", {location.file, location.line, location.column, expected, actual})
return .expectation_failed
}
}
}