Fix #4137: Caught errors named undefined

Previously, `catch`-less `try`s named the caught error `undefined`, instead of
`error` like usual.
This commit is contained in:
Simon Lydell
2015-11-02 08:05:35 +01:00
parent 87a854afb4
commit 89921c0667
3 changed files with 5 additions and 2 deletions

View File

@@ -1931,6 +1931,7 @@ exports.Try = class Try extends Base
[].concat @makeCode(" catch ("), placeholder.compileToFragments(o), @makeCode(") {\n"),
@recovery.compileToFragments(o, LEVEL_TOP), @makeCode("\n#{@tab}}")
else unless @ensure or @recovery
generatedErrorVariableName = o.scope.freeVariable 'error', reserve: no
[@makeCode(" catch (#{generatedErrorVariableName}) {}")]
else
[]