I played a bit more with D8, and it's possible that the way variable resolution is now done for the catch statement is still not quite right.
In our system, all variables and functions declared inside the catch part are shown as belonging to the catch part. However, in D8, it seems that only the exception variable belongs to the scope of the catch part, while other declarations found in there are only locals.
Furthermore, when one inserts a function declaration inside a catch part, in D8, this function declaration will not capture the exception variable. It's as if all function declarations inside a function or the global scope are directly at the beginning of the said function or program (their closure is created once). However, function expressions can capture the exception variable, because a new closure is created each time the expression is evaluated.
I suspect that this is conformant to the standard, but we should look to make sure. If this is the correct behavior, Mark, do you want to take another look at variable resolution?
- Maxime