Let const in catchclause#2235
Conversation
|
The spec is so indecisive on the point about the var in the catch block. They even suggest two options for how to treat it. The first one is the one you mentioned in section 13.14.1. The second one is from B.3.5:
The spec is trying to disallow it for all new constructs, but not for old constructs. In my opinion, we should only error for the var case if the var is initialized, because then it will overwrite the catch parameter. |
There was a problem hiding this comment.
Can this be a binding pattern?
There was a problem hiding this comment.
Sorry, I didn't see the previous condition that checks it's an identifier
|
👍 |
This is my attempt at solving #2186.
If this isn't the right way of solving this, feel free to close this PR.
I didn't implement this part:
Because it felt like a breaking change (but that might not be a bad thing in ES6 mode though)
but I couldn't find a browser which actually did this, tried IE 11, Firefox Nightly and Chrome (Stable).
And the spec also mentions (B.3.5):
So I'm not sure if a var should error (or am I totally not understanding the spec here?)
Tests are coming :)