fix: resolve computed string-literal keys in object-literal extraction#1885
Conversation
…n (docs check acknowledged)
extractObjectLiteralFunctions's pair branch only stripped quotes for
plain string-typed keys, so a computed string-literal key like
{ ['foo']: () => {} } fell through to the raw bracket/quote text,
emitting a definition named obj.['foo'] instead of obj.foo. This
broke resolution of obj.foo() call sites.
Extract the computed_property_name-unwrapping logic already used by
resolveMethodDefinitionName into a shared resolveComputedKeyName
helper and reuse it in the pair branch, skipping the pair (like the
adjacent method_definition branch already does) when the computed key
isn't a resolvable string literal (e.g. [Symbol.iterator]).
Mirrors the same fix in the Rust native engine: extract_object_literal_functions
(const) and match_js_objlit_qualified_method_defs (let/var) both had the
identical gap, now routed through shared resolve_computed_key_name /
resolve_pair_key_name helpers alongside resolve_method_def_name.
No README/CLAUDE.md/ROADMAP.md changes needed — internal extractor bug
fix, no new language, command, or architecture surface.
Fixes #1764
Impact: 3 functions changed, 17 affected
Greptile SummaryThis PR fixes a resolution bug where computed string-literal object-literal keys like
Confidence Score: 5/5Safe to merge — targeted bug fix that adds a shared helper with no behavior change for existing key types, backed by comprehensive tests on both engines. The change is a clean extraction and reuse of logic already proven correct in the method_definition branch. Both fix sites in Rust are patched, implementations are symmetric across TS and Rust, and tests cover the full matrix of cases. No existing code paths are altered in behavior. No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "Merge branch 'fix/issue-1763-busytimeout..." | Re-trigger Greptile |
Codegraph Impact Analysis3 functions changed → 17 callers affected across 1 files
|
…sue-1764-computed-key-object-literal
Summary
extractObjectLiteralFunctions'spairbranch only stripped quotes for plainstring-typed keys; a computed string-literal key like{ ['foo']: () => {} }fell through to rawkeyNode.text, emittingobj.['foo']instead ofobj.foo, soobj.foo()call sites could never resolve to it. Reproduced identically on both engines.computed_property_name-unwrapping logic (already correct in the adjacentmethod_definitionbranch'sresolveMethodDefinitionName) into a sharedresolveComputedKeyNamehelper, reused by thepairbranch. Rust mirror needed two fix sites (const path and let/var path, which Rust splits into separate functions where TS uses one).Closes #1764
Test plan
npm test— full suite green (3533 passed, 0 failed)npm run lint/npm run typecheck— cleancargo test --release— 448 passedobj.foo/obj.barnow resolve correctly (verified viawhereandqueryshowing identical caller edges on both engines)[Symbol.iterator]computed key confirmed skipped (no garbage definition) on both engines, matchingmethod_definition's existing precedent; let/var parity confirmed separatelyFiled #1884 for an out-of-scope finding: the same unwrapping gap exists in several adjacent typeMap-seeding functions (affecting
typeMapseeding, notDefinition.name, so they don't reproduce this issue's symptom).Stacked on #1883 (base branch
fix/issue-1763-busytimeout-readonly-wiring) — only the extractor/test diff is this issue's change.