use fold::Folder;
use parse;
use parse::token;
+ use ptr::P;
use util::parser_testing::{string_to_parser};
use util::parser_testing::{string_to_pat, string_to_crate, strs_to_idents};
use visit;
let attr1 = make_dummy_attr ("foo");
let attr2 = make_dummy_attr ("bar");
let escape_attr = make_dummy_attr ("macro_escape");
- let attrs1 = vec!(attr1, escape_attr, attr2);
+ let attrs1 = vec!(attr1.clone(), escape_attr, attr2.clone());
assert_eq!(contains_macro_escape(attrs1.as_slice()),true);
let attrs2 = vec!(attr1,attr2);
assert_eq!(contains_macro_escape(attrs2.as_slice()),false);
fn fold_ident(&mut self, _: ast::Ident) -> ast::Ident {
token::str_to_ident("zz")
}
- fn fold_mac(&mut self, macro: &ast::Mac) -> ast::Mac {
+ fn fold_mac(&mut self, macro: ast::Mac) -> ast::Mac {
fold::noop_fold_mac(macro, self)
}
}
mod test {
use super::*;
use serialize::json;
- use std::gc::GC;
use codemap::{Span, BytePos, Spanned};
use owned_slice::OwnedSlice;
use ast;
use attr::AttrMetaMethods;
use parse::parser::Parser;
use parse::token::{str_to_ident};
+ use ptr::P;
use util::parser_testing::{string_to_tts, string_to_parser};
use util::parser_testing::{string_to_expr, string_to_item};
use util::parser_testing::string_to_stmt;
P(ast::Item{ident:str_to_ident("a"),
attrs:Vec::new(),
id: ast::DUMMY_NODE_ID,
- node: ast::ItemFn(ast::P(ast::FnDecl {
+ node: ast::ItemFn(P(ast::FnDecl {
inputs: vec!(ast::Arg{
- ty: ast::P(ast::Ty{id: ast::DUMMY_NODE_ID,
- node: ast::TyPath(ast::Path{
+ ty: P(ast::Ty{id: ast::DUMMY_NODE_ID,
+ node: ast::TyPath(ast::Path{
span:sp(10,13),
global:false,
segments: vec!(
}),
id: ast::DUMMY_NODE_ID
}),
- output: ast::P(ast::Ty{id: ast::DUMMY_NODE_ID,
- node: ast::TyNil,
- span:sp(15,15)}), // not sure
+ output: P(ast::Ty{id: ast::DUMMY_NODE_ID,
+ node: ast::TyNil,
+ span:sp(15,15)}), // not sure
cf: ast::Return,
variadic: false
}),
predicates: Vec::new(),
}
},
- ast::P(ast::Block {
+ P(ast::Block {
view_items: Vec::new(),
stmts: vec!(P(Spanned{
node: ast::StmtSemi(P(ast::Expr{
use ast_util;
use codemap;
use parse::token;
+ use ptr::P;
#[test]
fn test_fun_to_string() {
let decl = ast::FnDecl {
inputs: Vec::new(),
- output: ast::P(ast::Ty {id: 0,
- node: ast::TyNil,
- span: codemap::DUMMY_SP}),
+ output: P(ast::Ty {id: 0,
+ node: ast::TyNil,
+ span: codemap::DUMMY_SP}),
cf: ast::Return,
variadic: false
};
// except according to those terms.
use ast;
-use ast::P;
use parse::{new_parse_sess};
use parse::{ParseSess,string_to_filemap,filemap_to_tts};
use parse::{new_parser_from_source_str};
use parse::parser::Parser;
use parse::token;
-
-use std::gc::Gc;
+use ptr::P;
/// Map a string to tts, using a made-up filename:
pub fn string_to_tts(source_str: String) -> Vec<ast::TokenTree> {