STRA-338 S12c: fns and impl blocks of 162 hot-path modules move into child modules (leleka-runtime, cuda-driver, deploy, cpu-sys)
The same lexer-based splitter as S12b, now with explicit re-exports: every moved free fn comes back to its module under its old name and old visibility (cfg attributes carried), so a name can never clash with another glob import. 162 module files of leleka-runtime (68), cuda-driver (84), deploy (10), cpu-sys, igpu and leleka-memory are split into groups of about 250 lines; types, constants, macros, nested modules and tests stay. Not touched: the files kar-off-ab edits, crate roots (lib.rs, main.rs, bin/*), and giant single impl blocks (next). This changes codegen-unit placement of engine code, so it is covered by the bitwise replay and the paired A/B on the 5090, not by a binary comparison.
This commit is contained in:
@@ -147,3 +147,23 @@ def parse_items(text):
|
||||
text[sig[k].start:sig[attrs_end].start], kind == "impl" and _is_inherent(sig, at, last)))
|
||||
previous_end, k = sig[last].end, last + 1
|
||||
return items
|
||||
|
||||
|
||||
def cfg_attributes(attrs):
|
||||
"""The `#[cfg(...)]` attributes among the outer attributes text, each as written."""
|
||||
sig = significant(tokenize(attrs))
|
||||
found, k = [], 0
|
||||
while k + 1 < len(sig):
|
||||
end = _skip_bracket(sig, k + 1) if sig[k].text == "#" and sig[k + 1].text == "[" else k + 1
|
||||
if sig[k].text == "#" and k + 2 < len(sig) and sig[k + 2].text == "cfg":
|
||||
found.append(attrs[sig[k].start:sig[end - 1].end])
|
||||
k = max(end, k + 1)
|
||||
return found
|
||||
|
||||
|
||||
def visibility_text(chunk):
|
||||
"""The visibility of the item that `chunk` holds, as written: '', 'pub', 'pub(crate)', 'pub(in a::b)' ..."""
|
||||
sig = significant(tokenize(chunk))
|
||||
first = _skip_attrs(sig, 0)
|
||||
after = _skip_visibility(sig, first)
|
||||
return chunk[sig[first].start:sig[after].start].strip() if after > first else ""
|
||||
|
||||
Reference in New Issue
Block a user