toolchain: banner purge + WHY-only comment sweep (rule 8)
selfhost/, cmd/, internal/ join the tree-wide sweep: every section banner dies (91 selfhost + the cmd C-style dividers -> 0); narration and stale contracts deleted (pre-#22 bundler notes, retired single-PT_LOAD and no-archive claims, superseded ABI tables); every ref/harec/qbe cite, task cite, encoding/ELF contract, and rule-10 twin pointer kept; lost lifetime/rationale lines restored where the sweep over-cut (elf_globals ownership, kwtab linear-scan). Comment- only proven: all five wwstage tool binaries byte-identical across the sweep; test-commit, test-byteid (161+1399, 0 pinned-divergent), and test-bootstrap (fixed point + 991-995 byte-id) all exit 0. The read-through banked 66 latent-bug leads (checkpoint).
This commit is contained in:
@@ -1,9 +1,3 @@
|
||||
/*
|
||||
* sym.c — symbol table. Plan 9-flavoured: a per-scope hashtable
|
||||
* chained to the parent scope. Lookup walks up. Duplicate definitions
|
||||
* within the same scope are flagged by the caller (we just refuse the
|
||||
* insert and return the first one).
|
||||
*/
|
||||
#include "ww.h"
|
||||
#include <string.h>
|
||||
|
||||
@@ -54,13 +48,6 @@ scope_lookup(Scope *s, const char *name)
|
||||
}
|
||||
|
||||
/*
|
||||
* scope_lookup_in_module — module-filtered chain walk.
|
||||
*
|
||||
* Same FNV bucket + hashnext chain + parent walk as scope_lookup,
|
||||
* plus a (b->mod != NULL && strcmp(b->mod, mod) == 0) filter. When
|
||||
* `mod` is NULL we fall back to unfiltered scope_lookup semantics,
|
||||
* so callers that don't care about disambiguation get the default.
|
||||
*
|
||||
* Used by resolve_typename and the cexpr N_DOT branch to pick the
|
||||
* right same-leaf-name type when two imports each export it
|
||||
* (`bufio.stream` vs `io.stream`).
|
||||
@@ -80,19 +67,13 @@ scope_lookup_in_module(Scope *s, const char *mod, const char *name)
|
||||
}
|
||||
|
||||
/*
|
||||
* scope_lookup_prefer — bare-leaf lookup with same-module preference.
|
||||
*
|
||||
* Walks the same FNV bucket + hashnext chain + parent walk scope_lookup
|
||||
* uses. Within each scope's bucket: Pass 1 prefers entries whose
|
||||
* `sym.mod` matches the caller's `mod`; Pass 2 falls back to the first
|
||||
* match regardless of mod (the existing scope_lookup semantics). We
|
||||
* only descend to the parent scope when the current scope has no
|
||||
* matching entry at all — so a local binding in a closer scope still
|
||||
* shadows a same-name fn from a parent scope, even when the parent
|
||||
* entry mod-matches.
|
||||
*
|
||||
* When `mod` is NULL we just call scope_lookup — there's no module
|
||||
* identity to prefer.
|
||||
* Within each scope's bucket: Pass 1 prefers entries whose `sym.mod`
|
||||
* matches the caller's `mod`; Pass 2 falls back to the first match
|
||||
* regardless of mod (the existing scope_lookup semantics). We only
|
||||
* descend to the parent scope when the current scope has no matching
|
||||
* entry at all — so a local binding in a closer scope still shadows a
|
||||
* same-name fn from a parent scope, even when the parent entry
|
||||
* mod-matches.
|
||||
*
|
||||
* Used at bare-leaf lookup sites inside a known current module so that
|
||||
* a bare `read` inside lib/os resolves to os.read rather than the
|
||||
@@ -117,15 +98,12 @@ scope_lookup_prefer(Scope *s, const char *mod, const char *name)
|
||||
}
|
||||
|
||||
/*
|
||||
* scope_lookup_type — kind-filtered bare-leaf lookup for type position.
|
||||
*
|
||||
* Same FNV bucket + hashnext chain + parent walk and same-module
|
||||
* preference as scope_lookup_prefer, but skips every Sym whose kind
|
||||
* isn't SK_TYPE and KEEPS scanning — so it returns the innermost
|
||||
* SK_TYPE of `name`, looking past a same-named value binding (SK_VAR/
|
||||
* SK_PARAM/SK_FN) that shadows it in a closer scope. ww keeps type and
|
||||
* value namespaces separate (wwstage already does; #225 conformance
|
||||
* gap): a param `off` must not hide the global `type off`.
|
||||
* Skips every Sym whose kind isn't SK_TYPE and KEEPS scanning — so it
|
||||
* returns the innermost SK_TYPE of `name`, looking past a same-named
|
||||
* value binding (SK_VAR/SK_PARAM/SK_FN) that shadows it in a closer
|
||||
* scope. ww keeps type and value namespaces separate (wwstage already
|
||||
* does; #225 conformance gap): a param `off` must not hide the global
|
||||
* `type off`.
|
||||
*/
|
||||
Sym *
|
||||
scope_lookup_type(Scope *s, const char *mod, const char *name)
|
||||
@@ -151,10 +129,8 @@ scope_define(Scope *s, const char *name, Skind k, Type *t, Node *decl)
|
||||
}
|
||||
|
||||
/*
|
||||
* scope_define_in_module — bucket insert with per-mod dedup.
|
||||
*
|
||||
* Same insertion as scope_define, but the duplicate-rejection key is
|
||||
* (name, mod) rather than name alone. This lets two imports each
|
||||
* The duplicate-rejection key is (name, mod) rather than name alone.
|
||||
* This lets two imports each
|
||||
* register their own `stream` SK_TYPE in the flat scope, and lets the
|
||||
* primary register `stream` (mod=NULL) alongside imported `stream`s.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user