feat: stdlib daily APIs, macro tt/type paste, riscv64 cross smoke
ci / build (ubuntu) (push) Has been cancelled
ci / unit + fmt (push) Has been cancelled
ci / examples (push) Has been cancelled
ci / goldens + tools (push) Has been cancelled
ci / apps (push) Has been cancelled
ci / selfhost smoke (push) Has been cancelled
ci / macos smoke (push) Has been cancelled
ci / windows smoke (push) Has been cancelled
ci / CI gate (push) Has been cancelled
selfhost-loop / bootstrap determinism (push) Has been cancelled

Sessions 83–87: grow Array/Map/String/Test ergonomics; delimiter-balanced
and juxta :tt macros plus $t:type fragments; expression-level $(…),* in
templates; selfhost slice lits; riscv64/aarch64 cross smoke helper and
freestanding docs. Null-safe CBE type names and String_StartsWith.
This commit is contained in:
2026-07-27 21:40:11 +03:00
parent a785747c37
commit d60ce2bc3f
23 changed files with 1263 additions and 86 deletions
+16
View File
@@ -63,6 +63,14 @@ module Std::Map {
return zero;
}
/// Like `Map_Get`, but returns `defaultVal` when the key is absent.
func Map_GetOr<K, V>(m: *Map<K, V>, key: K, defaultVal: V) -> V {
if Map_Has<K, V>(m, key) {
return Map_Get<K, V>(m, key);
}
return defaultVal;
}
func Map_Has<K, V>(m: *Map<K, V>, key: K) -> bool {
var keyPtr: *K = &key;
let hash: uint = bux_hash_bytes(keyPtr as *void, sizeof(K));
@@ -186,6 +194,14 @@ module Std::Map {
return zero;
}
/// Like `StringMap_Get`, but returns `defaultVal` when the key is absent.
func StringMap_GetOr<V>(m: *StringMap<V>, key: String, defaultVal: V) -> V {
if StringMap_Has<V>(m, key) {
return StringMap_Get<V>(m, key);
}
return defaultVal;
}
func StringMap_Has<V>(m: *StringMap<V>, key: String) -> bool {
let hash: uint = bux_hash_string(key);
var idx: uint = hash % m.cap;