Skip to content

minifier: incorrect inlining to for-in with let declaration #18650

@sapphi-red

Description

@sapphi-red
{
  var name = 'name1'
  const foo = { foo: 1 }
  name = 'name2'
  for (let name in foo) {
    console.log(name)
  }
  console.log(name)
}

is compressed to

var name = "name1";
for (let name in name = "name2", { foo: 1 }) console.log(name);
console.log(name);

. But this is incorrect because name is now shadowed after the compression.

playground

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions