Skip to content

Commit d3d83ef

Browse files
committed
docs(cpp,cuda): document pointer/reference declarator scope in handleDeclaration
Add an inline comment in handleCppDeclaration and handleCudaDeclaration explaining that pointer_declarator / reference_declarator children are intentionally skipped. Native Rust match_c_family_type_map has the same scope: it only iterates 'init_declarator' and 'identifier' children, so both engines behave identically for pointer/reference-typed locals.
1 parent 2986c81 commit d3d83ef

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

src/extractors/cpp.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,10 @@ function handleCppDeclaration(node: TreeSitterNode, ctx: ExtractorOutput): void
229229
} else if (kind === 'identifier') {
230230
nameNode = child;
231231
}
232+
// Note: pointer_declarator / reference_declarator children (e.g. `UserService *svc;`)
233+
// are intentionally skipped here — they are also skipped by the native Rust
234+
// match_c_family_type_map helper, which only handles 'init_declarator' and
235+
// 'identifier' children. Both engines have the same scope for this case.
232236
if (!nameNode) continue;
233237
const varName = unwrapCppDeclaratorName(nameNode);
234238
if (varName) {

src/extractors/cuda.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,10 @@ function handleCudaDeclaration(node: TreeSitterNode, ctx: ExtractorOutput): void
229229
} else if (kind === 'identifier') {
230230
nameNode = child;
231231
}
232+
// Note: pointer_declarator / reference_declarator children (e.g. `UserService *svc;`)
233+
// are intentionally skipped here — they are also skipped by the native Rust
234+
// match_c_family_type_map helper, which only handles 'init_declarator' and
235+
// 'identifier' children. Both engines have the same scope for this case.
232236
if (!nameNode) continue;
233237
const varName = extractCudaFieldName(nameNode);
234238
if (varName) {

0 commit comments

Comments
 (0)