else do hashes[last.hash_index] = lr.entry_index;
}
+update :: proc (use map: ^Map($K, $V), key: K, f: proc (^V)) {
+ lr := lookup(map, key);
+ if lr.entry_index < 0 do return;
+
+ f(^entries[lr.entry_index].value);
+}
+
clear :: proc (use map: ^Map($K, $V)) {
for i: 0 .. hashes.count do hashes.data[i] = -1;
entries.count = 0;
Since `continue`ing or `break`ing would skip the deferred statement, causing
an infinite loop.
+[ ] The following code causes an infinite loop somewhere.
+ ```
+ get_neighbor_count :: proc (grid: ^map.Map(Vec2, Cell), pos: Vec2) -> u32 {
+ count := 0;
+
+ for ^dir: Hex_Directions {
+ pos := Vec2.{ x = pos.x + dir.x, y = pos.y + dir.y };
+ cell := map.get(grid, pos, Cell.{});
+ if cell.alive do count += 1;
+ }
+
+ return count;
+ }
+ ```
+
[X] `TileData :: [TILE_DATA_WIDTH * TILE_DATA_HEIGHT] bool;` results in a
segfault because it is an invalid top level node, but that is not checked
before it is tried to be used.
types that you can control the name and inadvertently give the same name
to two different structs / enums.
- [ ] Switches should have range based statements, i.e.
+ [X] Switches should have range based statements, i.e.
switch expr {
case 10 .. 14 do ...
}
return arr[0 .. N];
}
+ [ ] Functions should return the correct value in all branches.
+
+ [ ] Add macros.
+
API Expansion:
There are many different places where the standard API for WASI and JS
backends could be improved. Here are some of the target areas.