prepack
prepack copied to clipboard
Multiple Assignments in a Loop Doesn't Get Emitted
var n = __abstract('number', '(3)');
var i = 0;
var ii = 0;
var obj = {}
do {
obj[i] = 5;
obj[ii] = 6;
obj[i + 1000] = 7;
i++;
ii++
} while (i < n);
result = obj;
->
(function () {
var __empty = {};
var _$0 = 0;
var _$1 = 0;
var _2 = {};
do {
_2[_$0] = 7;
var _6 = _$0 + 1;
var _$2 = _6;
var _8 = _$1 + 1;
var _$3 = _8;
_$0 = _$2;
_$1 = _$3;
var _E = 3;
var _D = _$0 < _E;
var _$4 = _D;
} while (_$4);
result = _2;
})();
When there are multiple unknown properties assigned to in a loop, there should be multiple keys saved so that those statements can be emitted when generating the body.