Last active
September 16, 2015 10:55
-
-
Save poying/5055079f1976c1c36d29 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let _try_catch = macro { | |
rule { catch ($e:ident) { $body ...} } => { | |
{ | |
let $e = __e; | |
$body ... | |
return; | |
} | |
} | |
rule { catch ($e:ident if $c:expr) { $body ...} } => { | |
{ | |
let $e = __e; | |
if ($c) { | |
$body ... | |
return; | |
} | |
} | |
} | |
} | |
let try = macro { | |
rule { { $body ...} $c:_try_catch ... } => { | |
try { | |
$body ... | |
} catch (__e) { | |
(function () { | |
'use strict'; | |
$c ... | |
})(); | |
} | |
} | |
} |
Author
poying
commented
Sep 16, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment