Skip to content

Commit 7f95ca6

Browse files
Keegan McAllisteralexcrichton
authored andcommitted
---
yaml --- r: 152820 b: refs/heads/try2 c: 26b2fa0 h: refs/heads/master v: v3
1 parent 2225e13 commit 7f95ca6

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
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 4e26e2d8ca0a389280cf9d46297043df9a63ce06
8+
refs/heads/try2: 26b2fa052fd25483c73709981deaa78f60cc6ac4
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/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)