Closed j4k0xb closed 3 months ago
Great find, will fix this for next release.
just found an edge case: const
can only be safely converted to let
instead of var
because of closures:
for (let i = 0; i < 3; i++) {
const obj = { prop: i };
setTimeout(() => {
console.log(obj.prop); // outputs 0, 1, 2
}, 100);
}
after obfuscation: 2, 2, 2
I will get to work on this
Describe the bug:
object extraction of a
const
variable errors at runtimeConfig and Small code sample
Config:
Code:
Expected behavior
The program should output
1
Actual behavior
TypeError: Assignment to constant variable.
obfuscated code:
Additional context
an easy fix would probably be to convert the declaration to let or var