Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

broken output code: ReferenceError: x is not defined #117

Closed
milahu opened this issue Feb 15, 2024 · 1 comment · Fixed by #114
Closed

broken output code: ReferenceError: x is not defined #117

milahu opened this issue Feb 15, 2024 · 1 comment · Fixed by #114
Labels
bug Something isn't working scope: unminify

Comments

@milahu
Copy link

milahu commented Feb 15, 2024

Describe the bug

i am throwing wakaru at a 3MB file bx-progressivewebapp.js
preprocessed with webcrack -- same input code as in #110

the output code produces the runtime error

ReferenceError: bbb is not defined

Input code

let bbb = aaa.target;
let ccc = bbb.parentElement;

Reproduction

No response

Steps to reproduce

No response

Expected behavior

input

let bbb = aaa.target;
let ccc = bbb.parentElement;

transform 1: replace bbb with target

let { target } = aaa;
let ccc = target.parentElement;

transform 2: replace ccc with parentElement

let { target } = aaa;
let { parentElement } = target;

Actual behavior

let { target } = aaa;
let { parentElement } = bbb; // FIXME ReferenceError: bbb is not defined

i guess the problem is that the 2 transforms happen in parallel

and/or these are 2 separate transforms

@milahu
Copy link
Author

milahu commented Feb 17, 2024

similar

currently, wakaru produces this diff

       {
-        let al = aj.currentToken;
+        let { currentToken } = aj;
         aj.read();
         if (aj.currentToken.tokenType === "EOF") {

expected: also replace aj.currentToken with currentToken

edit: probably no. aj.currentToken can have side effects that are required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working scope: unminify
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants