- Create optional with ~ instead of ?. return io::EOF?; becomes return io::EOF~.

- Deprecated use of `?` to create optional.
This commit is contained in:
Christoffer Lerno
2026-01-20 16:10:28 +01:00
parent 5390ca6250
commit cdabe8fd9e
159 changed files with 710 additions and 707 deletions

View File

@@ -35,17 +35,17 @@ fn void Map.init(Map *map, uint capacity = 128)
fn Type? Map.valueForKey(Map *map, Key key)
{
if (!map.map) return faults::KEY_NOT_FOUND?;
if (!map.map) return faults::KEY_NOT_FOUND~;
uint hash = key.hash();
usz pos = hash & map.mod;
Entry* entry = &map.map[pos];
if (!entry) return faults::KEY_NOT_FOUND?;
if (!entry) return faults::KEY_NOT_FOUND~;
while (entry)
{
if (entry.hash == hash && entry.key == key) return entry.value;
entry = entry.next;
}
return faults::KEY_NOT_FOUND?;
return faults::KEY_NOT_FOUND~;
}
fn Type? Map.set(Map *map, Key key, Type value) @maydiscard
@@ -67,7 +67,7 @@ fn Type? Map.set(Map *map, Key key, Type value) @maydiscard
entry.value = value;
entry.hash = hash;
entry.key = key;
return faults::KEY_NOT_FOUND?;
return faults::KEY_NOT_FOUND~;
}
if (entry.hash == hash && entry.key == key)
{
@@ -87,7 +87,7 @@ fn Type? Map.set(Map *map, Key key, Type value) @maydiscard
new.next = null;
new.used = true;
entry.next = new;
return faults::KEY_NOT_FOUND?;
return faults::KEY_NOT_FOUND~;
}
}