* Add failing test of function parameter bindings in a catch block. This test can be run in isolation via the following command: TEST_GREP='block-scoping.*function in catch' make test-only This test fails because BlockScoping#getLetReferences accidentally considers the parameters of the function declaration as let bindings in the catch scope. When the name of the catch parameter is the same as one of the function's parameter names, the function declaration will be unnecessarily wrapped to isolate its parameters from the outer scope. While the extra wrapping may not seem harmful in this case, this behavior is a symptom of a deeper problem that causes very subtle bugs in transform code involving catch parameters and function declarations. This test case was just the simplest example I could find to demonstrate the problem. I have a proposed fix for this problem that I will push as soon as the tests fail for this commit. * Make BlockScoping#getLetReferences ignore function parameters.
8 lines
82 B
JavaScript
8 lines
82 B
JavaScript
try {
|
|
foo();
|
|
} catch (x) {
|
|
var harmless = function (x) {
|
|
return x;
|
|
};
|
|
}
|