lib/ww/ast: nkname if-ladder -> switch (Wave-2 structural)
Fold the 69-arm `if (k == nkind.N_X) return "..."` ladder in nkname to a single `switch (k)` with the terminal `return "?"` as the fall-past default. The other ast.ww ladders stay: pr()'s kind dispatch is side-effecting (emits output, recurses) and uses ||-grouped multi-kind predicates, not a pure value->value mapping a switch can express. Not byte-id-neutral (if-chain -> switch dispatch changes the asm), so the ladder->switch equivalence is pinned by a new table-driven test: lib/ww/asttest.ww drives nkname over every nkind plus the out-of-band "?" fallback, wired as 905_nkname_run (same `ww run` @test shape as 904_tok_run). The 990_selfhost wwdump diff only covers kinds that appear in its corpus. Regenerates the w6c + wwdump combined.ww amalgamations (nkname region only).
This commit is contained in:
6
Makefile
6
Makefile
@@ -443,7 +443,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
|
||||
$(BIN)/test_sort_run \
|
||||
$(BIN)/test_bufio_run $(BIN)/test_random_run \
|
||||
$(BIN)/test_asserttyped_gap \
|
||||
$(BIN)/test_ascii_run $(BIN)/test_tok_run
|
||||
$(BIN)/test_ascii_run $(BIN)/test_tok_run $(BIN)/test_nkname_run
|
||||
|
||||
$(BIN)/test_smoke: test/wcc/000_smoke.c $(LIB)/libwcc.a | $(BIN)
|
||||
$(CC) $(CFLAGS) $(INCS) -o $@ $< -L$(LIB) -lwcc
|
||||
@@ -1512,6 +1512,10 @@ $(BIN)/test_tok_run: test/wcc/904_tok_run.c $(BIN)/ww $(BIN)/w6c \
|
||||
$(BIN)/w6a $(BIN)/w6l $(LIB)/libwwrt.a | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
$(BIN)/test_nkname_run: test/wcc/905_nkname_run.c $(BIN)/ww $(BIN)/w6c \
|
||||
$(BIN)/w6a $(BIN)/w6l $(LIB)/libwwrt.a | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
$(BIN)/test_decimal_run: test/wcc/922_decimal_run.c $(BIN)/ww $(BIN)/w6c \
|
||||
$(BIN)/w6a $(BIN)/w6l $(LIB)/libwwrt.a | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
Reference in New Issue
Block a user