Created
October 20, 2014 14:11
-
-
Save apaleslimghost/60a3772e2224ad0384a2 to your computer and use it in GitHub Desktop.
Sweet.js bound access macro
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
macro (~) { | |
rule infix { $l:expr | $r:ident } => { (ref = $l, ref.$r.bind(ref)) } | |
rule infix { $l:expr | $r:expr } => { (ref = $l, ref[$r].bind(ref)) } | |
} | |
var c = a~b; | |
a({ | |
b: c~(foo) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment