diff options
| author | Ben Gamari <bgamari.foss@gmail.com> | 2014-07-17 01:02:27 -0400 |
|---|---|---|
| committer | Ben Gamari <bgamari.foss@gmail.com> | 2014-07-17 01:02:27 -0400 |
| commit | a807aa1fca5f1dac03dd9440f735d0e223eef4af (patch) | |
| tree | 02853f7e18ea2f922739114658c58705ed6e934f /src/libsyntax | |
| parent | 96072d6efc110e81ab6e0a70e2bf9a96a53268b6 (diff) | |
| download | rust-a807aa1fca5f1dac03dd9440f735d0e223eef4af.tar.gz rust-a807aa1fca5f1dac03dd9440f735d0e223eef4af.zip | |
syntax: Add quote_method!
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/ext/quote.rs | 10 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 56484c4ba59..49bd3697884 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -371,6 +371,9 @@ pub fn syntax_expander_table() -> SyntaxEnv { syntax_expanders.insert(intern("quote_ty"), builtin_normal_expander( ext::quote::expand_quote_ty)); + syntax_expanders.insert(intern("quote_method"), + builtin_normal_expander( + ext::quote::expand_quote_method)); syntax_expanders.insert(intern("quote_item"), builtin_normal_expander( ext::quote::expand_quote_item)); diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 21c5626d16d..dec87915b3d 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -353,6 +353,16 @@ pub fn expand_quote_ty(cx: &mut ExtCtxt, base::MacExpr::new(expanded) } +pub fn expand_quote_method(cx: &mut ExtCtxt, + sp: Span, + tts: &[ast::TokenTree]) + -> Box<base::MacResult> { + let e_param_colons = cx.expr_none(sp); + let expanded = expand_parse_call(cx, sp, "parse_method", + vec!(e_param_colons), tts); + base::MacExpr::new(expanded) +} + pub fn expand_quote_stmt(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) |
