Miscompilation with spread operator and lack of semicolons.
- Dominant language
- JavaScript
- Stars
- 874
- Forks
- 62
- PR merge metrics
- No merged PRs in 30d
Description
https://buble.surge.sh/#function%20foobar(a%2C%20b)%20%7B%0A%20%20return%20%7B%0A%20%20%20%20foo%3A%20%5Ba%2C%20b%5D%2C%0A%20%20%20%20bar%3A%20%5Bb%2C%20a%5D%2C%0A%20%20%7D%3B%0A%7D%0A%0Afunction%20foo()%20%7B%0A%20%20%09const%20res%20%3D%20%7B%0A%20%20%20%20%09foo%3A%20%5B%5D%2C%0A%20%20%20%20%20%20%09bar%3A%20%5B%5D%2C%0A%20%20%20%20%7D%0A%20%20%20%20const%20r%20%3D%20foobar(1%2C%202)%0A%20%20%20%20res.foo.push(...r.foo)%0A%20%20%20%20res.bar.push(...r.bar)%0A%20%20%09return%20res%0A%7D%0A
Original code works, compiled code fails with `foobar(...) is not a function`.
This is because lack of semicolons makes the resulting code be executed like this:
```js
var r = foobar(1, 2)(ref = res.foo).push.apply(ref, r.foo)
```
while it should be like this
```js
var r = foobar(1, 2);
(ref = res.foo).push.apply(ref, r.foo)
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.