fix rest parameter array allocation loop being incorrectly aliased - fixes #1800
This commit is contained in:
@@ -13,6 +13,11 @@ _Note: Gaps between patch versions are faulty/broken releases._
|
||||
|
||||
See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
|
||||
|
||||
## 5.6.3
|
||||
|
||||
* **Bug Fix**
|
||||
* Fix rest parameter array allocation loop being incorrectly aliased.
|
||||
|
||||
## 5.6.2
|
||||
|
||||
* **Bug Fix**
|
||||
|
||||
@@ -100,7 +100,6 @@ export var visitor = {
|
||||
}
|
||||
|
||||
// check and optimise for extremely common cases
|
||||
|
||||
var state = {
|
||||
references: [],
|
||||
offset: node.params.length,
|
||||
@@ -135,6 +134,9 @@ export var visitor = {
|
||||
state.references = state.references.concat(state.candidates);
|
||||
}
|
||||
|
||||
// deopt shadowed functions as transforms like regenerator may try touch the allocation loop
|
||||
state.deopted = state.deopted || !!node.shadow;
|
||||
|
||||
//
|
||||
|
||||
var start = t.literal(node.params.length);
|
||||
@@ -173,13 +175,13 @@ export var visitor = {
|
||||
LEN: len
|
||||
});
|
||||
|
||||
if (!state.deopted) {
|
||||
if (state.deopted) {
|
||||
loop._blockHoist = node.params.length + 1;
|
||||
node.body.body.unshift(loop);
|
||||
} else {
|
||||
// perform allocation at the lowest common denominator of all references
|
||||
loop._blockHoist = 1;
|
||||
this.getEarliestCommonAncestorFrom(state.references).getStatementParent().insertBefore(loop);
|
||||
return;
|
||||
}
|
||||
|
||||
loop._blockHoist = node.params.length + 1;
|
||||
node.body.body.unshift(loop);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
var fn = async (...rest) => rest;
|
||||
|
||||
var fn = async (...rest) => {
|
||||
if (true) {
|
||||
rest;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
|
||||
var _this = this;
|
||||
|
||||
var fn = function fn() {
|
||||
for (var _len = arguments.length, rest = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
rest[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
return regeneratorRuntime.async(function fn$(context$1$0) {
|
||||
while (1) switch (context$1$0.prev = context$1$0.next) {
|
||||
case 0:
|
||||
return context$1$0.abrupt("return", rest);
|
||||
|
||||
case 1:
|
||||
case "end":
|
||||
return context$1$0.stop();
|
||||
}
|
||||
}, null, _this);
|
||||
};
|
||||
|
||||
var fn = function fn() {
|
||||
for (var _len2 = arguments.length, rest = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
||||
rest[_key2] = arguments[_key2];
|
||||
}
|
||||
|
||||
return regeneratorRuntime.async(function fn$(context$1$0) {
|
||||
while (1) switch (context$1$0.prev = context$1$0.next) {
|
||||
case 0:
|
||||
if (true) {
|
||||
rest;
|
||||
}
|
||||
|
||||
case 1:
|
||||
case "end":
|
||||
return context$1$0.stop();
|
||||
}
|
||||
}, null, _this);
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"stage": 0
|
||||
}
|
||||
Reference in New Issue
Block a user