Last active
January 4, 2016 18:59
-
-
Save btd/8663940 to your computer and use it in GitHub Desktop.
One attempt to make arrow functions from es6
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 { ( $arg:ident (,) ... ) | { $body ... $last:expr } } => { | |
(function x( $arg (,) ... ) { | |
$( $body) ... | |
return $last | |
}).bind(this); | |
} | |
rule infix { ( $arg:ident (,) ... ) | $last:expr } => { | |
(function x( $arg (,) ... ) { | |
return $last | |
}).bind(this); | |
} | |
rule infix { () | { $body ... $last:expr } } => { | |
(function x( ) { | |
$body ...; | |
return $last | |
}).bind(this); | |
} | |
rule infix { $x | { $body ... $last:expr } } => { | |
(function x($x) { | |
$body ...; | |
return $last | |
}).bind(this); | |
} | |
rule infix { $x | $last:expr } => { | |
(function x($x) { | |
return $last | |
}).bind(this); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The semicolons error on something like
[1, 2, 3].map(x => x+1);