Make spans into stacks (to store expansion backtraces).

This commit is contained in:
Paul Stansifer 2011-08-12 08:57:21 -07:00
parent 87b56b5565
commit c48036c0b7
12 changed files with 79 additions and 50 deletions

View file

@ -190,7 +190,7 @@ fn require_unique_names(sess: &session::session,
} }
fn span[T](item: &T) -> ast::spanned[T] { fn span[T](item: &T) -> ast::spanned[T] {
ret {node: item, span: {lo: 0u, hi: 0u}}; ret {node: item, span: ast::mk_sp(0u, 0u)};
} }
fn mk_name_value_item_str(name: ast::ident, value: str) -> @ast::meta_item { fn mk_name_value_item_str(name: ast::ident, value: str) -> @ast::meta_item {

View file

@ -160,7 +160,7 @@ fn mk_test_module(cx: &test_ctxt) -> @ast::item {
attrs: ~[], attrs: ~[],
id: cx.next_node_id(), id: cx.next_node_id(),
node: item_, node: item_,
span: {lo: 0u, hi: 0u}}; span: ast::dummy_sp()};
log #fmt("Synthetic test module:\n%s\n", pprust::item_to_str(@item)); log #fmt("Synthetic test module:\n%s\n", pprust::item_to_str(@item));
@ -168,7 +168,7 @@ fn mk_test_module(cx: &test_ctxt) -> @ast::item {
} }
fn nospan[T](t: &T) -> ast::spanned[T] { fn nospan[T](t: &T) -> ast::spanned[T] {
ret {node: t, span: {lo: 0u, hi: 0u}}; ret {node: t, span: ast::dummy_sp()};
} }
fn mk_tests(cx: &test_ctxt) -> @ast::item { fn mk_tests(cx: &test_ctxt) -> @ast::item {
@ -198,7 +198,7 @@ fn mk_tests(cx: &test_ctxt) -> @ast::item {
attrs: ~[], attrs: ~[],
id: cx.next_node_id(), id: cx.next_node_id(),
node: item_, node: item_,
span: {lo: 0u, hi: 0u}}; span: ast::dummy_sp()};
ret @item; ret @item;
} }
@ -236,7 +236,7 @@ fn mk_test_desc_vec(cx: &test_ctxt) -> @ast::expr {
ret @{id: cx.next_node_id(), ret @{id: cx.next_node_id(),
node: ast::expr_vec(descs, ast::imm, ast::sk_unique), node: ast::expr_vec(descs, ast::imm, ast::sk_unique),
span: {lo: 0u, hi: 0u}}; span: ast::dummy_sp()};
} }
fn mk_test_desc_rec(cx: &test_ctxt, test: test) -> @ast::expr { fn mk_test_desc_rec(cx: &test_ctxt, test: test) -> @ast::expr {
@ -249,7 +249,7 @@ fn mk_test_desc_rec(cx: &test_ctxt, test: test) -> @ast::expr {
let name_expr: ast::expr = let name_expr: ast::expr =
{id: cx.next_node_id(), {id: cx.next_node_id(),
node: ast::expr_lit(@name_lit), node: ast::expr_lit(@name_lit),
span: {lo: 0u, hi: 0u}}; span: ast::dummy_sp()};
let name_field: ast::field = let name_field: ast::field =
nospan({mut: ast::imm, ident: "name", expr: @name_expr}); nospan({mut: ast::imm, ident: "name", expr: @name_expr});
@ -260,7 +260,7 @@ fn mk_test_desc_rec(cx: &test_ctxt, test: test) -> @ast::expr {
let fn_expr: ast::expr = let fn_expr: ast::expr =
{id: cx.next_node_id(), {id: cx.next_node_id(),
node: ast::expr_path(fn_path), node: ast::expr_path(fn_path),
span: {lo: 0u, hi: 0u}}; span: ast::dummy_sp()};
let fn_field: ast::field = let fn_field: ast::field =
nospan({mut: ast::imm, ident: "fn", expr: @fn_expr}); nospan({mut: ast::imm, ident: "fn", expr: @fn_expr});
@ -270,7 +270,7 @@ fn mk_test_desc_rec(cx: &test_ctxt, test: test) -> @ast::expr {
let ignore_expr: ast::expr = let ignore_expr: ast::expr =
{id: cx.next_node_id(), {id: cx.next_node_id(),
node: ast::expr_lit(@ignore_lit), node: ast::expr_lit(@ignore_lit),
span: {lo: 0u, hi: 0u}}; span: ast::dummy_sp()};
let ignore_field: ast::field = let ignore_field: ast::field =
nospan({mut: ast::imm, ident: "ignore", expr: @ignore_expr}); nospan({mut: ast::imm, ident: "ignore", expr: @ignore_expr});
@ -278,7 +278,7 @@ fn mk_test_desc_rec(cx: &test_ctxt, test: test) -> @ast::expr {
let desc_rec_: ast::expr_ = let desc_rec_: ast::expr_ =
ast::expr_rec(~[name_field, fn_field, ignore_field], option::none); ast::expr_rec(~[name_field, fn_field, ignore_field], option::none);
let desc_rec: ast::expr = let desc_rec: ast::expr =
{id: cx.next_node_id(), node: desc_rec_, span: {lo: 0u, hi: 0u}}; {id: cx.next_node_id(), node: desc_rec_, span: ast::dummy_sp()};
ret @desc_rec; ret @desc_rec;
} }
@ -307,7 +307,7 @@ fn mk_main(cx: &test_ctxt) -> @ast::item {
{stmts: ~[], {stmts: ~[],
expr: option::some(test_main_call_expr), expr: option::some(test_main_call_expr),
id: cx.next_node_id()}; id: cx.next_node_id()};
let body = {node: body_, span: {lo: 0u, hi: 0u}}; let body = {node: body_, span: ast::dummy_sp()};
let fn_ = {decl: decl, proto: proto, body: body}; let fn_ = {decl: decl, proto: proto, body: body};
@ -317,7 +317,7 @@ fn mk_main(cx: &test_ctxt) -> @ast::item {
attrs: ~[], attrs: ~[],
id: cx.next_node_id(), id: cx.next_node_id(),
node: item_, node: item_,
span: {lo: 0u, hi: 0u}}; span: ast::dummy_sp()};
ret @item; ret @item;
} }
@ -332,7 +332,7 @@ fn mk_test_main_call(cx: &test_ctxt) -> @ast::expr {
let args_path_expr: ast::expr = let args_path_expr: ast::expr =
{id: cx.next_node_id(), {id: cx.next_node_id(),
node: args_path_expr_, node: args_path_expr_,
span: {lo: 0u, hi: 0u}}; span: ast::dummy_sp()};
// Call __test::test to generate the vector of test_descs // Call __test::test to generate the vector of test_descs
let test_path: ast::path = let test_path: ast::path =
@ -343,14 +343,14 @@ fn mk_test_main_call(cx: &test_ctxt) -> @ast::expr {
let test_path_expr: ast::expr = let test_path_expr: ast::expr =
{id: cx.next_node_id(), {id: cx.next_node_id(),
node: test_path_expr_, node: test_path_expr_,
span: {lo: 0u, hi: 0u}}; span: ast::dummy_sp()};
let test_call_expr_: ast::expr_ = ast::expr_call(@test_path_expr, ~[]); let test_call_expr_: ast::expr_ = ast::expr_call(@test_path_expr, ~[]);
let test_call_expr: ast::expr = let test_call_expr: ast::expr =
{id: cx.next_node_id(), {id: cx.next_node_id(),
node: test_call_expr_, node: test_call_expr_,
span: {lo: 0u, hi: 0u}}; span: ast::dummy_sp()};
// Call std::test::test_main // Call std::test::test_main
let test_main_path: ast::path = let test_main_path: ast::path =
@ -363,7 +363,7 @@ fn mk_test_main_call(cx: &test_ctxt) -> @ast::expr {
let test_main_path_expr: ast::expr = let test_main_path_expr: ast::expr =
{id: cx.next_node_id(), {id: cx.next_node_id(),
node: test_main_path_expr_, node: test_main_path_expr_,
span: {lo: 0u, hi: 0u}}; span: ast::dummy_sp()};
let test_main_call_expr_: ast::expr_ = let test_main_call_expr_: ast::expr_ =
ast::expr_call(@test_main_path_expr, ast::expr_call(@test_main_path_expr,
@ -372,7 +372,7 @@ fn mk_test_main_call(cx: &test_ctxt) -> @ast::expr {
let test_main_call_expr: ast::expr = let test_main_call_expr: ast::expr =
{id: cx.next_node_id(), {id: cx.next_node_id(),
node: test_main_call_expr_, node: test_main_call_expr_,
span: {lo: 0u, hi: 0u}}; span: ast::dummy_sp()};
ret @test_main_call_expr; ret @test_main_call_expr;
} }

View file

@ -263,7 +263,7 @@ fn resolve_crate_deps(e: env, cdata: &@[u8]) -> cstore::cnum_map {
log "need to load it"; log "need to load it";
// This is a new one so we've got to load it // This is a new one so we've got to load it
// FIXME: Need better error reporting than just a bogus span // FIXME: Need better error reporting than just a bogus span
let fake_span = {lo: 0u, hi: 0u}; let fake_span = ast::dummy_sp();
let local_cnum = resolve_crate(e, cname, ~[], fake_span); let local_cnum = resolve_crate(e, cname, ~[], fake_span);
cnum_map.insert(extrn_cnum, local_cnum); cnum_map.insert(extrn_cnum, local_cnum);
} }

View file

@ -335,7 +335,7 @@ fn get_attributes(md: &ebml::doc) -> [ast::attribute] {
let meta_item = meta_items.(0); let meta_item = meta_items.(0);
attrs += attrs +=
~[{node: {style: ast::attr_outer, value: *meta_item}, ~[{node: {style: ast::attr_outer, value: *meta_item},
span: {lo: 0u, hi: 0u}}]; span: ast::dummy_sp()}];
} }
} }
option::none. { } option::none. { }

View file

@ -106,7 +106,7 @@ fn parse_path(st: @pstate, sd: str_def) -> ast::path {
':' { next(st); next(st); } ':' { next(st); next(st); }
c { c {
if c == '(' { if c == '(' {
ret respan({lo: 0u, hi: 0u}, ret respan(ast::dummy_sp(),
{global: false, idents: idents, types: ~[]}); {global: false, idents: idents, types: ~[]});
} else { idents += ~[parse_ident_(st, sd, is_last)]; } } else { idents += ~[parse_ident_(st, sd, is_last)]; }
} }
@ -152,8 +152,8 @@ fn parse_ty_constr_arg(st: @pstate, sd: str_def) ->
fn parse_constr[@T](st: @pstate, sd: str_def, pser: arg_parser[T]) -> fn parse_constr[@T](st: @pstate, sd: str_def, pser: arg_parser[T]) ->
@ty::constr_general[T] { @ty::constr_general[T] {
let sp = {lo: 0u, hi: 0u}; // FIXME: use a real span let sp = ast::dummy_sp(); // FIXME: use a real span
let args: [@sp_constr_arg[T]] = ~[]; let args: [@sp_constr_arg[T]][] = ~[];
let pth: path = parse_path(st, sd); let pth: path = parse_path(st, sd);
let ignore: char = next(st) as char; let ignore: char = next(st) as char;
assert (ignore as char == '('); assert (ignore as char == '(');

View file

@ -49,7 +49,7 @@ fn pattern_supersedes(tcx: &ty::ctxt, a: &@pat, b: &@pat) -> bool {
} }
fn field_patterns_supersede(tcx: &ty::ctxt, fas: &[field_pat], fn field_patterns_supersede(tcx: &ty::ctxt, fas: &[field_pat],
fbs: &[field_pat]) -> bool { fbs: &[field_pat]) -> bool {
let wild = @{id: 0, node: pat_wild, span: {lo: 0u, hi: 0u}}; let wild = @{id: 0, node: pat_wild, span: dummy_sp();
for fa: field_pat in fas { for fa: field_pat in fas {
let pb = wild; let pb = wild;
for fb: field_pat in fbs { for fb: field_pat in fbs {

View file

@ -21,6 +21,7 @@ import middle::ty;
import middle::ty::field; import middle::ty::field;
import middle::ty::mt; import middle::ty::mt;
import syntax::ast; import syntax::ast;
import syntax::ast::dummy_sp;
import syntax::codemap::span; import syntax::codemap::span;
import syntax::util::interner; import syntax::util::interner;
import util::common; import util::common;
@ -72,8 +73,6 @@ const shape_uniq : u8 = 22u8;
// FIXME: This is a bad API in trans_common. // FIXME: This is a bad API in trans_common.
fn C_u8(n : u8) -> ValueRef { ret trans_common::C_u8(n as uint); } fn C_u8(n : u8) -> ValueRef { ret trans_common::C_u8(n as uint); }
fn fake_span() -> span { ret { lo: 0u, hi: 0u }; }
fn hash_res_info(ri : &res_info) -> uint { fn hash_res_info(ri : &res_info) -> uint {
let h = 5381u; let h = 5381u;
h *= 33u; h += (ri.did.crate as uint); h *= 33u; h += (ri.did.crate as uint);
@ -121,7 +120,7 @@ fn largest_variants(ccx : &@crate_ctxt, tag_id : &ast::def_id) -> [uint] {
// when in fact it has minimum size sizeof(int). // when in fact it has minimum size sizeof(int).
bounded = false; bounded = false;
} else { } else {
let llty = trans::type_of(ccx, fake_span(), elem_t); let llty = trans::type_of(ccx, dummy_sp(), elem_t);
min_size += trans::llsize_of_real(ccx, llty); min_size += trans::llsize_of_real(ccx, llty);
min_align += trans::llalign_of_real(ccx, llty); min_align += trans::llalign_of_real(ccx, llty);
} }
@ -195,7 +194,7 @@ fn compute_static_tag_size(ccx : &@crate_ctxt, largest_variants : &[uint],
// We increment a "virtual data pointer" to compute the size. // We increment a "virtual data pointer" to compute the size.
let lltys = ~[]; let lltys = ~[];
for typ : ty::t in variants.(vid).args { for typ : ty::t in variants.(vid).args {
lltys += ~[trans::type_of(ccx, fake_span(), typ)]; lltys += ~[trans::type_of(ccx, dummy_sp(), typ)];
} }
let llty = trans_common::T_struct(lltys); let llty = trans_common::T_struct(lltys);
@ -412,7 +411,7 @@ fn add_size_hint(ccx : &@crate_ctxt, s : &mutable [u8], typ : ty::t) {
ret; ret;
} }
let llty = trans::type_of(ccx, fake_span(), typ); let llty = trans::type_of(ccx, dummy_sp(), typ);
add_u16(s, trans::llsize_of_real(ccx, llty) as u16); add_u16(s, trans::llsize_of_real(ccx, llty) as u16);
s += ~[ trans::llalign_of_real(ccx, llty) as u8 ]; s += ~[ trans::llalign_of_real(ccx, llty) as u8 ];
} }
@ -523,8 +522,7 @@ fn gen_resource_shapes(ccx : &@crate_ctxt) -> ValueRef {
let len = interner::len(ccx.shape_cx.resources); let len = interner::len(ccx.shape_cx.resources);
while i < len { while i < len {
let ri = interner::get(ccx.shape_cx.resources, i); let ri = interner::get(ccx.shape_cx.resources, i);
dtors += ~[trans_common::get_res_dtor(ccx, fake_span(), ri.did, dtors += ~[trans_common::get_res_dtor(ccx, dummy_sp(), ri.did, ri.t)];
ri.t)];
i += 1u; i += 1u;
} }

View file

@ -14,6 +14,7 @@ import trans::new_scope_block_ctxt;
import trans::load_if_immediate; import trans::load_if_immediate;
import ty::pat_ty; import ty::pat_ty;
import syntax::ast; import syntax::ast;
import syntax::ast::dummy_sp;
import syntax::ast::def_id; import syntax::ast::def_id;
import syntax::codemap::span; import syntax::codemap::span;
import util::common::lit_eq; import util::common::lit_eq;
@ -105,7 +106,7 @@ fn enter_default(m: &match, col: uint, val: ValueRef) -> match {
fn enter_opt(ccx: &@crate_ctxt, m: &match, opt: &opt, col: uint, fn enter_opt(ccx: &@crate_ctxt, m: &match, opt: &opt, col: uint,
tag_size: uint, val: ValueRef) -> match { tag_size: uint, val: ValueRef) -> match {
let dummy = @{id: 0, node: ast::pat_wild, span: {lo: 0u, hi: 0u}}; let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()};
fn e(ccx: &@crate_ctxt, dummy: &@ast::pat, opt: &opt, size: uint, fn e(ccx: &@crate_ctxt, dummy: &@ast::pat, opt: &opt, size: uint,
p: &@ast::pat) -> option::t[[@ast::pat]] { p: &@ast::pat) -> option::t[[@ast::pat]] {
alt p.node { alt p.node {
@ -125,7 +126,7 @@ fn enter_opt(ccx: &@crate_ctxt, m: &match, opt: &opt, col: uint,
fn enter_rec(m: &match, col: uint, fields: &[ast::ident], val: ValueRef) -> fn enter_rec(m: &match, col: uint, fields: &[ast::ident], val: ValueRef) ->
match { match {
let dummy = @{id: 0, node: ast::pat_wild, span: {lo: 0u, hi: 0u}}; let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp();
fn e(dummy: &@ast::pat, fields: &[ast::ident], p: &@ast::pat) -> fn e(dummy: &@ast::pat, fields: &[ast::ident], p: &@ast::pat) ->
option::t[[@ast::pat]] { option::t[[@ast::pat]] {
alt p.node { alt p.node {
@ -159,7 +160,7 @@ fn enter_tup(m: &match, col: uint, val: ValueRef, n_elts: uint) -> match {
} }
fn enter_box(m: &match, col: uint, val: ValueRef) -> match { fn enter_box(m: &match, col: uint, val: ValueRef) -> match {
let dummy = @{id: 0, node: ast::pat_wild, span: {lo: 0u, hi: 0u}}; let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()};
fn e(dummy: &@ast::pat, p: &@ast::pat) -> option::t[[@ast::pat]] { fn e(dummy: &@ast::pat, p: &@ast::pat) -> option::t[[@ast::pat]] {
alt p.node { alt p.node {
ast::pat_box(sub) { ret some(~[sub]); } ast::pat_box(sub) { ret some(~[sub]); }
@ -310,7 +311,7 @@ fn compile_submatch(bcx: @block_ctxt, m: &match, vals: [ValueRef],
let rec_vals = ~[]; let rec_vals = ~[];
for field_name: ast::ident in rec_fields { for field_name: ast::ident in rec_fields {
let ix: uint = let ix: uint =
ty::field_idx(ccx.sess, {lo: 0u, hi: 0u}, field_name, fields); ty::field_idx(ccx.sess, dummy_sp(), field_name, fields);
let r = trans::GEP_tup_like(bcx, rec_ty, val, ~[0, ix as int]); let r = trans::GEP_tup_like(bcx, rec_ty, val, ~[0, ix as int]);
rec_vals += ~[r.val]; rec_vals += ~[r.val];
bcx = r.bcx; bcx = r.bcx;

View file

@ -9,6 +9,14 @@ import codemap::filename;
type spanned[T] = {node: T, span: span}; type spanned[T] = {node: T, span: span};
fn respan[T](sp: &span, t: &T) -> spanned[T] { ret {node: t, span: sp}; } fn respan[T](sp: &span, t: &T) -> spanned[T] { ret {node: t, span: sp}; }
/* assuming that we're not in macro expansion */
fn mk_sp(lo: uint, hi: uint) -> span {
ret {lo: lo, hi: hi, expanded_from: codemap::os_none};
}
// make this a const, once the compiler supports it
fn dummy_sp() -> span { ret mk_sp(0u, 0u); }
type ident = str; type ident = str;
// Functions may or may not have names. // Functions may or may not have names.
type fn_ident = option::t[ident]; type fn_ident = option::t[ident];

View file

@ -65,12 +65,34 @@ fn lookup_byte_pos(map: codemap, pos: uint) -> loc {
ret lookup_pos(map, pos, lookup); ret lookup_pos(map, pos, lookup);
} }
type span = {lo: uint, hi: uint}; tag opt_span { //hack (as opposed to option::t), to make `span` compile
os_none;
os_some(@span);
}
type span = {lo: uint, hi: uint, expanded_from: opt_span};
fn span_to_str(sp: &span, cm: &codemap) -> str { fn span_to_str(sp: &span, cm: &codemap) -> str {
let lo = lookup_char_pos(cm, sp.lo); let cur = sp;
let hi = lookup_char_pos(cm, sp.hi); let res = "";
ret #fmt("%s:%u:%u:%u:%u", lo.filename, lo.line, lo.col, hi.line, hi.col); let prev_file = none;
while(true) {
let lo = lookup_char_pos(cm, cur.lo);
let hi = lookup_char_pos(cm, cur.hi);
res += #fmt("%s:%u:%u:%u:%u",
if some(lo.filename) == prev_file { "-" }
else { lo.filename },
lo.line, lo.col, hi.line, hi.col);
alt cur.expanded_from {
os_none. { break; }
os_some(new_sp) {
cur = *new_sp;
prev_file = some(lo.filename);
res += "<<";
}
}
}
ret res;
} }
fn emit_diagnostic(sp: &option::t[span], msg: &str, kind: &str, color: u8, fn emit_diagnostic(sp: &option::t[span], msg: &str, kind: &str, color: u8,

View file

@ -78,7 +78,7 @@ fn new_reader(cm: &codemap::codemap, src: str, filemap: codemap::filemap,
fn get_col() -> uint { ret col; } fn get_col() -> uint { ret col; }
fn get_filemap() -> codemap::filemap { ret fm; } fn get_filemap() -> codemap::filemap { ret fm; }
fn err(m: str) { fn err(m: str) {
codemap::emit_error(some({lo: chpos, hi: chpos}), m, cm); codemap::emit_error(some(ast::mk_sp(chpos, chpos)), m, cm);
} }
} }
let strs: [str] = ~[]; let strs: [str] = ~[];

View file

@ -90,7 +90,7 @@ fn new_parser(sess: parse_sess, cfg: ast::crate_cfg, rdr: lexer::reader,
if ivec::len(buffer) == 0u { if ivec::len(buffer) == 0u {
let next = lexer::next_token(rdr); let next = lexer::next_token(rdr);
tok = next.tok; tok = next.tok;
tok_span = {lo: next.chpos, hi: rdr.get_chpos()}; tok_span = ast::mk_sp(next.chpos, rdr.get_chpos());
} else { } else {
let next = ivec::pop(buffer); let next = ivec::pop(buffer);
tok = next.tok; tok = next.tok;
@ -100,7 +100,7 @@ fn new_parser(sess: parse_sess, cfg: ast::crate_cfg, rdr: lexer::reader,
fn look_ahead(distance: uint) -> token::token { fn look_ahead(distance: uint) -> token::token {
while ivec::len(buffer) < distance { while ivec::len(buffer) < distance {
let next = lexer::next_token(rdr); let next = lexer::next_token(rdr);
let sp = {lo: next.chpos, hi: rdr.get_chpos()}; let sp = ast::mk_sp(next.chpos, rdr.get_chpos());
buffer = ~[{tok: next.tok, span: sp}] + buffer; buffer = ~[{tok: next.tok, span: sp}] + buffer;
} }
ret buffer.(distance - 1u).tok; ret buffer.(distance - 1u).tok;
@ -135,7 +135,7 @@ fn new_parser(sess: parse_sess, cfg: ast::crate_cfg, rdr: lexer::reader,
} }
let tok0 = lexer::next_token(rdr); let tok0 = lexer::next_token(rdr);
let span0 = {lo: tok0.chpos, hi: rdr.get_chpos()}; let span0 = ast::mk_sp(tok0.chpos, rdr.get_chpos());
ret stdio_parser(sess, cfg, ftype, tok0.tok, span0, span0, ~[], ret stdio_parser(sess, cfg, ftype, tok0.tok, span0, span0, ~[],
UNRESTRICTED, rdr, prec_table(), bad_expr_word_table()); UNRESTRICTED, rdr, prec_table(), bad_expr_word_table());
} }
@ -202,7 +202,7 @@ fn expect(p: &parser, t: token::token) {
} }
fn spanned[T](lo: uint, hi: uint, node: &T) -> spanned[T] { fn spanned[T](lo: uint, hi: uint, node: &T) -> spanned[T] {
ret {node: node, span: {lo: lo, hi: hi}}; ret {node: node, span: ast::mk_sp(lo, hi)};
} }
fn parse_ident(p: &parser) -> ast::ident { fn parse_ident(p: &parser) -> ast::ident {
@ -759,13 +759,13 @@ fn parse_field(p: &parser, sep: &token::token) -> ast::field {
} }
fn mk_expr(p: &parser, lo: uint, hi: uint, node: &ast::expr_) -> @ast::expr { fn mk_expr(p: &parser, lo: uint, hi: uint, node: &ast::expr_) -> @ast::expr {
ret @{id: p.get_id(), node: node, span: {lo: lo, hi: hi}}; ret @{id: p.get_id(), node: node, span: ast::mk_sp(lo, hi)};
} }
fn mk_mac_expr(p: &parser, lo: uint, hi: uint, m: &ast::mac_) -> @ast::expr { fn mk_mac_expr(p: &parser, lo: uint, hi: uint, m: &ast::mac_) -> @ast::expr {
ret @{id: p.get_id(), ret @{id: p.get_id(),
node: ast::expr_mac({node: m, span: {lo: lo, hi: hi}}), node: ast::expr_mac({node: m, span: ast::mk_sp(lo, hi)}),
span: {lo: lo, hi: hi}}; span: ast::mk_sp(lo, hi)};
} }
fn parse_bottom_expr(p: &parser) -> @ast::expr { fn parse_bottom_expr(p: &parser) -> @ast::expr {
@ -1465,7 +1465,7 @@ fn parse_pat(p: &parser) -> @ast::pat {
subpat = subpat =
@{id: p.get_id(), @{id: p.get_id(),
node: ast::pat_bind(fieldname), node: ast::pat_bind(fieldname),
span: {lo: lo, hi: hi}}; span: ast::mk_sp(lo, hi)};
} }
fields += ~[{ident: fieldname, pat: subpat}]; fields += ~[{ident: fieldname, pat: subpat}];
} }
@ -1524,7 +1524,7 @@ fn parse_pat(p: &parser) -> @ast::pat {
} }
} }
} }
ret @{id: p.get_id(), node: pat, span: {lo: lo, hi: hi}}; ret @{id: p.get_id(), node: pat, span: ast::mk_sp(lo, hi)};
} }
fn parse_local(p: &parser, allow_init: bool) -> @ast::local { fn parse_local(p: &parser, allow_init: bool) -> @ast::local {
@ -1807,7 +1807,7 @@ fn mk_item(p: &parser, lo: uint, hi: uint, ident: &ast::ident,
attrs: attrs, attrs: attrs,
id: p.get_id(), id: p.get_id(),
node: node, node: node,
span: {lo: lo, hi: hi}}; span: ast::mk_sp(lo, hi)};
} }
fn parse_item_fn_or_iter(p: &parser, purity: ast::purity, proto: ast::proto, fn parse_item_fn_or_iter(p: &parser, purity: ast::purity, proto: ast::proto,
@ -1948,7 +1948,7 @@ fn parse_item_native_type(p: &parser, attrs: &[ast::attribute]) ->
attrs: attrs, attrs: attrs,
node: ast::native_item_ty, node: ast::native_item_ty,
id: p.get_id(), id: p.get_id(),
span: {lo: t.lo, hi: hi}}; span: ast::mk_sp(t.lo, hi)};
} }
fn parse_item_native_fn(p: &parser, attrs: &[ast::attribute]) -> fn parse_item_native_fn(p: &parser, attrs: &[ast::attribute]) ->
@ -1964,7 +1964,7 @@ fn parse_item_native_fn(p: &parser, attrs: &[ast::attribute]) ->
attrs: attrs, attrs: attrs,
node: ast::native_item_fn(link_name, decl, t.tps), node: ast::native_item_fn(link_name, decl, t.tps),
id: p.get_id(), id: p.get_id(),
span: {lo: lo, hi: hi}}; span: ast::mk_sp(lo, hi)};
} }
fn parse_native_item(p: &parser, attrs: &[ast::attribute]) -> fn parse_native_item(p: &parser, attrs: &[ast::attribute]) ->