Comment #2 on issue 4210 by [email protected]: TDZ is not enforced in for-in/of loop expression
https://code.google.com/p/v8/issues/detail?id=4210

Indeed this is a desugaring bug. The "const x" in the snippet above gets moved inside the loop's block:

var temp;
for (temp in { x }) {
  const x = temp;
}

The obvious hack would be to wrap the for statement in a block and add an unused let declaration for x:

{
  var temp;
  for (temp in { x }) {
    const x = temp;
  }
  let x;
}

This is actually pretty similar to what the spec does, and from first inspection looks safe (no code ever has access to that block without shadowing the let decl). But it seems pretty ugly. Do we have a more standard way to create TDZs?

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to