string pool
This commit is contained in:
@@ -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]
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user