mirror of
https://github.com/colbymchenry/codegraph.git
synced 2026-10-29 06:46:49 +08:00
Rust command attributes were not retained as decorators, so runtime entry points could appear as dead code. Preserve tauri::command metadata in both native and fallback extraction and reuse the existing decorated exclusion. Add SQLite regression coverage and native/fallback parity checks, including negative cases. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9b5c8e49dd
commit
87e79c6ee8
@@ -5313,6 +5313,21 @@ export class TreeSitterExtractor {
|
||||
* (most non-decorator-using languages), the function is a no-op.
|
||||
*/
|
||||
private extractDecoratorsFor(declNode: SyntaxNode, decoratedId: string): void {
|
||||
// Rust outer attributes are siblings, not children of the function.
|
||||
// Preserve Tauri's runtime registration for the dead-code decorator rule.
|
||||
if (this.language === 'rust' && declNode.type === 'function_item') {
|
||||
for (let sibling = declNode.previousNamedSibling; sibling; sibling = sibling.previousNamedSibling) {
|
||||
if (sibling.type === 'line_comment' || sibling.type === 'block_comment') continue;
|
||||
if (sibling.type !== 'attribute_item') break;
|
||||
const attribute = sibling.namedChild(0);
|
||||
const name = attribute?.namedChild(0)?.text.replace(/\s/g, '');
|
||||
if (name === 'tauri::command') {
|
||||
const decorated = this.nodes.find(n => n.id === decoratedId);
|
||||
if (decorated) decorated.decorators = ['tauri::command'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
const consider = (n: SyntaxNode | null): void => {
|
||||
if (!n) return;
|
||||
// Solidity `modifier_invocation` (unique to that grammar) sits
|
||||
|
||||
Reference in New Issue
Block a user