fix(docs): index templated members, which the AST walk was skipping - #213
Merged
Conversation
structure.js walks a record's members looking for CXXMethodDecl, but a templated member is a FunctionTemplateDecl wrapping the method, so it saw none of them. Node's whole Mod API -- addMod / getMod / hasMod / removeMod, the documented way to attach behaviour to a node -- has therefore never appeared in the reference, on the website or in FOR_AI_ASSISTANT.md. Read the wrapped decl the way the namespace-level branch already does and flag it 'template', which sets tmpl on the signature. Every downstream consumer (luagen, luagen-types, emit-sketch-*, implicit-conv-audit) already filters on tmpl, so no binding is generated for these: regenerating the Lua bindings against the new data produces an identical binding set. Seven symbols surface. Five are public API and are documented here (Node::addMod / getMod / hasMod / removeMod, FullscreenShader::setParams). FileWriter::operator<< is exempt from the undocumented gate as an operator. Font::reresolveAtlas is not API at all -- it sits between two `public:` markers and was public by accident, called only by Font's own option setters -- so it moves to `private:`. Also qualify member ids with their namespace. A type in a sub-namespace would otherwise be `mcp::ToolBuilder` while its own method is a bare `ToolBuilder::arg`, and generic member names like `Tool::name` would read as top-level ids. No visible symbol sits in a sub-namespace today, so this is a no-op: the id set was diffed before and after, and only the seven additions above differ. check.js --strict: 2481 symbols, undocumented 0. (Two orphans, VideoWriter::lockFrame / submitFrame, appear when checking on Linux and not on macOS -- they live inside #if TC_ASYNC_SCREEN_CAPTURE. Pre-existing and unrelated.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
docs/reference/structure.jswalks a record's members looking forCXXMethodDecl. A templated member is aFunctionTemplateDeclwrapping the method, so the walk saw none of them — and every derived artifact inherited the gap.The most visible casualty: Node's entire Mod API has never appeared in the reference.
node->addMod<DraggableMod>(); // the documented way to attach behaviour node->getMod<LayoutMod>(); node->hasMod<TweenMod>(); node->removeMod<LayoutMod>();Not on trussc.org, not in
FOR_AI_ASSISTANT.md, despite being used throughout the examples and addons.How
Read the wrapped decl the way the namespace-level branch already does, and flag it
'template'sotmplis set on the signature.Seven symbols surface:
Node::addMod/getMod/hasMod/removeModFullscreenShader::setParamsFileWriter::operator<<Font::reresolveAtlasprivate:Font::reresolveAtlassat between twopublic:markers and was public by accident. It is a helper the option setters call so they are order-independent; nothing outsideFontreferences it.Member ids now carry their namespace
symbolId()did not qualifymethod/field. A type in a sub-namespace would bemcp::ToolBuilderwhile its own method was a bareToolBuilder::arg, and generic member names likeTool::namewould read as top-level ids.This is a no-op today. No visible symbol sits in a sub-namespace, so the id set is unchanged — verified by diffing
structure.js --idsbefore and after: the only differences are the seven additions above, and nothing was removed. It is fixed here because it belongs to the id grammar, and because the alternative is discovering it later while changing something else.No bindings change
Every downstream consumer already filters on
tmpl—luagen,luagen-types,emit-sketch-api,emit-sketch-reference,implicit-conv-audit. Regenerating the Lua bindings against the new data produces an identical binding set (compared as whole assignment statements, type qualification included).addons/tcxLua/src/generated/is therefore untouched.Verification
Built and ran the core test suite (7/7 project + 1/1 unit) after the
Fontchange.Two orphans (
VideoWriter::lockFrame/submitFrame) appear when the check runs on Linux and not on macOS — they live inside#if TC_ASYNC_SCREEN_CAPTURE. Pre-existing onmainand unrelated to this change.FOR_AI_ASSISTANT.mdwas hand-edited rather than regenerated, for the same reason: regenerating it on Linux would drop those two macOS-only symbols from the index. The five added lines match whatemit-forai.jsrenders (signature taken from the generatedreference-data.json, alphabetical position preserved).Not in this PR
The
emit-web.js/emit-forai.jschanges needed to display sub-namespaced symbols. They are dead code until something actually lives in a sub-namespace, so they belong with the change that puts something there — exposingmcp::, which is the follow-up.