migrate to the new for-loop syntax
Drop the ':' before captures (for xs (x) / for 0..n (i)); the index capture becomes the trailing open range (for xs, 0.. (x, i)). 136 headers across 26 files, mechanical. Five headless tests (banner_layout, hit_test, swipe_commit, swipe_intent, swipe_reshuffle) also gain a direct #import "modules/ui/types.sx" — they named Point/Frame through a transitive import, which bare visibility no longer permits. Gates: sx build --target ios-sim main.sx links; tools/run_tests.sh 23/23.
This commit is contained in:
@@ -24,7 +24,7 @@ EXPECTED_DEPTH :: 2;
|
||||
// board can be written as a human-readable grid. The hole glyph maps to `.empty`.
|
||||
char_to_gem :: (c: u8) -> Gem {
|
||||
if c == EMPTY_CHAR { return .empty; }
|
||||
for 0..GEM_COUNT: (i) {
|
||||
for 0..GEM_COUNT (i) {
|
||||
if GEM_CHARS[i] == c { return cast(Gem) i; }
|
||||
}
|
||||
.red
|
||||
@@ -34,9 +34,9 @@ char_to_gem :: (c: u8) -> Gem {
|
||||
// The RNG is left unseeded — callers seed it before resolving.
|
||||
load_board :: (rows: []string) -> Board {
|
||||
b : Board = ---;
|
||||
for 0..BOARD_ROWS: (row) {
|
||||
for 0..BOARD_ROWS (row) {
|
||||
line := rows[row];
|
||||
for 0..BOARD_COLS: (col) {
|
||||
for 0..BOARD_COLS (col) {
|
||||
b.set(col, row, char_to_gem(line[col]));
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ load_board :: (rows: []string) -> Board {
|
||||
}
|
||||
|
||||
boards_equal :: (a: *Board, b: *Board) -> bool {
|
||||
for 0..BOARD_CELLS: (i) { if a.cells[i] != b.cells[i] { return false; } }
|
||||
for 0..BOARD_CELLS (i) { if a.cells[i] != b.cells[i] { return false; } }
|
||||
true
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ main :: () -> s32 {
|
||||
t.expect(c.depth == depth, "cascade: resolve depth matches manual loop");
|
||||
same_counts := c.cleared.len == counts.len;
|
||||
if same_counts {
|
||||
for 0..counts.len: (i) {
|
||||
for 0..counts.len (i) {
|
||||
if c.cleared.items[i] != counts.items[i] { same_counts = false; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user