Skip to content

When using for+let, the loop variable isn't available in the when clause #992

Description

@vendethiel

exemple:

for let k in v when k
  ...

result:

var i$, ref$, len$;
for (i$ = 0, len$ = (ref$ = v).length; i$ < len$; ++i$) {
  if (k) {
    (fn$.call(this, ref$[i$]));
  }
}
function fn$(k){
  throw Error('unimplemented');
}

expected:

var i$, ref$, len$;
for (i$ = 0, len$ = (ref$ = v).length; i$ < len$; ++i$) {
  var k = ref$[i$];
  if (k) {
    (fn$.call(this, k));
  }
}
function fn$(k){
  throw Error('unimplemented');
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions