Skip to content

refactor: consolidate CUDA_PRIMITIVE_TYPES and CPP_PRIMITIVE_TYPES into shared constant #1518

@carlos-alm

Description

@carlos-alm

Context

src/extractors/cuda.ts defines CUDA_PRIMITIVE_TYPES and src/extractors/cpp.ts defines CPP_PRIMITIVE_TYPES. Both sets are identical (24 members: int, long, short, unsigned, signed, float, double, char, bool, void, wchar_t, auto, size_t, uint8_t–uint64_t, int8_t–int64_t, ptrdiff_t, intptr_t, uintptr_t).

Noted during review of PR #1503 (Greptile summary).

Fix

Extract a single C_PRIMITIVE_TYPES constant in a shared location (e.g. src/extractors/helpers.ts) and import it in both cpp.ts and cuda.ts. Update isCudaPrimitiveType and isPrimitiveCppType to reference the shared set.

Impact

Pure refactor — no behavioral change. Eliminates the risk of the two sets drifting apart if C++ or CUDA adds new primitive types in future tree-sitter grammar versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions