feat(engine): support declaration body recovery and forward-decl resolution - #116
Merged
Conversation
Owner
Author
|
Yesterday, Github was down. Now Github actions huh. Nice |
HarshK97
force-pushed
the
feat/declaration-body-recovery
branch
3 times, most recently
from
August 18, 2026 14:02
50e505d to
b175caa
Compare
HarshK97
force-pushed
the
feat/declaration-body-recovery
branch
from
August 18, 2026 16:26
b175caa to
57d438b
Compare
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.
Problem
matchDeclarations, only the root declaration nodes were mapped. If the inner body had substantial additions, deletions, or structural modifications, top-down and bottom-up passes could fail to map the body blocks directly, leaving them to be treated as complete deletions and re-insertions rather than modified blocks.matchDeclarationscould pair a small forward declaration against a full definition on the destination side, leaving the actual definition body unmapped.What Changed
Blocksnode types to language rules schema ininternal/treesitter/rules.goand defined block node types across 14 languages (includingcompound_statement,block,statement_block, andconstructor_body).TestEveryLanguageBlocksAreValidSymbolsininternal/treesitter/rules_test.goto validate all block symbol types against their respective Tree-sitter grammars.matchDeclarationsby subtree size delta, so full definitions map to full definitions and forward declarations do not steal destination functions.matchDeclarationBodiesininternal/engine/matcher.goto locate corresponding block nodes within matched declarations, map them directly, and runRecoverdown their subtrees.internal/engine/declaration_test.go.Visual Comparison
php_guzzle_handler_curl_multiBefore
After