wcc: forrange bindings get a per-loop scope; dup binders reject
The TODO(#11) silent-accept of `for (let (a, a) .. xs)` rested on a stale premise -- resolvewalk has per-block scopes since #53 and IS the live w6c_ww checker pass. Bindings now install in a per-LOOP scope (the N_MCASE pattern), so a duplicate name within one pattern errs "redeclared in same scope" (cstage parity via stamptuplebinds' scopedefine-nil check) while sequential same-name loops stay legal. kwtab restores its stated alphabetical order (`import` before `is`, both stages, kinds swapped in lockstep with names).
This commit is contained in:
@@ -156,16 +156,16 @@ export type tok = struct {
|
||||
// (probe at cc69daf — len() returns 0, no diagnostic); filed bug.
|
||||
let kwnames: [30]str = [
|
||||
"as", "break", "case", "chan", "const", "continue", "def", "defer",
|
||||
"else", "enum", "export", "false", "fn", "for", "if", "is",
|
||||
"import", "let", "match", "nil", "package", "proc", "return",
|
||||
"else", "enum", "export", "false", "fn", "for", "if", "import",
|
||||
"is", "let", "match", "nil", "package", "proc", "return",
|
||||
"static", "struct", "switch", "true", "type", "void", "yield",
|
||||
];
|
||||
let kwkinds: [30]tkind = [
|
||||
tkind.TK_AS, tkind.TK_BREAK, tkind.TK_CASE, tkind.TK_CHAN,
|
||||
tkind.TK_CONST, tkind.TK_CONTINUE, tkind.TK_DEF, tkind.TK_DEFER,
|
||||
tkind.TK_ELSE, tkind.TK_ENUM, tkind.TK_EXPORT, tkind.TK_FALSE,
|
||||
tkind.TK_FN, tkind.TK_FOR, tkind.TK_IF, tkind.TK_IS,
|
||||
tkind.TK_USE, tkind.TK_LET, tkind.TK_MATCH, tkind.TK_NIL,
|
||||
tkind.TK_FN, tkind.TK_FOR, tkind.TK_IF, tkind.TK_USE,
|
||||
tkind.TK_IS, tkind.TK_LET, tkind.TK_MATCH, tkind.TK_NIL,
|
||||
tkind.TK_MODULE, tkind.TK_PROC, tkind.TK_RETURN, tkind.TK_STATIC,
|
||||
tkind.TK_STRUCT, tkind.TK_SWITCH, tkind.TK_TRUE, tkind.TK_TYPE,
|
||||
tkind.TK_VOID, tkind.TK_YIELD,
|
||||
|
||||
Reference in New Issue
Block a user