Skip to content

Commit da6944a

Browse files
Keegan McAllisteralexcrichton
authored andcommitted
---
yaml --- r: 118982 b: refs/heads/master c: 26b2fa0 h: refs/heads/master v: v3
1 parent 2d5e107 commit da6944a

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 4e26e2d8ca0a389280cf9d46297043df9a63ce06
2+
refs/heads/master: 26b2fa052fd25483c73709981deaa78f60cc6ac4
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 71fe44def9676d519f5ce5d7304e581a42cf2c70
55
refs/heads/try: 1813e5aa1a03b0596b8de7abd1af31edf5d6098f

trunk/src/libsyntax/ext/quote.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ use std::gc::Gc;
3232

3333
pub mod rt {
3434
use ast;
35+
use codemap::Spanned;
3536
use ext::base::ExtCtxt;
3637
use parse::token;
3738
use parse;
@@ -48,12 +49,25 @@ pub mod rt {
4849
fn to_tokens(&self, _cx: &ExtCtxt) -> Vec<TokenTree> ;
4950
}
5051

52+
impl ToTokens for TokenTree {
53+
fn to_tokens(&self, _cx: &ExtCtxt) -> Vec<TokenTree> {
54+
vec!(self.clone())
55+
}
56+
}
57+
5158
impl ToTokens for Vec<TokenTree> {
5259
fn to_tokens(&self, _cx: &ExtCtxt) -> Vec<TokenTree> {
5360
(*self).clone()
5461
}
5562
}
5663

64+
impl<T: ToTokens> ToTokens for Spanned<T> {
65+
fn to_tokens(&self, cx: &ExtCtxt) -> Vec<TokenTree> {
66+
// FIXME: use the span?
67+
self.node.to_tokens(cx)
68+
}
69+
}
70+
5771
/* Should be (when bugs in default methods are fixed):
5872
5973
trait ToSource : ToTokens {
@@ -121,6 +135,7 @@ pub mod rt {
121135
impl_to_source!(Generics, generics_to_str)
122136
impl_to_source!(Gc<ast::Item>, item_to_str)
123137
impl_to_source!(Gc<ast::Expr>, expr_to_str)
138+
impl_to_source!(Gc<ast::Pat>, pat_to_str)
124139
impl_to_source_slice!(ast::Ty, ", ")
125140
impl_to_source_slice!(Gc<ast::Item>, "\n\n")
126141

@@ -207,6 +222,7 @@ pub mod rt {
207222

208223
impl_to_tokens!(ast::Ident)
209224
impl_to_tokens!(Gc<ast::Item>)
225+
impl_to_tokens!(Gc<ast::Pat>)
210226
impl_to_tokens_lifetime!(&'a [Gc<ast::Item>])
211227
impl_to_tokens!(ast::Ty)
212228
impl_to_tokens_lifetime!(&'a [ast::Ty])

0 commit comments

Comments
 (0)