Skip to content

fix(native): prototype method definitions missing complexity/cfg metrics in Rust engine #1340

@carlos-alm

Description

@carlos-alm

Summary

When the Rust native engine extracts prototype-based method definitions (via match_js_prototype_methods / emit_js_prototype_method in javascript.rs), the resulting Definition struct has complexity: None and cfg: None. Every other method/function definition in the Rust extractor calls compute_all_metrics and build_function_cfg.

This means codegraph complexity will silently produce null metrics for pre-ES6 prototype-defined methods in the native engine, while the WASM engine also doesn't compute complexity inline but downstream metrics may differ.

Location

crates/codegraph-core/src/extractors/javascript.rsemit_js_prototype_method function (lines ~364-374)

Fix

Call compute_all_metrics and build_function_cfg on the RHS function node when emitting prototype method definitions, consistent with how other method definitions are handled.

Context

Identified during PR #1339 review (Claude code review). The PR itself is parity-correct for call-edge resolution; this is a secondary complexity-metrics gap that should be addressed separately.

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