bublejs / bublejs/buble

Helper variables for destructuring assignments in for-of loop heads are not declared

Open
#110 0 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

Input:
```js
var a, b;
for({x: [a, b]} of [])
a()
```
Output:
```js
var a, b;
for(var i = 0, list = []; i < list.length; i += 1)
var ref = list[i];
ref_x = ref.x;
a = ref_x[0];
b = ref_x[1];

a()
}
```

`ref_x` is undeclared.

Input:
```js
var rest;
for({...rest} of [])
a();
```
Output:
```js
function objectWithoutProperties (obj, exclude) { var target = {}; for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k) && exclude.indexOf(k) === -1) target[k] = obj[k]; return target; }
var rest;
for(var i = 0, list = []; i < list.length; i += 1)
var ref = list[i];
rest$1 = objectWithoutProperties( ref, [] );
rest = rest$1;

a();
}
```

`rest$1` is undeclared.

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.