fix(frontend): recognize signatures only from Exec payloads
signature::detect() scanned the function body independently of heading
modes, skipping only level>=3 headings. A 'params(...)' code span in an
### @knowledge section was therefore taken as the function signature
('inspect --signature' reported it as explicit), even though that span is
inert documentation and is never executed.
Unify recognition with the executable traversal:
- MappedBody now reports the params(...) payload the mapper accepted; the
mapper already enforces Exec mode, directness, first-function-wide
position and single declaration
- signature::from_payload validates that text and rewrites default-value
spans; signature::detect is removed along with its mode-blind heuristic
- analyze uses the mapper result, so Knowledge sections cannot declare a
signature and prose/Knowledge subsections may still precede the first
Exec declaration
- tests: Knowledge params ignored; Exec params after prose/Knowledge is the
signature; spec/mapping.md states the recognition rule
Verified: clippy -D warnings clean; cargo test --workspace --locked green
(62 targets).
This commit is contained in:
1 parent
d5002ac826
commit
9fb97bc2df
4 files changed
+83
-57
No files matched your search
+3
-1
@@ -277,7 +277,9 @@ Rules:
|
||||
segment are visible in later segments. They do not create new functions.
|
||||
* `params(name: Type, ...)` is legal only as the **first direct execution
|
||||
payload of an Exec H2 function**, at most once, and not inside a list or
|
||||
block quote. The position is function-wide: it may be preceded by prose or a
|
||||
block quote. Recognition happens in the same Exec-mode traversal that finds
|
||||
statements, so a `params(...)` code span in a Knowledge section is inert
|
||||
documentation and is never a signature. The position is function-wide: it may be preceded by prose or a
|
||||
Knowledge subsection, but not by an executing statement in **any** heading
|
||||
segment of that function (a later `### @exec` section may not add a
|
||||
signature after earlier code ran). Violations are `sem.signature_position`;
|
||||
|
||||
Reference in new issue
Block a user