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

Breaks recursive IIFE code #27

Open
forivall opened this issue Jan 13, 2022 · 1 comment
Open

Breaks recursive IIFE code #27

forivall opened this issue Jan 13, 2022 · 1 comment
Labels

Comments

@forivall
Copy link

(contrived example, based on code i was unminifying)

function e(t) {
  function n() {}
  var e = 'foo';
  var c = [1, 2, 3];
  (function t(e, a, n) {
    console.log(e);
    (n < a.length) && t(e, a, n + 1)
  })(n, c);
}

on "safe" safety level, this is unminified to

function e(t) {
  function n() {}
  var e = 'foo';
  var c = [1, 2, 3];
  (function t() {
    var e = n;
    var a = c;
    var n;
    console.log(e);
    if (n < a.length) {
      t(e, a, n + 1);
    }
  })();
}

in which the n is now shadowed and is not available in the iife, and the recursion is broken

@bakkot
Copy link
Member

bakkot commented Jan 13, 2022

Thanks for the report, that's definitely a bug!

@bakkot bakkot added the bug label Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants