Skip to content

fix(native): func-prop post-pass misses call edges in files that only call but don't define func-prop methods #1371

Description

@carlos-alm

Problem

The runPostNativePrototypeMethods post-pass in native-orchestrator.ts pre-filters files to only those that match the func-prop regex (fn.method = function(){} or arrow form). This means the WASM re-parse only covers definition files.

A file that only calls f.method() without also defining any \w+.\w+ = function pattern is absent from wasmResults and its call edges to newly-inserted func-prop nodes are never emitted.

Concrete example:

  • lib.js defines f.method = function(){} → f.method node is inserted
  • app.js only calls f.method() → this edge is silently dropped

The comment at the top of the loop says "Resolve call edges in every file — not just those that define new func-prop methods", which contradicts the implementation.

Fix options

  1. Extend the WASM parse to include ALL JS/TS files (higher cost but correct)
  2. After inserting new nodes, query the DB for raw call sites that match the receiver name/method name pattern of newly-inserted nodes (DB-based, no re-parse needed)

Impact

Low-frequency in practice: most codebases that use fn.method = function(){} tend to define and call in the same file or module. But multi-file patterns are a legitimate use case.

Context

Identified in Greptile review of PR #1331, comment #1331 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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