fix: emit valid JS for DestructuredArg with only a rest field#6444
fix: emit valid JS for DestructuredArg with only a rest field#6444FarhanAliRaza wants to merge 1 commit intoreflex-dev:mainfrom
Conversation
Greptile SummaryThis PR fixes Confidence Score: 5/5Safe to merge — minimal, well-targeted fix with regression tests covering all affected code paths. The change is a single-method, two-branch fix that handles all four combinations of empty/non-empty fields and present/absent rest. The new tests directly assert both the correct output and the absence of the previously broken form. No other logic is touched. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["DestructuredArg.to_javascript()"] --> B{"fields non-empty?"}
B -- Yes --> C["inner = ', '.join(fields)"]
B -- No --> D["inner = ''"]
C --> E{"rest set?"}
D --> E
E -- Yes, inner non-empty --> F["inner = '{inner}, ...{rest}'"]
E -- Yes, inner empty --> G["inner = '...{rest}'"]
E -- No --> H["inner unchanged"]
F --> I["return wrap(inner, '{', '}')"]
G --> I
H --> I
I --> J["Result: valid JS\ne.g. {a, b, ...rest} or {...rest} or {a, b} or {}"]
Reviews (1): Last reviewed commit: "fix: emit valid JS for DestructuredArg w..." | Re-trigger Greptile |
Merging this PR will not alter performance
Comparing Footnotes
|
All Submissions:
Type of change
Please delete options that are not relevant.
New Feature Submission:
Changes To Core Features:
closes #6443