Closed caspervonb closed 5 years ago
This rewrites identifiers in such a way that closures become tangible objects with late-lazy initialisation.
For example, take the following potential closures
setTimeout(function beep() { setTimeout(function boop() { console.log(typeof value); setTimeout(beep); }, 1000); }, 1000);
Change that into the following
setTimeout(function beep() { var value = 0; setTimeout(function boop() { console.log(typeof value); setTimeout(beep); }, 1000); }, 1000);
Previously, this would continue to output undefined but with this it will reflect the intended change and output number.
number
This can also unblock #9, since closures are mutable and accessible there is no need to evaluate in-place.
Demo
This rewrites identifiers in such a way that closures become tangible objects with late-lazy initialisation.
For example, take the following potential closures
Change that into the following
Previously, this would continue to output undefined but with this it will reflect the intended change and output
number
.This can also unblock #9, since closures are mutable and accessible there is no need to evaluate in-place.