diff options
| author | Marijn Haverbeke <marijnh@gmail.com> | 2011-11-30 13:38:38 +0100 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2011-11-30 13:38:38 +0100 |
| commit | b40c6773c2f1a5a34990004cbe9b29a7575e2f7e (patch) | |
| tree | e806179dd1c8f102bbc44d7268e3e855f7b97333 | |
| parent | 586a685eecd7786679e93cf0040a0558f47877da (diff) | |
| download | rust-b40c6773c2f1a5a34990004cbe9b29a7575e2f7e.tar.gz rust-b40c6773c2f1a5a34990004cbe9b29a7575e2f7e.zip | |
Box ast::path values
It seems inefficient to copy them around. Let's measure whether that's actually > the case
| -rw-r--r-- | src/comp/front/test.rs | 28 | ||||
| -rw-r--r-- | src/comp/metadata/tydecode.rs | 14 | ||||
| -rw-r--r-- | src/comp/middle/alias.rs | 7 | ||||
| -rw-r--r-- | src/comp/middle/resolve.rs | 12 | ||||
| -rw-r--r-- | src/comp/middle/trans.rs | 2 | ||||
| -rw-r--r-- | src/comp/middle/tstate/auxiliary.rs | 6 | ||||
| -rw-r--r-- | src/comp/middle/tstate/pre_post_conditions.rs | 2 | ||||
| -rw-r--r-- | src/comp/middle/tstate/states.rs | 2 | ||||
| -rw-r--r-- | src/comp/middle/ty.rs | 2 | ||||
| -rw-r--r-- | src/comp/middle/typeck.rs | 7 | ||||
| -rw-r--r-- | src/comp/syntax/ast.rs | 22 | ||||
| -rw-r--r-- | src/comp/syntax/ast_util.rs | 2 | ||||
| -rw-r--r-- | src/comp/syntax/ext/concat_idents.rs | 6 | ||||
| -rw-r--r-- | src/comp/syntax/ext/fmt.rs | 2 | ||||
| -rw-r--r-- | src/comp/syntax/ext/simplext.rs | 14 | ||||
| -rw-r--r-- | src/comp/syntax/fold.rs | 8 | ||||
| -rw-r--r-- | src/comp/syntax/parse/parser.rs | 33 | ||||
| -rw-r--r-- | src/comp/syntax/print/pprust.rs | 18 | ||||
| -rw-r--r-- | src/comp/syntax/visit.rs | 14 | ||||
| -rw-r--r-- | src/comp/util/ppaux.rs | 4 |
20 files changed, 102 insertions, 103 deletions
diff --git a/src/comp/front/test.rs b/src/comp/front/test.rs index d704045c990..e520e68b93b 100644 --- a/src/comp/front/test.rs +++ b/src/comp/front/test.rs @@ -235,17 +235,17 @@ fn mk_tests(cx: test_ctxt) -> @ast::item { fn mk_test_desc_vec_ty(cx: test_ctxt) -> @ast::ty { let test_fn_ty: ast::ty = nospan( ast::ty_path( - nospan({ + @nospan({ global: false, idents: ["std", "test", "default_test_fn"], types: [] }), cx.next_node_id())); - let test_desc_ty_path: ast::path = - nospan({global: false, - idents: ["std", "test", "test_desc"], - types: [@test_fn_ty]}); + let test_desc_ty_path = + @nospan({global: false, + idents: ["std", "test", "test_desc"], + types: [@test_fn_ty]}); let test_desc_ty: ast::ty = nospan(ast::ty_path(test_desc_ty_path, cx.next_node_id())); @@ -284,7 +284,7 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr { let name_field: ast::field = nospan({mut: ast::imm, ident: "name", expr: @name_expr}); - let fn_path: ast::path = nospan({global: false, idents: path, types: []}); + let fn_path = @nospan({global: false, idents: path, types: []}); let fn_expr: ast::expr = {id: cx.next_node_id(), @@ -414,8 +414,8 @@ 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: ast::path = - nospan({global: false, idents: ["args"], types: []}); + let args_path = + @nospan({global: false, idents: ["args"], types: []}); let args_path_expr_: ast::expr_ = ast::expr_path(args_path); @@ -423,8 +423,8 @@ fn mk_test_main_call(cx: test_ctxt) -> @ast::expr { {id: cx.next_node_id(), node: args_path_expr_, span: dummy_sp()}; // Call __test::test to generate the vector of test_descs - let test_path: ast::path = - nospan({global: false, idents: ["tests"], types: []}); + let test_path = + @nospan({global: false, idents: ["tests"], types: []}); let test_path_expr_: ast::expr_ = ast::expr_path(test_path); @@ -437,10 +437,10 @@ fn mk_test_main_call(cx: test_ctxt) -> @ast::expr { {id: cx.next_node_id(), node: test_call_expr_, span: dummy_sp()}; // Call std::test::test_main - let test_main_path: ast::path = - nospan({global: false, - idents: ["std", "test", "test_main"], - types: []}); + let test_main_path = + @nospan({global: false, + idents: ["std", "test", "test_main"], + types: []}); let test_main_path_expr_: ast::expr_ = ast::expr_path(test_main_path); diff --git a/src/comp/metadata/tydecode.rs b/src/comp/metadata/tydecode.rs index 70e87824ad0..40f5fc64c7b 100644 --- a/src/comp/metadata/tydecode.rs +++ b/src/comp/metadata/tydecode.rs @@ -83,7 +83,7 @@ fn parse_ty_constrs(st: @pstate, sd: str_def) -> [@ty::type_constr] { do { next(st); let one: @ty::type_constr = - parse_constr::<path>(st, sd, parse_ty_constr_arg); + parse_constr::<@path>(st, sd, parse_ty_constr_arg); rslt += [one]; } while peek(st) as char == ';' } @@ -92,7 +92,7 @@ fn parse_ty_constrs(st: @pstate, sd: str_def) -> [@ty::type_constr] { ret rslt; } -fn parse_path(st: @pstate, sd: str_def) -> ast::path { +fn parse_path(st: @pstate, sd: str_def) -> @ast::path { let idents: [ast::ident] = []; fn is_last(c: char) -> bool { ret c == '(' || c == ':'; } idents += [parse_ident_(st, sd, is_last)]; @@ -101,8 +101,8 @@ fn parse_path(st: @pstate, sd: str_def) -> ast::path { ':' { next(st); next(st); } c { if c == '(' { - ret respan(ast_util::dummy_sp(), - {global: false, idents: idents, types: []}); + ret @respan(ast_util::dummy_sp(), + {global: false, idents: idents, types: []}); } else { idents += [parse_ident_(st, sd, is_last)]; } } } @@ -138,7 +138,7 @@ fn parse_constr_arg(st: @pstate, _sd: str_def) -> ast::fn_constr_arg { } fn parse_ty_constr_arg(st: @pstate, sd: str_def) -> - ast::constr_arg_general_<path> { + ast::constr_arg_general_<@path> { alt peek(st) as char { '*' { st.pos += 1u; ret ast::carg_base; } c { ret ast::carg_ident(parse_path(st, sd)); } @@ -149,9 +149,9 @@ fn parse_constr<copy T>(st: @pstate, sd: str_def, pser: arg_parser<T>) -> @ty::constr_general<T> { let sp = ast_util::dummy_sp(); // FIXME: use a real span let args: [@sp_constr_arg<T>] = []; - let pth: path = parse_path(st, sd); + let pth = parse_path(st, sd); let ignore: char = next(st) as char; - assert (ignore as char == '('); + assert (ignore == '('); let def = parse_def(st, sd); let an_arg: constr_arg_general_<T>; do { diff --git a/src/comp/middle/alias.rs b/src/comp/middle/alias.rs index e3353e3d483..5cd05a833f4 100644 --- a/src/comp/middle/alias.rs +++ b/src/comp/middle/alias.rs @@ -16,8 +16,7 @@ tag copied { not_allowed; copied; not_copied; } tag invalid_reason { overwritten; val_taken; } type invalid = {reason: invalid_reason, node_id: node_id, - sp: span, path: - ast::path}; + sp: span, path: @ast::path}; tag unsafe_ty { contains(ty::t); mut_contains(ty::t); } @@ -374,7 +373,7 @@ fn check_for(cx: ctx, local: @ast::local, seq: @ast::expr, blk: ast::blk, visit::visit_block(blk, {bs: new_bs with sc}, v); } -fn check_var(cx: ctx, ex: @ast::expr, p: ast::path, id: ast::node_id, +fn check_var(cx: ctx, ex: @ast::expr, p: @ast::path, id: ast::node_id, assign: bool, sc: scope) { let def = cx.tcx.def_map.get(id); if !def_is_local(def, false) { ret; } @@ -445,7 +444,7 @@ fn check_loop(cx: ctx, sc: scope, checker: block()) { *sc.invalid = new_invalid; } -fn test_scope(cx: ctx, sc: scope, b: binding, p: ast::path) { +fn test_scope(cx: ctx, sc: scope, b: binding, p: @ast::path) { let prob = find_invalid(b.node_id, *sc.invalid); alt b.root_var { some(dn) { diff --git a/src/comp/middle/resolve.rs b/src/comp/middle/resolve.rs index 94d76e46d6c..1807085ffc4 100644 --- a/src/comp/middle/resolve.rs +++ b/src/comp/middle/resolve.rs @@ -44,7 +44,7 @@ tag scope { type scopes = list<scope>; tag import_state { - todo(ast::node_id, ast::ident, [ast::ident], codemap::span, scopes); + todo(ast::node_id, ast::ident, @[ast::ident], codemap::span, scopes); resolving(span); resolved(option::t<def>, /* value */ option::t<def>, /* type */ @@ -172,7 +172,7 @@ fn map_crate(e: @env, c: @ast::crate) { for ident in idents { e.imports.insert(ident.node.id, todo(ident.node.id, ident.node.name, - mod_path + [ident.node.name], + @(*mod_path + [ident.node.name]), ident.span, sc)); } } @@ -214,7 +214,7 @@ fn map_crate(e: @env, c: @ast::crate) { alt vi.node { //if it really is a glob import, that is ast::view_item_import_glob(path, _) { - let imp = follow_import(*e, sc, path, vi.span); + let imp = follow_import(*e, sc, *path, vi.span); if option::is_some(imp) { let glob = {def: option::get(imp), item: vi};; alt list::head(sc) { @@ -243,7 +243,7 @@ fn resolve_imports(e: env) { e.imports.values {|v| alt v { todo(node_id, name, path, span, scopes) { - resolve_import(e, local_def(node_id), name, path, span, scopes); + resolve_import(e, local_def(node_id), name, *path, span, scopes); } resolved(_, _, _, _, _) { } } @@ -304,7 +304,7 @@ fn resolve_names(e: @env, c: @ast::crate) { _ { } } } - fn walk_constr(e: @env, p: ast::path, sp: span, id: node_id, sc: scopes, + fn walk_constr(e: @env, p: @ast::path, sp: span, id: node_id, sc: scopes, _v: vt<scopes>) { maybe_insert(e, id, lookup_path_strict(*e, sc, sp, p.node, ns_value)); } @@ -966,7 +966,7 @@ fn found_view_item(e: env, vi: @ast::view_item) -> option::t<def> { fn lookup_import(e: env, defid: def_id, ns: namespace) -> option::t<def> { alt e.imports.get(defid.node) { todo(node_id, name, path, span, scopes) { - resolve_import(e, local_def(node_id), name, path, span, scopes); + resolve_import(e, local_def(node_id), name, *path, span, scopes); ret lookup_import(e, defid, ns); } resolving(sp) { diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 2d8ad55b284..237b0089953 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -2967,7 +2967,7 @@ fn trans_local_var(cx: @block_ctxt, def: ast::def) -> lval_result { } } -fn trans_path(cx: @block_ctxt, p: ast::path, id: ast::node_id) +fn trans_path(cx: @block_ctxt, p: @ast::path, id: ast::node_id) -> lval_maybe_callee { ret trans_var(cx, p.span, bcx_tcx(cx).def_map.get(id), id); } diff --git a/src/comp/middle/tstate/auxiliary.rs b/src/comp/middle/tstate/auxiliary.rs index e7c17665628..b910dce220f 100644 --- a/src/comp/middle/tstate/auxiliary.rs +++ b/src/comp/middle/tstate/auxiliary.rs @@ -194,7 +194,7 @@ tag constraint { // FIXME: really only want it to be mutable during collect_locals. // freeze it after that. - cpred(path, @mutable [pred_args]); + cpred(@path, @mutable [pred_args]); } // An ninit variant has a node_id because it refers to a local var. @@ -204,7 +204,7 @@ tag constraint { // and give ninit a constraint saying it's local. tag tsconstr { ninit(node_id, ident); - npred(path, def_id, [@constr_arg_use]); + npred(@path, def_id, [@constr_arg_use]); } type sp_constr = spanned<tsconstr>; @@ -773,7 +773,7 @@ fn replace(subst: subst, d: pred_args) -> [constr_arg_general_<inst>] { ret rslt; } -fn path_to_ident(cx: ty::ctxt, p: path) -> ident { +fn path_to_ident(cx: ty::ctxt, p: @path) -> ident { alt vec::last(p.node.idents) { none. { cx.sess.span_fatal(p.span, "Malformed path"); } some(i) { ret i; } diff --git a/src/comp/middle/tstate/pre_post_conditions.rs b/src/comp/middle/tstate/pre_post_conditions.rs index 1da6346f739..d0ac63704d7 100644 --- a/src/comp/middle/tstate/pre_post_conditions.rs +++ b/src/comp/middle/tstate/pre_post_conditions.rs @@ -191,7 +191,7 @@ fn join_then_else(fcx: fn_ctxt, antec: @expr, conseq: blk, } fn gen_if_local(fcx: fn_ctxt, lhs: @expr, rhs: @expr, larger_id: node_id, - new_var: node_id, pth: path) { + new_var: node_id, pth: @path) { alt node_id_to_def(fcx.ccx, new_var) { some(d) { alt d { diff --git a/src/comp/middle/tstate/states.rs b/src/comp/middle/tstate/states.rs index 598a49a8762..ed84520a6b9 100644 --- a/src/comp/middle/tstate/states.rs +++ b/src/comp/middle/tstate/states.rs @@ -27,7 +27,7 @@ fn forbid_upvar(fcx: fn_ctxt, rhs_id: node_id, sp: span, t: oper_type) { } } -fn handle_move_or_copy(fcx: fn_ctxt, post: poststate, rhs_path: path, +fn handle_move_or_copy(fcx: fn_ctxt, post: poststate, rhs_path: @path, rhs_id: node_id, instlhs: inst, init_op: init_op) { forbid_upvar(fcx, rhs_id, rhs_path.span, op_to_oper_ty(init_op)); diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs index 33d261dc83f..5a290f7efc6 100644 --- a/src/comp/middle/ty.rs +++ b/src/comp/middle/ty.rs @@ -274,7 +274,7 @@ tag sty { // In the middle end, constraints have a def_id attached, referring // to the definition of the operator in the constraint. type constr_general<ARG> = spanned<constr_general_<ARG, def_id>>; -type type_constr = constr_general<path>; +type type_constr = constr_general<@path>; type constr = constr_general<uint>; // Data structures used in type unification diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index 64bce9da750..fc0a4de5245 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -130,8 +130,9 @@ fn ty_param_kinds_and_ty_for_def(fcx: @fn_ctxt, sp: span, defn: ast::def) -> // Instantiates the given path, which must refer to an item with the given // number of type parameters and type. -fn instantiate_path(fcx: @fn_ctxt, pth: ast::path, tpt: ty_param_kinds_and_ty, - sp: span) -> ty_param_substs_opt_and_ty { +fn instantiate_path(fcx: @fn_ctxt, pth: @ast::path, + tpt: ty_param_kinds_and_ty, sp: span) + -> ty_param_substs_opt_and_ty { let ty_param_count = vec::len(tpt.kinds); let bind_result = bind_params_in_type(sp, fcx.ccx.tcx, bind next_ty_var_id(fcx), tpt.ty, @@ -2586,7 +2587,7 @@ fn check_constraints(fcx: @fn_ctxt, cs: [@ast::constr], args: [ast::arg]) { ast::def_arg(local_def(args[i].id), args[i].mode)); {id: arg_occ_node_id, - node: ast::expr_path(respan(a.span, p)), + node: ast::expr_path(@respan(a.span, p)), span: a.span} } else { fcx.ccx.tcx.sess.span_bug(a.span, diff --git a/src/comp/syntax/ast.rs b/src/comp/syntax/ast.rs index 47e254aa011..9c7b9ef422d 100644 --- a/src/comp/syntax/ast.rs +++ b/src/comp/syntax/ast.rs @@ -61,7 +61,7 @@ tag crate_directive_ { cdir_src_mod(ident, [attribute]); cdir_dir_mod(ident, [@crate_directive], [attribute]); cdir_view_item(@view_item); - cdir_syntax(path); + cdir_syntax(@path); } type crate_directive = spanned<crate_directive_>; @@ -87,7 +87,7 @@ tag pat_ { pat_wild; pat_bind(ident); pat_lit(@lit); - pat_tag(path, [@pat]); + pat_tag(@path, [@pat]); pat_rec([field_pat], bool); pat_tup([@pat]); pat_box(@pat); @@ -208,7 +208,7 @@ tag expr_ { expr_assign_op(binop, @expr, @expr); expr_field(@expr, ident); expr_index(@expr, @expr); - expr_path(path); + expr_path(@path); expr_fail(option::t<@expr>); expr_break; expr_cont; @@ -241,7 +241,7 @@ tag blk_sort { type mac = spanned<mac_>; tag mac_ { - mac_invoc(path, @expr, option::t<str>); + mac_invoc(@path, @expr, option::t<str>); mac_embed_type(@ty); mac_embed_block(blk); mac_ellipsis; @@ -328,7 +328,7 @@ tag ty_ { ty_fn(proto, [ty_arg], @ty, ret_style, [@constr]); ty_obj([ty_method]); ty_tup([@ty]); - ty_path(path, node_id); + ty_path(@path, node_id); ty_type; ty_constr(@ty, [@ty_constr]); ty_mac(mac); @@ -352,7 +352,7 @@ tag constr_arg_general_<T> { carg_base; carg_ident(T); carg_lit(@lit); } type fn_constr_arg = constr_arg_general_<uint>; type sp_constr_arg<T> = spanned<constr_arg_general_<T>>; -type ty_constr_arg = sp_constr_arg<path>; +type ty_constr_arg = sp_constr_arg<@path>; type constr_arg = spanned<fn_constr_arg>; // Constrained types' args are parameterized by paths, since @@ -361,14 +361,14 @@ type constr_arg = spanned<fn_constr_arg>; // constrained type, is * (referring to the base record) type constr_general_<ARG, ID> = - {path: path, args: [@spanned<constr_arg_general_<ARG>>], id: ID}; + {path: @path, args: [@spanned<constr_arg_general_<ARG>>], id: ID}; // In the front end, constraints have a node ID attached. // Typeck turns this to a def_id, using the output of resolve. type constr_general<ARG> = spanned<constr_general_<ARG, node_id>>; type constr_ = constr_general_<uint, node_id>; type constr = spanned<constr_general_<uint, node_id>>; -type ty_constr_ = ast::constr_general_<ast::path, ast::node_id>; +type ty_constr_ = constr_general_<@path, node_id>; type ty_constr = spanned<ty_constr_>; /* The parser generates ast::constrs; resolve generates @@ -447,9 +447,9 @@ type import_ident = spanned<import_ident_>; tag view_item_ { view_item_use(ident, [@meta_item], node_id); - view_item_import(ident, simple_path, node_id); - view_item_import_glob(simple_path, node_id); - view_item_import_from(simple_path, [import_ident], node_id); + view_item_import(ident, @simple_path, node_id); + view_item_import_glob(@simple_path, node_id); + view_item_import_from(@simple_path, [import_ident], node_id); view_item_export([ident], node_id); } diff --git a/src/comp/syntax/ast_util.rs b/src/comp/syntax/ast_util.rs index 2b574ae1cbe..da7b5a44953 100644 --- a/src/comp/syntax/ast_util.rs +++ b/src/comp/syntax/ast_util.rs @@ -14,7 +14,7 @@ fn mk_sp(lo: uint, hi: uint) -> span { // make this a const, once the compiler supports it fn dummy_sp() -> span { ret mk_sp(0u, 0u); } -fn path_name(p: path) -> str { path_name_i(p.node.idents) } +fn path_name(p: @path) -> str { path_name_i(p.node.idents) } fn path_name_i(idents: [ident]) -> str { str::connect(idents, "::") } diff --git a/src/comp/syntax/ext/concat_idents.rs b/src/comp/syntax/ext/concat_idents.rs index b2f019f233d..711a180c9a0 100644 --- a/src/comp/syntax/ext/concat_idents.rs +++ b/src/comp/syntax/ext/concat_idents.rs @@ -17,8 +17,8 @@ fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: @ast::expr, } ret @{id: cx.next_id(), - node: - ast::expr_path({node: {global: false, idents: [res], types: []}, - span: sp}), + node: ast::expr_path(@{node: {global: false, idents: [res], + types: []}, + span: sp}), span: sp}; } diff --git a/src/comp/syntax/ext/fmt.rs b/src/comp/syntax/ext/fmt.rs index 0aabf648a08..1aac14c9668 100644 --- a/src/comp/syntax/ext/fmt.rs +++ b/src/comp/syntax/ext/fmt.rs @@ -67,7 +67,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, pieces: [piece], args: [@ast::expr]) fn make_path_expr(cx: ext_ctxt, sp: span, idents: [ast::ident]) -> @ast::expr { let path = {global: false, idents: idents, types: []}; - let sp_path = {node: path, span: sp}; + let sp_path = @{node: path, span: sp}; let pathexpr = ast::expr_path(sp_path); ret @{id: cx.next_id(), node: pathexpr, span: sp}; } diff --git a/src/comp/syntax/ext/simplext.rs b/src/comp/syntax/ext/simplext.rs index dd66c1bef92..96d214584e7 100644 --- a/src/comp/syntax/ext/simplext.rs +++ b/src/comp/syntax/ext/simplext.rs @@ -14,7 +14,7 @@ import ast::{ident, path, ty, blk_, expr, path_, expr_path, export add_new_extension; -fn path_to_ident(pth: path) -> option::t<ident> { +fn path_to_ident(pth: @path) -> option::t<ident> { if vec::len(pth.node.idents) == 1u && vec::len(pth.node.types) == 0u { ret some(pth.node.idents[0u]); } @@ -30,7 +30,7 @@ tag arb_depth<T> { leaf(T); seq(@[arb_depth<T>], span); } tag matchable { match_expr(@expr); - match_path(path); + match_path(@path); match_ident(ast::spanned<ident>); match_ty(@ty); match_block(ast::blk); @@ -360,10 +360,10 @@ fn transcribe_expr(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint], } alt follow_for_trans(cx, b.find(p.node.idents[0]), idx_path) { some(match_ident(id)) { - expr_path(respan(id.span, - {global: false, - idents: [id.node], - types: []})) + expr_path(@respan(id.span, + {global: false, + idents: [id.node], + types: []})) } some(match_path(a_pth)) { expr_path(a_pth) } some(match_expr(a_exp)) { a_exp.node } @@ -502,7 +502,7 @@ fn specialize_match(m: matchable) -> matchable { } /* pattern_to_selectors helper functions */ -fn p_t_s_r_path(cx: ext_ctxt, p: path, s: selector, b: binders) { +fn p_t_s_r_path(cx: ext_ctxt, p: @path, s: selector, b: binders) { alt path_to_ident(p) { some(p_id) { fn select(cx: ext_ctxt, m: matchable) -> match_result { diff --git a/src/comp/syntax/fold.rs b/src/comp/syntax/fold.rs index 78340593f68..4f26667800b 100644 --- a/src/comp/syntax/fold.rs +++ b/src/comp/syntax/fold.rs @@ -67,7 +67,7 @@ type a_f = fold_native_mod: fn@(native_mod) -> native_mod, fold_variant: fn@(variant) -> variant, fold_ident: fn@(&&ident) -> ident, - fold_path: fn@(path) -> path, + fold_path: fn@(@path) -> @path, fold_local: fn@(&&@local) -> @local, map_exprs: fn@(fn@(&&@expr) -> @expr, [@expr]) -> [@expr], new_id: fn@(node_id) -> node_id, @@ -97,7 +97,7 @@ fn nf_mod_dummy(_m: _mod) -> _mod { fail; } fn nf_native_mod_dummy(_n: native_mod) -> native_mod { fail; } fn nf_variant_dummy(_v: variant) -> variant { fail; } fn nf_ident_dummy(&&_i: ident) -> ident { fail; } -fn nf_path_dummy(_p: path) -> path { fail; } +fn nf_path_dummy(_p: @path) -> @path { fail; } fn nf_obj_field_dummy(_o: obj_field) -> obj_field { fail; } fn nf_local_dummy(&&_o: @local) -> @local { fail; } @@ -630,8 +630,8 @@ fn make_fold(afp: ast_fold_precursor) -> ast_fold { fn f_ident(afp: ast_fold_precursor, f: ast_fold, &&x: ident) -> ident { ret afp.fold_ident(x, f); } - fn f_path(afp: ast_fold_precursor, f: ast_fold, x: path) -> path { - ret {node: afp.fold_path(x.node, f), span: afp.new_span(x.span)}; + fn f_path(afp: ast_fold_precursor, f: ast_fold, x: @path) -> @path { + ret @{node: afp.fold_path(x.node, f), span: afp.new_span(x.span)}; } fn f_local(afp: ast_fold_precursor, f: ast_fold, &&x: @local) -> @local { ret @{node: afp.fold_local(x.node, f), span: afp.new_span(x.span)}; diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index a8f294820af..6d751dff645 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -354,7 +354,7 @@ fn parse_type_constr_arg(p: parser) -> @ast::ty_constr_arg { if p.peek() == token::DOT { // "*..." notation for record fields p.bump(); - let pth: ast::path = parse_path(p); + let pth = parse_path(p); carg = ast::carg_ident(pth); } // No literals yet, I guess? @@ -430,10 +430,10 @@ fn parse_ty_postfix(orig_t: ast::ty_, p: parser, colons_before_params: bool) ast::ty_path(pth, ann) { let hi = p.get_hi_pos(); ret @spanned(lo, hi, - ast::ty_path(spanned(lo, hi, - {global: pth.node.global, - idents: pth.node.idents, - types: seq}), ann)); + ast::ty_path(@spanned(lo, hi, + {global: pth.node.global, + idents: pth.node.idents, + types: seq}), ann)); } _ { p.fatal("type parameter instantiation only allowed for paths"); } } @@ -697,7 +697,7 @@ fn is_plain_ident(p: parser) -> bool { ret alt p.peek() { token::IDENT(_, false) { true } _ { false } }; } -fn parse_path(p: parser) -> ast::path { +fn parse_path(p: parser) -> @ast::path { let lo = p.get_lo_pos(); let hi = lo; @@ -722,10 +722,10 @@ fn parse_path(p: parser) -> ast::path { _ { break; } } } - ret spanned(lo, hi, {global: global, idents: ids, types: []}); + ret @spanned(lo, hi, {global: global, idents: ids, types: []}); } -fn parse_path_and_ty_param_substs(p: parser) -> ast::path { +fn parse_path_and_ty_param_substs(p: parser) -> @ast::path { let lo = p.get_lo_pos(); let path = parse_path(p); if p.peek() == token::MOD_SEP { @@ -734,11 +734,10 @@ fn parse_path_and_ty_param_substs(p: parser) -> ast::path { let seq = parse_seq_lt_gt(some(token::COMMA), {|p| parse_ty(p, false)}, p); let hi = seq.span.hi; - path = - spanned(lo, hi, - {global: path.node.global, - idents: path.node.idents, - types: seq.node}); + path = @spanned(lo, hi, + {global: path.node.global, + idents: path.node.idents, + types: seq.node}); } ret path; } @@ -2331,18 +2330,18 @@ fn parse_rest_import_name(p: parser, first: ast::ident, if option::is_some(from_idents) { p.fatal("can't rename import list"); } - ret ast::view_item_import(i, identifiers, p.get_id()); + ret ast::view_item_import(i, @identifiers, p.get_id()); } _ { if glob { - ret ast::view_item_import_glob(identifiers, p.get_id()); + ret ast::view_item_import_glob(@identifiers, p.get_id()); } else if option::is_some(from_idents) { - ret ast::view_item_import_from(identifiers, + ret ast::view_item_import_from(@identifiers, option::get(from_idents), p.get_id()); } else { let len = vec::len(identifiers); - ret ast::view_item_import(identifiers[len - 1u], identifiers, + ret ast::view_item_import(identifiers[len - 1u], @identifiers, p.get_id()); } } diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index 6f346f176ef..9cd20cc87af 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -86,7 +86,7 @@ fn stmt_to_str(s: ast::stmt) -> str { be to_str(s, print_stmt); } fn item_to_str(i: @ast::item) -> str { be to_str(i, print_item); } -fn path_to_str(p: ast::path) -> str { +fn path_to_str(&&p: @ast::path) -> str { be to_str(p, bind print_path(_, _, false)); } @@ -1038,7 +1038,7 @@ fn print_for_decl(s: ps, loc: @ast::local, coll: @ast::expr) { print_expr(s, coll); } -fn print_path(s: ps, path: ast::path, colons_before_params: bool) { +fn print_path(s: ps, &&path: @ast::path, colons_before_params: bool) { maybe_print_comment(s, path.span.lo); if path.node.global { word(s.s, "::"); } let first = true; @@ -1213,19 +1213,19 @@ fn print_view_item(s: ps, item: @ast::view_item) { } ast::view_item_import(id, ids, _) { head(s, "import"); - if !str::eq(id, ids[vec::len(ids) - 1u]) { + if !str::eq(id, ids[vec::len(*ids) - 1u]) { word_space(s, id); word_space(s, "="); } let first = true; - for elt: ast::ident in ids { + for elt: ast::ident in *ids { if first { first = false; } else { word(s.s, "::"); } word(s.s, elt); } } ast::view_item_import_from(mod_path, idents, _) { head(s, "import"); - for elt: ast::ident in mod_path { word(s.s, elt); word(s.s, "::"); } + for elt: ast::ident in *mod_path { word(s.s, elt); word(s.s, "::"); } word(s.s, "{"); commasep(s, inconsistent, idents, fn (s: ps, w: ast::import_ident) { word(s.s, w.node.name) }); @@ -1234,7 +1234,7 @@ fn print_view_item(s: ps, item: @ast::view_item) { ast::view_item_import_glob(ids, _) { head(s, "import"); let first = true; - for elt: ast::ident in ids { + for elt: ast::ident in *ids { if first { first = false; } else { word(s.s, "::"); } word(s.s, elt); } @@ -1602,11 +1602,11 @@ fn proto_to_str(p: ast::proto) -> str { } fn ty_constr_to_str(c: @ast::ty_constr) -> str { - fn ty_constr_path_to_str(p: ast::path) -> str { "*." + path_to_str(p) } + fn ty_constr_path_to_str(&&p: @ast::path) -> str { "*." + path_to_str(p) } ret path_to_str(c.node.path) + - constr_args_to_str::<ast::path>(ty_constr_path_to_str, - c.node.args); + constr_args_to_str::<@ast::path>(ty_constr_path_to_str, + c.node.args); } diff --git a/src/comp/syntax/visit.rs b/src/comp/syntax/visit.rs index 45249be23a6..4ba8fec9807 100644 --- a/src/comp/syntax/visit.rs +++ b/src/comp/syntax/visit.rs @@ -30,7 +30,7 @@ type visitor<E> = visit_decl: fn@(@decl, E, vt<E>), visit_expr: fn@(@expr, E, vt<E>), visit_ty: fn@(@ty, E, vt<E>), - visit_constr: fn@(path, span, node_id, E, vt<E>), + visit_constr: fn@(@path, span, node_id, E, vt<E>), visit_fn: fn@(_fn, [ty_param], span, fn_ident, node_id, E, vt<E>)}; fn default_visitor<E>() -> visitor<E> { @@ -149,7 +149,7 @@ fn visit_ty<E>(t: @ty, e: E, v: vt<E>) { ty_type. {/* no-op */ } ty_constr(t, cs) { v.visit_ty(t, e, v); - for tc: @spanned<constr_general_<path, node_id>> in cs { + for tc: @spanned<constr_general_<@path, node_id>> in cs { v.visit_constr(tc.node.path, tc.span, tc.node.id, e, v); } } @@ -157,7 +157,7 @@ fn visit_ty<E>(t: @ty, e: E, v: vt<E>) { } } -fn visit_constr<E>(_operator: path, _sp: span, _id: node_id, _e: E, +fn visit_constr<E>(_operator: @path, _sp: span, _id: node_id, _e: E, _v: vt<E>) { // default } @@ -354,7 +354,7 @@ type simple_visitor = visit_decl: fn@(@decl), visit_expr: fn@(@expr), visit_ty: fn@(@ty), - visit_constr: fn@(path, span, node_id), + visit_constr: fn@(@path, span, node_id), visit_fn: fn@(_fn, [ty_param], span, fn_ident, node_id)}; fn simple_ignore_ty(_t: @ty) {} @@ -372,7 +372,7 @@ fn default_simple_visitor() -> simple_visitor { visit_decl: fn(_d: @decl) { }, visit_expr: fn(_e: @expr) { }, visit_ty: simple_ignore_ty, - visit_constr: fn(_p: path, _sp: span, _id: node_id) { }, + visit_constr: fn(_p: @path, _sp: span, _id: node_id) { }, visit_fn: fn(_f: _fn, _tps: [ty_param], _sp: span, _ident: fn_ident, _id: node_id) { @@ -429,8 +429,8 @@ fn mk_simple_visitor(v: simple_visitor) -> vt<()> { f(ty); visit_ty(ty, e, v); } - fn v_constr(f: fn@(path, span, node_id), pt: path, sp: span, id: node_id, - &&e: (), v: vt<()>) { + fn v_constr(f: fn@(@path, span, node_id), pt: @path, sp: span, + id: node_id, &&e: (), v: vt<()>) { f(pt, sp, id); visit_constr(pt, sp, id, e, v); } diff --git a/src/comp/util/ppaux.rs b/src/comp/util/ppaux.rs index d35d871ce65..d8183b897ab 100644 --- a/src/comp/util/ppaux.rs +++ b/src/comp/util/ppaux.rs @@ -161,10 +161,10 @@ fn constrs_str(constrs: [@constr]) -> str { ret s; } -fn ty_constr_to_str<Q>(c: @ast::spanned<ast::constr_general_<ast::path, Q>>) +fn ty_constr_to_str<Q>(c: @ast::spanned<ast::constr_general_<@ast::path, Q>>) -> str { ret path_to_str(c.node.path) + - constr_args_to_str::<ast::path>(path_to_str, c.node.args); + constr_args_to_str::<@ast::path>(path_to_str, c.node.args); } // Local Variables: |
