Box AST idents

This commit is contained in:
Brian Anderson 2012-06-10 00:49:59 -07:00
parent bdd2000066
commit ce750a7dbc
74 changed files with 629 additions and 603 deletions

View file

@ -30,11 +30,11 @@ fn inject_libcore_ref(sess: session,
let n1 = sess.next_node_id();
let n2 = sess.next_node_id();
let vi1 = @{node: ast::view_item_use("core", [], n1),
let vi1 = @{node: ast::view_item_use(@"core", [], n1),
attrs: [],
vis: ast::public,
span: dummy_sp()};
let vp = spanned(ast::view_path_glob(ident_to_path(dummy_sp(), "core"),
let vp = spanned(ast::view_path_glob(ident_to_path(dummy_sp(), @"core"),
n2));
let vi2 = @{node: ast::view_item_import([vp]),
attrs: [],

View file

@ -70,7 +70,7 @@ fn fold_mod(_cx: test_ctxt, m: ast::_mod, fld: fold::ast_fold) -> ast::_mod {
fn nomain(&&item: @ast::item) -> option<@ast::item> {
alt item.node {
ast::item_fn(_, _, _) {
if item.ident == "main" {
if *item.ident == "main" {
option::none
} else { option::some(item) }
}
@ -190,9 +190,9 @@ fn mk_test_module(cx: test_ctxt) -> @ast::item {
let item_ = ast::item_mod(testmod);
// This attribute tells resolve to let us call unexported functions
let resolve_unexported_attr =
attr::mk_attr(attr::mk_word_item("!resolve_unexported"));
attr::mk_attr(attr::mk_word_item(@"!resolve_unexported"));
let item: ast::item =
{ident: "__test",
{ident: @"__test",
attrs: [resolve_unexported_attr],
id: cx.sess.next_node_id(),
node: item_,
@ -231,7 +231,7 @@ fn mk_tests(cx: test_ctxt) -> @ast::item {
let item_ = ast::item_fn(decl, [], body);
let item: ast::item =
{ident: "tests",
{ident: @"tests",
attrs: [],
id: cx.sess.next_node_id(),
node: item_,
@ -246,16 +246,16 @@ fn mk_path(cx: test_ctxt, path: [ast::ident]) -> [ast::ident] {
let is_std = {
let items = attr::find_linkage_metas(cx.crate.node.attrs);
alt attr::last_meta_item_value_str_by_name(items, "name") {
some("std") { true }
some(@"std") { true }
_ { false }
}
};
(if is_std { [] } else { ["std"] }) + path
(if is_std { [] } else { [@"std"] }) + path
}
// The ast::ty of [std::test::test_desc]
fn mk_test_desc_vec_ty(cx: test_ctxt) -> @ast::ty {
let test_desc_ty_path = path_node(mk_path(cx, ["test", "test_desc"]));
let test_desc_ty_path = path_node(mk_path(cx, [@"test", @"test_desc"]));
let test_desc_ty: ast::ty =
{id: cx.sess.next_node_id(),
@ -288,14 +288,14 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr {
#debug("encoding %s", ast_util::path_name_i(path));
let name_lit: ast::lit =
nospan(ast::lit_str(ast_util::path_name_i(path)));
nospan(ast::lit_str(@ast_util::path_name_i(path)));
let name_expr: ast::expr =
{id: cx.sess.next_node_id(),
node: ast::expr_lit(@name_lit),
span: span};
let name_field: ast::field =
nospan({mutbl: ast::m_imm, ident: "name", expr: @name_expr});
nospan({mutbl: ast::m_imm, ident: @"name", expr: @name_expr});
let fn_path = path_node(path);
@ -307,7 +307,7 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr {
let fn_wrapper_expr = mk_test_wrapper(cx, fn_expr, span);
let fn_field: ast::field =
nospan({mutbl: ast::m_imm, ident: "fn", expr: fn_wrapper_expr});
nospan({mutbl: ast::m_imm, ident: @"fn", expr: fn_wrapper_expr});
let ignore_lit: ast::lit = nospan(ast::lit_bool(test.ignore));
@ -317,7 +317,7 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr {
span: span};
let ignore_field: ast::field =
nospan({mutbl: ast::m_imm, ident: "ignore", expr: @ignore_expr});
nospan({mutbl: ast::m_imm, ident: @"ignore", expr: @ignore_expr});
let fail_lit: ast::lit = nospan(ast::lit_bool(test.should_fail));
@ -327,7 +327,7 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr {
span: span};
let fail_field: ast::field =
nospan({mutbl: ast::m_imm, ident: "should_fail", expr: @fail_expr});
nospan({mutbl: ast::m_imm, ident: @"should_fail", expr: @fail_expr});
let desc_rec_: ast::expr_ =
ast::expr_rec([name_field, fn_field, ignore_field, fail_field],
@ -379,7 +379,7 @@ fn mk_test_wrapper(cx: test_ctxt,
}
fn mk_main(cx: test_ctxt) -> @ast::item {
let str_pt = path_node(["str"]);
let str_pt = path_node([@"str"]);
let str_ty = @{id: cx.sess.next_node_id(),
node: ast::ty_path(str_pt, cx.sess.next_node_id()),
span: dummy_sp()};
@ -391,7 +391,7 @@ fn mk_main(cx: test_ctxt) -> @ast::item {
let args_arg: ast::arg =
{mode: ast::expl(ast::by_val),
ty: @args_ty,
ident: "args",
ident: @"args",
id: cx.sess.next_node_id()};
let ret_ty = {id: cx.sess.next_node_id(),
@ -414,7 +414,7 @@ fn mk_main(cx: test_ctxt) -> @ast::item {
let item_ = ast::item_fn(decl, [], body);
let item: ast::item =
{ident: "main",
{ident: @"main",
attrs: [],
id: cx.sess.next_node_id(),
node: item_,
@ -426,7 +426,7 @@ fn mk_main(cx: test_ctxt) -> @ast::item {
fn mk_test_main_call(cx: test_ctxt) -> @ast::expr {
// Get the args passed to main so we can pass the to test_main
let args_path = path_node(["args"]);
let args_path = path_node([@"args"]);
let args_path_expr_: ast::expr_ = ast::expr_path(args_path);
@ -434,7 +434,7 @@ fn mk_test_main_call(cx: test_ctxt) -> @ast::expr {
{id: cx.sess.next_node_id(), node: args_path_expr_, span: dummy_sp()};
// Call __test::test to generate the vector of test_descs
let test_path = path_node(["tests"]);
let test_path = path_node([@"tests"]);
let test_path_expr_: ast::expr_ = ast::expr_path(test_path);
@ -447,7 +447,7 @@ fn mk_test_main_call(cx: test_ctxt) -> @ast::expr {
{id: cx.sess.next_node_id(), node: test_call_expr_, span: dummy_sp()};
// Call std::test::test_main
let test_main_path = path_node(mk_path(cx, ["test", "test_main"]));
let test_main_path = path_node(mk_path(cx, [@"test", @"test_main"]));
let test_main_path_expr_: ast::expr_ = ast::expr_path(test_main_path);