jashkenas / jashkenas/coffeescript

Bug: Re-ordered nested non-end BindingRestElement doesn't get transpiled

Open
#5,438 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
CoffeeScript
Stars
16.6k
Forks
2k
PR merge metrics
No merged PRs in 30d

Description

### Input Code

https://coffeescript.org/#try:(%7Ba%2C%20b...%2C%20c%3A%20%5Bd%2C%20...e%2C%20f%5D%7D)%20-%3E%0A%20%20x%0A

```coffee
({a, b..., c: [d, ...e, f]}) ->
```

### Expected Behavior
```javascript
var splice = [].splice;
function({a, c: [d, ...e], ...b}) {
var f;
[f] = splice.call(e, -1)
}
```

### Current Behavior
```javascript
(function({
a,
c: [d, ...e, f],
...b
}) {});
```

### Possible Solution

### Context

### Environment

* CoffeeScript version: 2.7.0
* Node.js version:

Contributor guide

Open the contributing guide

Research direction

Reproduce the CoffeeScript example from the linked try page and compare the current output with the expected JavaScript shown here. Trace the compiler handling of the nested reordered BindingRestElement, then verify that the generated output removes the trailing element from the rest binding while preserving the expected destructuring behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
coffeescript, javascript
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.