bublejs / bublejs/buble

Bug in class mixin compilation.

Open
#243 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
874
Forks
62
PR merge metrics
No merged PRs in 30d

Description

I could have sworn this was addressed last year. Actually have been waiting for this to sort out for a couple years now. Am patient as the `acorn` library is still a mystery to me or I would submit a PR _(not an issue)_.

We need to [create a thunk](https://en.wikipedia.org/wiki/Thunk) and assign to a constant. This is used later with the [`Class Mixin` pattern](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#Mix-ins).

```javascript
const Foo = Bar => class extends Bar {}

// ... a few moments later ...

class Baz extends Foo(x)
```
with `0.19.6` we could bypass by wrapping class in parenthesis `(class extends Bar {})`

However, upgrading to 0.19.8 issued the following malformed code
![Capture d’écran 2020-02-14 à 14 03 56](https://user-images.githubusercontent.com/38223/74559682-f8d6b080-4f32-11ea-9da4-c4134fc5158f.png)

Attempted on https://buble.surge.sh site but gives yet another permutation of broken code.

repro: https://buble.surge.sh/#const%20Foo%20%3D%20Bar%20%3D%3E%20class%20extends%20Bar%20%7B%7D
![Capture d’écran 2020-02-14 à 14 07 31](https://user-images.githubusercontent.com/38223/74559893-6551af80-4f33-11ea-8d76-38da28bfa567.png)

Please let me know if I am doing something wrong. Or where I can help. My only caveat is a lack of knowledge on the innards of `acorn`.

Thanks in advance!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.