1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

allowing empty bodies in try blocks and in catch blocks

This commit is contained in:
Jeremy Ashkenas 2010-06-30 20:53:09 -04:00
parent cb45c8feac
commit 5ca5a504a4
4 changed files with 103 additions and 91 deletions

View file

@ -325,6 +325,8 @@
Catch: [
o("CATCH Identifier Block", function() {
return [$2, $3];
}), o("CATCH Identifier TERMINATOR", function() {
return [$2, new Expressions()];
})
],
Throw: [

File diff suppressed because one or more lines are too long

View file

@ -370,6 +370,7 @@ grammar: {
# A catch clause names its error and runs a block of code.
Catch: [
o "CATCH Identifier Block", -> [$2, $3]
o "CATCH Identifier TERMINATOR", -> [$2, new Expressions]
]
# Throw an exception object.

View file

@ -21,4 +21,11 @@ ok result is 2
result: try throw 'error' catch err then err.length
ok result is 5
ok result is 5
# try/catch with empty clauses still compiles.
try
# nothing
catch err
#nothing