bublejs / buble

https://buble.surge.sh
MIT License
869 stars 67 forks source link

Fix recognition of catch-declared variables #237

Closed luiscubal closed 4 years ago

luiscubal commented 4 years ago

Buble did not recognize variables declared in catch clauses, causing the code in the added unit test to fail to compile.

luiscubal commented 4 years ago

The test that failed is this one:

var probeBefore = function() { return x; };
var probeTry, probeParam;
var x = 'outside';

try {
  probeTry = function() { return x; };

  throw ['inside'];
} catch ([x, _ = probeParam = function() { return x; }]) {}

assert.sameValue(probeBefore(), 'outside');
assert.sameValue(probeTry(), 'outside');
assert.sameValue(probeParam(), 'inside');

I tried this out with buble.surge.sh and jsfiddle and it seems to me that, as of today, this test is failing. This commit makes that test pass.

language/statements/try/scope-catch-param-lex-open.js: Expected s1_lexicalScopingWithLoopsAndClassesAndStuff, but got {"pass":"true"}

I think I'll just disable the part of the code where this test being skipped.

luiscubal commented 4 years ago

The tests failed for Node 6 again (with the exact same error as #236 ). I didn't change anything related to any "unicodeCodePointEscapes" here either, so I don't know what causes this.