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:
parent
cb45c8feac
commit
5ca5a504a4
4 changed files with 103 additions and 91 deletions
|
@ -325,6 +325,8 @@
|
|||
Catch: [
|
||||
o("CATCH Identifier Block", function() {
|
||||
return [$2, $3];
|
||||
}), o("CATCH Identifier TERMINATOR", function() {
|
||||
return [$2, new Expressions()];
|
||||
})
|
||||
],
|
||||
Throw: [
|
||||
|
|
182
lib/parser.js
182
lib/parser.js
File diff suppressed because one or more lines are too long
|
@ -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.
|
||||
|
|
|
@ -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
|
Loading…
Reference in a new issue