Closed sergei-startsev closed 5 years ago
The plugin generates redundant variables for some cases, e.g.:
In
export const foo = 'bar';
Out
const foo = 'bar'; var _foo = foo; export { _foo as foo }; var _foo2 = _foo; export function rewire$foo($stub) { _foo = $stub; } export function restore() { _foo = _foo2; }
Added _foo2 variable is redundant here, _foo can be restored by using original foo:
_foo2
_foo
foo
const foo = 'bar'; var _foo = foo; export { _foo as foo }; - var _foo2 = _foo; export function rewire$foo($stub) { _foo = $stub; } export function restore() { - _foo = _foo2; + _foo = foo; }
The PR eliminates redundant variables, it generates variables to capture only if required.
The plugin generates redundant variables for some cases, e.g.:
In
Out
Added
_foo2
variable is redundant here,_foo
can be restored by using originalfoo
:The PR eliminates redundant variables, it generates variables to capture only if required.