Use span stacks to track macro expansion for less troublesome error messages.

This commit is contained in:
Paul Stansifer 2011-08-15 13:33:12 -07:00
parent c48036c0b7
commit ebb16e6a25
8 changed files with 63 additions and 37 deletions

View file

@ -127,7 +127,7 @@ fn node_span(node: &ast_node) -> codemap::span {
mod test {
#[test]
fn test_node_span_item() {
let expected: codemap::span = {lo: 20u, hi: 30u};
let expected: codemap::span = mk_sp(20u, 30u);
let node = node_item(@{ident: "test",
attrs: ~[],
id: 0,
@ -139,7 +139,7 @@ mod test {
#[test]
fn test_node_span_obj_ctor() {
let expected: codemap::span = {lo: 20u, hi: 30u};
let expected: codemap::span = mk_sp(20u, 30u);
let node = node_obj_ctor(@{ident: "test",
attrs: ~[],
id: 0,
@ -151,7 +151,7 @@ mod test {
#[test]
fn test_node_span_native_item() {
let expected: codemap::span = {lo: 20u, hi: 30u};
let expected: codemap::span = mk_sp(20u, 30u);
let node = node_native_item(@{ident: "test",
attrs: ~[],
node: native_item_ty,
@ -162,7 +162,7 @@ mod test {
#[test]
fn test_node_span_expr() {
let expected: codemap::span = {lo: 20u, hi: 30u};
let expected: codemap::span = mk_sp(20u, 30u);
let node = node_expr(@{id: 0,
node: expr_break,
span: expected});

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],
fbs: &[field_pat]) -> bool {
let wild = @{id: 0, node: pat_wild, span: dummy_sp();
let wild = @{id: 0, node: pat_wild, span: dummy_sp()};
for fa: field_pat in fas {
let pb = wild;
for fb: field_pat in fbs {

View file

@ -126,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) ->
match {
let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp();
let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()};
fn e(dummy: &@ast::pat, fields: &[ast::ident], p: &@ast::pat) ->
option::t[[@ast::pat]] {
alt p.node {
@ -148,7 +148,7 @@ fn enter_rec(m: &match, col: uint, fields: &[ast::ident], val: ValueRef) ->
}
fn enter_tup(m: &match, col: uint, val: ValueRef, n_elts: uint) -> 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, n_elts: uint, p: &@ast::pat)
-> option::t[[@ast::pat]] {
alt p.node {