bublejs / bublejs/buble

Wrong variable name in block scope

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

Description

The following code

```js
const pts = [];
{
const pts = [];
pts.push(...[1,2,3]);
}
```
will be transformed into

```js
var pts = [];
{
var pts$1 = [];
pts$1.push.apply(pts, [1,2,3]);
}
```

The first argument of apply is wrong. It should be `pts$1.push.apply(pts$1, [1,2,3]);`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the JavaScript example from the issue and inspect the transformation that renames block-scoped variables and lowers the spread call to apply. Trace why the generated receiver remains pts instead of pts$1. Done means the transformed call uses pts$1 as both the method receiver and apply context, with a regression test covering this example.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.