Siorki / RegPack

Self-contained packer for size-constrained JS code
Other
298 stars 14 forks source link

$ from E6 template literal gets mistaken for a variable name and reassigned #84

Closed Siorki closed 5 years ago

Siorki commented 5 years ago

The example from #82 contains several string literals ${expression}

If the variable $ is not protected against renaming, the module misinterprets it as a variable and replaces it, yielding a (non-working) result such as H{expression}.

Siorki commented 5 years ago

Actually a combination of issues.

Replacement of $ inside strings is fixed since #57. This was showing up here because of #82 - the strings boundaries were incorrectly computed (yet correctly rearranged afterwards), and the $ got replaced as RegPack believes it was outside of a string. Fix for #82 eliminates the symptom => closing the issue.