| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…t decls
extractDestructuredBindings (TS/WASM) and its mirror
extract_destructured_bindings (native) only recognized
shorthand_property_identifier_pattern and pair_pattern children when
creating constant Definitions for a plain object-destructuring const
declaration, so `const { a, ...rest } = x` never got a Definition for
rest and `const { a = 1 } = x` never got one for a at all.
Add object_assignment_pattern and rest_pattern/rest_element branches to
both engines, mirroring the equivalent fix already landed for
extractDynamicImportNames/extract_dynamic_import_names in #1920. The
array-pattern counterpart (extractArrayPatternBindings/
extract_array_pattern_bindings) already handled both cases correctly
in both engines, so no change was needed there.
docs check acknowledged: internal extractor bug fix, no new CLI
surface, language support, or architecture change -- README.md,
CLAUDE.md, and ROADMAP.md are unaffected.
Closes #2051
Impact: 1 functions changed, 6 affected
Greptile SummaryThe PR completes destructured const binding extraction for object rest elements, shorthand defaults, and renamed defaults while preserving native/WASM parity.
Confidence Score: 5/5The PR appears safe to merge. The previously reported renamed-default omission is addressed in both extraction engines, with the nested assignment pattern’s local identifier now emitted through the shared destructuring helpers; no blocking failure remains. Important Files Changed
Reviews (2): Last reviewed commit: "fix(extractors): extract renamed destruc..." | Re-trigger Greptile |
Sorry, something went wrong.
| ) { | ||
| definitions.push({ name: value.text, kind: 'constant', line, endLine }); | ||
| } | ||
| } else if (child.type === 'object_assignment_pattern') { |
There was a problem hiding this comment.
Renamed defaults remain unbound
When a top-level const uses a renamed default such as const { key: local = fallback } = source, the pair_pattern branch rejects its nested assignment_pattern, causing the local Definition to be omitted and downstream calls or references to remain unresolved.
Knowledge Base Used:
Sorry, something went wrong.
Codegraph Impact Analysis1 functions changed → 6 callers affected across 1 files
|
Sorry, something went wrong.
… value Greptile follow-up to the #2051 fix: extractDestructuredBindings (TS/WASM) and extract_destructured_bindings (native) rejected an assignment_pattern nested under a pair_pattern's value field, so a renamed binding with a default value (const { key: local = fallback } = x) never got a Definition for local at all. Add the assignment_pattern branch to both engines' pair_pattern/pair handling, mirroring the identical branch already present in extractDynamicImportNames/collect_object_pattern_names since #1824. docs check acknowledged: internal extractor bug fix, no new CLI surface, language support, or architecture change -- README.md, CLAUDE.md, and ROADMAP.md are unaffected. Impact: 1 functions changed, 6 affected
|
Good catch — fixed in 0fa8d57. extractDestructuredBindings/extract_destructured_bindings's pair_pattern/pair branch now also handles an assignment_pattern nested under value (const { key: local = fallback } = x), mirroring the identical branch already in extractDynamicImportNames/collect_object_pattern_names since #1824. Added regression tests in both engines confirming local gets a constant Definition and key does not. |
Sorry, something went wrong.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
Repro (issue's own example)
Confirmed via a real buildGraph() run against a small fixture on both engine: 'wasm' and engine: 'native' (native addon rebuilt + codesigned locally) — both produce identical constant definitions: a, d, rest, someValue.
Test plan
Closes #2051