This repository was archived by the owner on Feb 12, 2022. It is now read-only.
This repository was archived by the owner on Feb 12, 2022. It is now read-only.
Closed
Description
Prepacking this...
(function () {
function outer(cond) {
if (cond) {
var value = 42;
function inner1() { return value; }
function inner2() { return value; }
__optimize(inner1);
__optimize(inner2);
return [inner1, inner2];
}
}
global.outer = outer;
__optimize(outer);
})();
produces the following.
(function () {
var _$0 = this;
var _1 = function (cond) {
var _6 = function () {
return _8;
};
var _7 = function () {
return _8;
};
return cond ? [_6, _7] : void 0;
};
var _8 = cond ? 42 : void 0;
_$0.outer = _1;
}).call(this);
Note that _8
is defined in the global code, but refers to cond
which is only defined in the outer
function. The issue stems for various problems in _getTarget
when it comes to optimized functions (some TODOs are present, some more things are implicitly wrong).