syntax: convert ast::spanned into a struct

This commit is contained in:
Erick Tryzelaar
2012-12-27 14:36:00 -05:00
parent b75550af5c
commit 93c2ebf994
31 changed files with 245 additions and 210 deletions

View File

@@ -136,8 +136,8 @@ impl ext_ctxt: ext_ctxt_ast_builder {
}
fn stmt_expr(e: @ast::expr) -> @ast::stmt {
@{node: ast::stmt_expr(e, self.next_id()),
span: dummy_sp()}
@spanned { node: ast::stmt_expr(e, self.next_id()),
span: dummy_sp()}
}
fn stmt_let(ident: ident, e: @ast::expr) -> @ast::stmt {
@@ -146,8 +146,8 @@ impl ext_ctxt: ext_ctxt_ast_builder {
}
fn field_imm(name: ident, e: @ast::expr) -> ast::field {
{node: {mutbl: ast::m_imm, ident: name, expr: e},
span: dummy_sp()}
spanned { node: { mutbl: ast::m_imm, ident: name, expr: e },
span: dummy_sp()}
}
fn rec(+fields: ~[ast::field]) -> @ast::expr {
@@ -158,8 +158,8 @@ impl ext_ctxt: ext_ctxt_ast_builder {
}
fn ty_field_imm(name: ident, ty: @ast::Ty) -> ast::ty_field {
{node: {ident: name, mt: { ty: ty, mutbl: ast::m_imm } },
span: dummy_sp()}
spanned { node: { ident: name, mt: { ty: ty, mutbl: ast::m_imm } },
span: dummy_sp() }
}
fn ty_rec(+fields: ~[ast::ty_field]) -> @ast::Ty {
@@ -199,8 +199,7 @@ impl ext_ctxt: ext_ctxt_ast_builder {
id: self.next_id(),
rules: ast::default_blk};
{node: blk,
span: dummy_sp()}
spanned { node: blk, span: dummy_sp() }
}
fn expr_block(e: @ast::expr) -> ast::blk {
@@ -275,13 +274,13 @@ impl ext_ctxt: ext_ctxt_ast_builder {
+tys: ~[@ast::Ty]) -> ast::variant {
let args = tys.map(|ty| {ty: *ty, id: self.next_id()});
{node: {name: name,
attrs: ~[],
kind: ast::tuple_variant_kind(args),
id: self.next_id(),
disr_expr: None,
vis: ast::public},
span: span}
spanned { node: { name: name,
attrs: ~[],
kind: ast::tuple_variant_kind(args),
id: self.next_id(),
disr_expr: None,
vis: ast::public},
span: span}
}
fn item_mod(name: ident,
@@ -290,7 +289,7 @@ impl ext_ctxt: ext_ctxt_ast_builder {
// XXX: Total hack: import `core::kinds::Owned` to work around a
// parser bug whereby `fn f<T: ::kinds::Owned>` doesn't parse.
let vi = ast::view_item_import(~[
@{
@ast::spanned {
node: ast::view_path_simple(
self.ident_of(~"Owned"),
path(