diff options
| author | Marvin Löbel <loebel.marvin@gmail.com> | 2013-08-31 18:13:04 +0200 |
|---|---|---|
| committer | Marvin Löbel <loebel.marvin@gmail.com> | 2013-09-01 14:43:26 +0200 |
| commit | 539f37925c4364aa46e984df6ae2ec7e66cecc21 (patch) | |
| tree | ab15f69ecc2e88e7e5ae5ea80cf572e336df92a1 /src/libsyntax/ext | |
| parent | 617850131b795312c4dd404ae7d853b54d883105 (diff) | |
| download | rust-539f37925c4364aa46e984df6ae2ec7e66cecc21.tar.gz rust-539f37925c4364aa46e984df6ae2ec7e66cecc21.zip | |
Modernized a few type names in rustc and syntax
Diffstat (limited to 'src/libsyntax/ext')
32 files changed, 371 insertions, 371 deletions
diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs index b5d97427baf..e023c0c67ed 100644 --- a/src/libsyntax/ext/asm.rs +++ b/src/libsyntax/ext/asm.rs @@ -13,7 +13,7 @@ */ use ast; -use codemap::span; +use codemap::Span; use ext::base; use ext::base::*; use parse; @@ -37,7 +37,7 @@ fn next_state(s: State) -> Option<State> { } } -pub fn expand_asm(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) +pub fn expand_asm(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> base::MacResult { let p = parse::new_parser_from_tts(cx.parse_sess(), cx.cfg(), diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs index 4ada7f7479b..c1e7ba60fad 100644 --- a/src/libsyntax/ext/auto_encode.rs +++ b/src/libsyntax/ext/auto_encode.rs @@ -11,12 +11,12 @@ /// Deprecated #[auto_encode] and #[auto_decode] syntax extensions use ast; -use codemap::span; +use codemap::Span; use ext::base::*; pub fn expand_auto_encode( cx: @ExtCtxt, - span: span, + span: Span, _mitem: @ast::MetaItem, in_items: ~[@ast::item] ) -> ~[@ast::item] { @@ -26,7 +26,7 @@ pub fn expand_auto_encode( pub fn expand_auto_decode( cx: @ExtCtxt, - span: span, + span: Span, _mitem: @ast::MetaItem, in_items: ~[@ast::item] ) -> ~[@ast::item] { diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 7432cf80a41..83a19bb4634 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -11,7 +11,7 @@ use ast; use ast::Name; use codemap; -use codemap::{CodeMap, span, ExpnInfo}; +use codemap::{CodeMap, Span, ExpnInfo}; use diagnostic::span_handler; use ext; use parse; @@ -35,28 +35,28 @@ pub struct MacroDef { } pub type ItemDecorator = @fn(@ExtCtxt, - span, + Span, @ast::MetaItem, ~[@ast::item]) -> ~[@ast::item]; pub struct SyntaxExpanderTT { expander: SyntaxExpanderTTFun, - span: Option<span> + span: Option<Span> } pub type SyntaxExpanderTTFun = @fn(@ExtCtxt, - span, + Span, &[ast::token_tree]) -> MacResult; pub struct SyntaxExpanderTTItem { expander: SyntaxExpanderTTItemFun, - span: Option<span> + span: Option<Span> } pub type SyntaxExpanderTTItemFun = @fn(@ExtCtxt, - span, + Span, ast::ident, ~[ast::token_tree]) -> MacResult; @@ -247,7 +247,7 @@ impl ExtCtxt { pub fn codemap(&self) -> @CodeMap { self.parse_sess.cm } pub fn parse_sess(&self) -> @mut parse::ParseSess { self.parse_sess } pub fn cfg(&self) -> ast::CrateConfig { self.cfg.clone() } - pub fn call_site(&self) -> span { + pub fn call_site(&self) -> Span { match *self.backtrace { Some(@ExpnInfo {call_site: cs, _}) => cs, None => self.bug("missing top span") @@ -263,7 +263,7 @@ impl ExtCtxt { ExpnInfo {call_site: cs, callee: ref callee} => { *self.backtrace = Some(@ExpnInfo { - call_site: span {lo: cs.lo, hi: cs.hi, + call_site: Span {lo: cs.lo, hi: cs.hi, expn_info: *self.backtrace}, callee: *callee}); } @@ -272,29 +272,29 @@ impl ExtCtxt { pub fn bt_pop(&self) { match *self.backtrace { Some(@ExpnInfo { - call_site: span {expn_info: prev, _}, _}) => { + call_site: Span {expn_info: prev, _}, _}) => { *self.backtrace = prev } _ => self.bug("tried to pop without a push") } } - pub fn span_fatal(&self, sp: span, msg: &str) -> ! { + pub fn span_fatal(&self, sp: Span, msg: &str) -> ! { self.print_backtrace(); self.parse_sess.span_diagnostic.span_fatal(sp, msg); } - pub fn span_err(&self, sp: span, msg: &str) { + pub fn span_err(&self, sp: Span, msg: &str) { self.print_backtrace(); self.parse_sess.span_diagnostic.span_err(sp, msg); } - pub fn span_warn(&self, sp: span, msg: &str) { + pub fn span_warn(&self, sp: Span, msg: &str) { self.print_backtrace(); self.parse_sess.span_diagnostic.span_warn(sp, msg); } - pub fn span_unimpl(&self, sp: span, msg: &str) -> ! { + pub fn span_unimpl(&self, sp: Span, msg: &str) -> ! { self.print_backtrace(); self.parse_sess.span_diagnostic.span_unimpl(sp, msg); } - pub fn span_bug(&self, sp: span, msg: &str) -> ! { + pub fn span_bug(&self, sp: Span, msg: &str) -> ! { self.print_backtrace(); self.parse_sess.span_diagnostic.span_bug(sp, msg); } @@ -329,7 +329,7 @@ pub fn expr_to_str(cx: @ExtCtxt, expr: @ast::expr, err_msg: &str) -> @str { } } -pub fn check_zero_tts(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree], +pub fn check_zero_tts(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree], name: &str) { if tts.len() != 0 { cx.span_fatal(sp, fmt!("%s takes no arguments", name)); @@ -337,7 +337,7 @@ pub fn check_zero_tts(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree], } pub fn get_single_str_from_tts(cx: @ExtCtxt, - sp: span, + sp: Span, tts: &[ast::token_tree], name: &str) -> @str { @@ -352,7 +352,7 @@ pub fn get_single_str_from_tts(cx: @ExtCtxt, } pub fn get_exprs_from_tts(cx: @ExtCtxt, - sp: span, + sp: Span, tts: &[ast::token_tree]) -> ~[@ast::expr] { let p = parse::new_parser_from_tts(cx.parse_sess(), cx.cfg(), diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 21d67493cbf..194b4ab83f9 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -12,7 +12,7 @@ use abi::AbiSet; use ast::ident; use ast; use ast_util; -use codemap::{span, respan, dummy_sp}; +use codemap::{Span, respan, dummy_sp}; use fold; use ext::base::ExtCtxt; use ext::quote::rt::*; @@ -32,10 +32,10 @@ mod syntax { pub trait AstBuilder { // paths - fn path(&self, span: span, strs: ~[ast::ident]) -> ast::Path; - fn path_ident(&self, span: span, id: ast::ident) -> ast::Path; - fn path_global(&self, span: span, strs: ~[ast::ident]) -> ast::Path; - fn path_all(&self, sp: span, + fn path(&self, span: Span, strs: ~[ast::ident]) -> ast::Path; + fn path_ident(&self, span: Span, id: ast::ident) -> ast::Path; + fn path_global(&self, span: Span, strs: ~[ast::ident]) -> ast::Path; + fn path_all(&self, sp: Span, global: bool, idents: ~[ast::ident], rp: Option<ast::Lifetime>, @@ -45,37 +45,37 @@ pub trait AstBuilder { // types fn ty_mt(&self, ty: ast::Ty, mutbl: ast::mutability) -> ast::mt; - fn ty(&self, span: span, ty: ast::ty_) -> ast::Ty; + fn ty(&self, span: Span, ty: ast::ty_) -> ast::Ty; fn ty_path(&self, ast::Path, Option<OptVec<ast::TyParamBound>>) -> ast::Ty; - fn ty_ident(&self, span: span, idents: ast::ident) -> ast::Ty; + fn ty_ident(&self, span: Span, idents: ast::ident) -> ast::Ty; - fn ty_rptr(&self, span: span, + fn ty_rptr(&self, span: Span, ty: ast::Ty, lifetime: Option<ast::Lifetime>, mutbl: ast::mutability) -> ast::Ty; - fn ty_uniq(&self, span: span, ty: ast::Ty) -> ast::Ty; - fn ty_box(&self, span: span, ty: ast::Ty, mutbl: ast::mutability) -> ast::Ty; + fn ty_uniq(&self, span: Span, ty: ast::Ty) -> ast::Ty; + fn ty_box(&self, span: Span, ty: ast::Ty, mutbl: ast::mutability) -> ast::Ty; fn ty_option(&self, ty: ast::Ty) -> ast::Ty; - fn ty_infer(&self, sp: span) -> ast::Ty; + fn ty_infer(&self, sp: Span) -> ast::Ty; fn ty_nil(&self) -> ast::Ty; fn ty_vars(&self, ty_params: &OptVec<ast::TyParam>) -> ~[ast::Ty]; fn ty_vars_global(&self, ty_params: &OptVec<ast::TyParam>) -> ~[ast::Ty]; - fn ty_field_imm(&self, span: span, name: ident, ty: ast::Ty) -> ast::TypeField; + fn ty_field_imm(&self, span: Span, name: ident, ty: ast::Ty) -> ast::TypeField; fn strip_bounds(&self, bounds: &Generics) -> Generics; fn typaram(&self, id: ast::ident, bounds: OptVec<ast::TyParamBound>) -> ast::TyParam; fn trait_ref(&self, path: ast::Path) -> ast::trait_ref; fn typarambound(&self, path: ast::Path) -> ast::TyParamBound; - fn lifetime(&self, span: span, ident: ast::ident) -> ast::Lifetime; + fn lifetime(&self, span: Span, ident: ast::ident) -> ast::Lifetime; // statements fn stmt_expr(&self, expr: @ast::expr) -> @ast::stmt; - fn stmt_let(&self, sp: span, mutbl: bool, ident: ast::ident, ex: @ast::expr) -> @ast::stmt; + fn stmt_let(&self, sp: Span, mutbl: bool, ident: ast::ident, ex: @ast::expr) -> @ast::stmt; fn stmt_let_typed(&self, - sp: span, + sp: Span, mutbl: bool, ident: ast::ident, typ: ast::Ty, @@ -83,165 +83,165 @@ pub trait AstBuilder { -> @ast::stmt; // blocks - fn block(&self, span: span, stmts: ~[@ast::stmt], expr: Option<@ast::expr>) -> ast::Block; + fn block(&self, span: Span, stmts: ~[@ast::stmt], expr: Option<@ast::expr>) -> ast::Block; fn block_expr(&self, expr: @ast::expr) -> ast::Block; - fn block_all(&self, span: span, + fn block_all(&self, span: Span, view_items: ~[ast::view_item], stmts: ~[@ast::stmt], expr: Option<@ast::expr>) -> ast::Block; // expressions - fn expr(&self, span: span, node: ast::expr_) -> @ast::expr; + fn expr(&self, span: Span, node: ast::expr_) -> @ast::expr; fn expr_path(&self, path: ast::Path) -> @ast::expr; - fn expr_ident(&self, span: span, id: ast::ident) -> @ast::expr; + fn expr_ident(&self, span: Span, id: ast::ident) -> @ast::expr; - fn expr_self(&self, span: span) -> @ast::expr; - fn expr_binary(&self, sp: span, op: ast::binop, + fn expr_self(&self, span: Span) -> @ast::expr; + fn expr_binary(&self, sp: Span, op: ast::binop, lhs: @ast::expr, rhs: @ast::expr) -> @ast::expr; - fn expr_deref(&self, sp: span, e: @ast::expr) -> @ast::expr; - fn expr_unary(&self, sp: span, op: ast::unop, e: @ast::expr) -> @ast::expr; - - fn expr_managed(&self, sp: span, e: @ast::expr) -> @ast::expr; - fn expr_addr_of(&self, sp: span, e: @ast::expr) -> @ast::expr; - fn expr_mut_addr_of(&self, sp: span, e: @ast::expr) -> @ast::expr; - fn expr_field_access(&self, span: span, expr: @ast::expr, ident: ast::ident) -> @ast::expr; - fn expr_call(&self, span: span, expr: @ast::expr, args: ~[@ast::expr]) -> @ast::expr; - fn expr_call_ident(&self, span: span, id: ast::ident, args: ~[@ast::expr]) -> @ast::expr; - fn expr_call_global(&self, sp: span, fn_path: ~[ast::ident], + fn expr_deref(&self, sp: Span, e: @ast::expr) -> @ast::expr; + fn expr_unary(&self, sp: Span, op: ast::unop, e: @ast::expr) -> @ast::expr; + + fn expr_managed(&self, sp: Span, e: @ast::expr) -> @ast::expr; + fn expr_addr_of(&self, sp: Span, e: @ast::expr) -> @ast::expr; + fn expr_mut_addr_of(&self, sp: Span, e: @ast::expr) -> @ast::expr; + fn expr_field_access(&self, span: Span, expr: @ast::expr, ident: ast::ident) -> @ast::expr; + fn expr_call(&self, span: Span, expr: @ast::expr, args: ~[@ast::expr]) -> @ast::expr; + fn expr_call_ident(&self, span: Span, id: ast::ident, args: ~[@ast::expr]) -> @ast::expr; + fn expr_call_global(&self, sp: Span, fn_path: ~[ast::ident], args: ~[@ast::expr]) -> @ast::expr; - fn expr_method_call(&self, span: span, + fn expr_method_call(&self, span: Span, expr: @ast::expr, ident: ast::ident, args: ~[@ast::expr]) -> @ast::expr; fn expr_block(&self, b: ast::Block) -> @ast::expr; - fn field_imm(&self, span: span, name: ident, e: @ast::expr) -> ast::Field; - fn expr_struct(&self, span: span, path: ast::Path, fields: ~[ast::Field]) -> @ast::expr; - fn expr_struct_ident(&self, span: span, id: ast::ident, fields: ~[ast::Field]) -> @ast::expr; + fn field_imm(&self, span: Span, name: ident, e: @ast::expr) -> ast::Field; + fn expr_struct(&self, span: Span, path: ast::Path, fields: ~[ast::Field]) -> @ast::expr; + fn expr_struct_ident(&self, span: Span, id: ast::ident, fields: ~[ast::Field]) -> @ast::expr; - fn expr_lit(&self, sp: span, lit: ast::lit_) -> @ast::expr; + fn expr_lit(&self, sp: Span, lit: ast::lit_) -> @ast::expr; - fn expr_uint(&self, span: span, i: uint) -> @ast::expr; - fn expr_int(&self, sp: span, i: int) -> @ast::expr; - fn expr_u8(&self, sp: span, u: u8) -> @ast::expr; - fn expr_bool(&self, sp: span, value: bool) -> @ast::expr; + fn expr_uint(&self, span: Span, i: uint) -> @ast::expr; + fn expr_int(&self, sp: Span, i: int) -> @ast::expr; + fn expr_u8(&self, sp: Span, u: u8) -> @ast::expr; + fn expr_bool(&self, sp: Span, value: bool) -> @ast::expr; - fn expr_vstore(&self, sp: span, expr: @ast::expr, vst: ast::expr_vstore) -> @ast::expr; - fn expr_vec(&self, sp: span, exprs: ~[@ast::expr]) -> @ast::expr; - fn expr_vec_uniq(&self, sp: span, exprs: ~[@ast::expr]) -> @ast::expr; - fn expr_vec_slice(&self, sp: span, exprs: ~[@ast::expr]) -> @ast::expr; - fn expr_str(&self, sp: span, s: @str) -> @ast::expr; - fn expr_str_uniq(&self, sp: span, s: @str) -> @ast::expr; + fn expr_vstore(&self, sp: Span, expr: @ast::expr, vst: ast::expr_vstore) -> @ast::expr; + fn expr_vec(&self, sp: Span, exprs: ~[@ast::expr]) -> @ast::expr; + fn expr_vec_uniq(&self, sp: Span, exprs: ~[@ast::expr]) -> @ast::expr; + fn expr_vec_slice(&self, sp: Span, exprs: ~[@ast::expr]) -> @ast::expr; + fn expr_str(&self, sp: Span, s: @str) -> @ast::expr; + fn expr_str_uniq(&self, sp: Span, s: @str) -> @ast::expr; - fn expr_unreachable(&self, span: span) -> @ast::expr; + fn expr_unreachable(&self, span: Span) -> @ast::expr; - fn pat(&self, span: span, pat: ast::pat_) -> @ast::pat; - fn pat_wild(&self, span: span) -> @ast::pat; - fn pat_lit(&self, span: span, expr: @ast::expr) -> @ast::pat; - fn pat_ident(&self, span: span, ident: ast::ident) -> @ast::pat; + fn pat(&self, span: Span, pat: ast::pat_) -> @ast::pat; + fn pat_wild(&self, span: Span) -> @ast::pat; + fn pat_lit(&self, span: Span, expr: @ast::expr) -> @ast::pat; + fn pat_ident(&self, span: Span, ident: ast::ident) -> @ast::pat; fn pat_ident_binding_mode(&self, - span: span, + span: Span, ident: ast::ident, bm: ast::binding_mode) -> @ast::pat; - fn pat_enum(&self, span: span, path: ast::Path, subpats: ~[@ast::pat]) -> @ast::pat; - fn pat_struct(&self, span: span, + fn pat_enum(&self, span: Span, path: ast::Path, subpats: ~[@ast::pat]) -> @ast::pat; + fn pat_struct(&self, span: Span, path: ast::Path, field_pats: ~[ast::field_pat]) -> @ast::pat; - fn arm(&self, span: span, pats: ~[@ast::pat], expr: @ast::expr) -> ast::arm; - fn arm_unreachable(&self, span: span) -> ast::arm; + fn arm(&self, span: Span, pats: ~[@ast::pat], expr: @ast::expr) -> ast::arm; + fn arm_unreachable(&self, span: Span) -> ast::arm; - fn expr_match(&self, span: span, arg: @ast::expr, arms: ~[ast::arm]) -> @ast::expr; - fn expr_if(&self, span: span, + fn expr_match(&self, span: Span, arg: @ast::expr, arms: ~[ast::arm]) -> @ast::expr; + fn expr_if(&self, span: Span, cond: @ast::expr, then: @ast::expr, els: Option<@ast::expr>) -> @ast::expr; - fn lambda_fn_decl(&self, span: span, fn_decl: ast::fn_decl, blk: ast::Block) -> @ast::expr; + fn lambda_fn_decl(&self, span: Span, fn_decl: ast::fn_decl, blk: ast::Block) -> @ast::expr; - fn lambda(&self, span: span, ids: ~[ast::ident], blk: ast::Block) -> @ast::expr; - fn lambda0(&self, span: span, blk: ast::Block) -> @ast::expr; - fn lambda1(&self, span: span, blk: ast::Block, ident: ast::ident) -> @ast::expr; + fn lambda(&self, span: Span, ids: ~[ast::ident], blk: ast::Block) -> @ast::expr; + fn lambda0(&self, span: Span, blk: ast::Block) -> @ast::expr; + fn lambda1(&self, span: Span, blk: ast::Block, ident: ast::ident) -> @ast::expr; - fn lambda_expr(&self, span: span, ids: ~[ast::ident], blk: @ast::expr) -> @ast::expr; - fn lambda_expr_0(&self, span: span, expr: @ast::expr) -> @ast::expr; - fn lambda_expr_1(&self, span: span, expr: @ast::expr, ident: ast::ident) -> @ast::expr; + fn lambda_expr(&self, span: Span, ids: ~[ast::ident], blk: @ast::expr) -> @ast::expr; + fn lambda_expr_0(&self, span: Span, expr: @ast::expr) -> @ast::expr; + fn lambda_expr_1(&self, span: Span, expr: @ast::expr, ident: ast::ident) -> @ast::expr; - fn lambda_stmts(&self, span: span, ids: ~[ast::ident], blk: ~[@ast::stmt]) -> @ast::expr; - fn lambda_stmts_0(&self, span: span, stmts: ~[@ast::stmt]) -> @ast::expr; - fn lambda_stmts_1(&self, span: span, stmts: ~[@ast::stmt], ident: ast::ident) -> @ast::expr; + fn lambda_stmts(&self, span: Span, ids: ~[ast::ident], blk: ~[@ast::stmt]) -> @ast::expr; + fn lambda_stmts_0(&self, span: Span, stmts: ~[@ast::stmt]) -> @ast::expr; + fn lambda_stmts_1(&self, span: Span, stmts: ~[@ast::stmt], ident: ast::ident) -> @ast::expr; // items - fn item(&self, span: span, + fn item(&self, span: Span, name: ident, attrs: ~[ast::Attribute], node: ast::item_) -> @ast::item; - fn arg(&self, span: span, name: ident, ty: ast::Ty) -> ast::arg; + fn arg(&self, span: Span, name: ident, ty: ast::Ty) -> ast::arg; // XXX unused self fn fn_decl(&self, inputs: ~[ast::arg], output: ast::Ty) -> ast::fn_decl; fn item_fn_poly(&self, - span: span, + span: Span, name: ident, inputs: ~[ast::arg], output: ast::Ty, generics: Generics, body: ast::Block) -> @ast::item; fn item_fn(&self, - span: span, + span: Span, name: ident, inputs: ~[ast::arg], output: ast::Ty, body: ast::Block) -> @ast::item; - fn variant(&self, span: span, name: ident, tys: ~[ast::Ty]) -> ast::variant; + fn variant(&self, span: Span, name: ident, tys: ~[ast::Ty]) -> ast::variant; fn item_enum_poly(&self, - span: span, + span: Span, name: ident, enum_definition: ast::enum_def, generics: Generics) -> @ast::item; - fn item_enum(&self, span: span, name: ident, enum_def: ast::enum_def) -> @ast::item; + fn item_enum(&self, span: Span, name: ident, enum_def: ast::enum_def) -> @ast::item; fn item_struct_poly(&self, - span: span, + span: Span, name: ident, struct_def: ast::struct_def, generics: Generics) -> @ast::item; - fn item_struct(&self, span: span, name: ident, struct_def: ast::struct_def) -> @ast::item; + fn item_struct(&self, span: Span, name: ident, struct_def: ast::struct_def) -> @ast::item; - fn item_mod(&self, span: span, + fn item_mod(&self, span: Span, name: ident, attrs: ~[ast::Attribute], vi: ~[ast::view_item], items: ~[@ast::item]) -> @ast::item; fn item_ty_poly(&self, - span: span, + span: Span, name: ident, ty: ast::Ty, generics: Generics) -> @ast::item; - fn item_ty(&self, span: span, name: ident, ty: ast::Ty) -> @ast::item; + fn item_ty(&self, span: Span, name: ident, ty: ast::Ty) -> @ast::item; - fn attribute(&self, sp: span, mi: @ast::MetaItem) -> ast::Attribute; + fn attribute(&self, sp: Span, mi: @ast::MetaItem) -> ast::Attribute; - fn meta_word(&self, sp: span, w: @str) -> @ast::MetaItem; - fn meta_list(&self, sp: span, name: @str, mis: ~[@ast::MetaItem]) -> @ast::MetaItem; - fn meta_name_value(&self, sp: span, name: @str, value: ast::lit_) -> @ast::MetaItem; + fn meta_word(&self, sp: Span, w: @str) -> @ast::MetaItem; + fn meta_list(&self, sp: Span, name: @str, mis: ~[@ast::MetaItem]) -> @ast::MetaItem; + fn meta_name_value(&self, sp: Span, name: @str, value: ast::lit_) -> @ast::MetaItem; - fn view_use(&self, sp: span, + fn view_use(&self, sp: Span, vis: ast::visibility, vp: ~[@ast::view_path]) -> ast::view_item; - fn view_use_list(&self, sp: span, vis: ast::visibility, + fn view_use_list(&self, sp: Span, vis: ast::visibility, path: ~[ast::ident], imports: &[ast::ident]) -> ast::view_item; - fn view_use_glob(&self, sp: span, + fn view_use_glob(&self, sp: Span, vis: ast::visibility, path: ~[ast::ident]) -> ast::view_item; } impl AstBuilder for @ExtCtxt { - fn path(&self, span: span, strs: ~[ast::ident]) -> ast::Path { + fn path(&self, span: Span, strs: ~[ast::ident]) -> ast::Path { self.path_all(span, false, strs, None, ~[]) } - fn path_ident(&self, span: span, id: ast::ident) -> ast::Path { + fn path_ident(&self, span: Span, id: ast::ident) -> ast::Path { self.path(span, ~[id]) } - fn path_global(&self, span: span, strs: ~[ast::ident]) -> ast::Path { + fn path_global(&self, span: Span, strs: ~[ast::ident]) -> ast::Path { self.path_all(span, true, strs, None, ~[]) } fn path_all(&self, - sp: span, + sp: Span, global: bool, mut idents: ~[ast::ident], rp: Option<ast::Lifetime>, @@ -275,7 +275,7 @@ impl AstBuilder for @ExtCtxt { } } - fn ty(&self, span: span, ty: ast::ty_) -> ast::Ty { + fn ty(&self, span: Span, ty: ast::ty_) -> ast::Ty { ast::Ty { id: self.next_id(), span: span, @@ -291,13 +291,13 @@ impl AstBuilder for @ExtCtxt { // Might need to take bounds as an argument in the future, if you ever want // to generate a bounded existential trait type. - fn ty_ident(&self, span: span, ident: ast::ident) + fn ty_ident(&self, span: Span, ident: ast::ident) -> ast::Ty { self.ty_path(self.path_ident(span, ident), None) } fn ty_rptr(&self, - span: span, + span: Span, ty: ast::Ty, lifetime: Option<ast::Lifetime>, mutbl: ast::mutability) @@ -305,10 +305,10 @@ impl AstBuilder for @ExtCtxt { self.ty(span, ast::ty_rptr(lifetime, self.ty_mt(ty, mutbl))) } - fn ty_uniq(&self, span: span, ty: ast::Ty) -> ast::Ty { + fn ty_uniq(&self, span: Span, ty: ast::Ty) -> ast::Ty { self.ty(span, ast::ty_uniq(self.ty_mt(ty, ast::m_imm))) } - fn ty_box(&self, span: span, + fn ty_box(&self, span: Span, ty: ast::Ty, mutbl: ast::mutability) -> ast::Ty { self.ty(span, ast::ty_box(self.ty_mt(ty, mutbl))) } @@ -326,7 +326,7 @@ impl AstBuilder for @ExtCtxt { ~[ ty ]), None) } - fn ty_field_imm(&self, span: span, name: ident, ty: ast::Ty) -> ast::TypeField { + fn ty_field_imm(&self, span: Span, name: ident, ty: ast::Ty) -> ast::TypeField { ast::TypeField { ident: name, mt: ast::mt { ty: ~ty, mutbl: ast::m_imm }, @@ -334,7 +334,7 @@ impl AstBuilder for @ExtCtxt { } } - fn ty_infer(&self, span: span) -> ast::Ty { + fn ty_infer(&self, span: Span) -> ast::Ty { self.ty(span, ast::ty_infer) } @@ -385,7 +385,7 @@ impl AstBuilder for @ExtCtxt { ast::TraitTyParamBound(self.trait_ref(path)) } - fn lifetime(&self, span: span, ident: ast::ident) -> ast::Lifetime { + fn lifetime(&self, span: Span, ident: ast::ident) -> ast::Lifetime { ast::Lifetime { id: self.next_id(), span: span, ident: ident } } @@ -393,7 +393,7 @@ impl AstBuilder for @ExtCtxt { @respan(expr.span, ast::stmt_semi(expr, self.next_id())) } - fn stmt_let(&self, sp: span, mutbl: bool, ident: ast::ident, ex: @ast::expr) -> @ast::stmt { + fn stmt_let(&self, sp: Span, mutbl: bool, ident: ast::ident, ex: @ast::expr) -> @ast::stmt { let pat = self.pat_ident(sp, ident); let local = @ast::Local { is_mutbl: mutbl, @@ -408,7 +408,7 @@ impl AstBuilder for @ExtCtxt { } fn stmt_let_typed(&self, - sp: span, + sp: Span, mutbl: bool, ident: ast::ident, typ: ast::Ty, @@ -427,7 +427,7 @@ impl AstBuilder for @ExtCtxt { @respan(sp, ast::stmt_decl(@decl, self.next_id())) } - fn block(&self, span: span, stmts: ~[@ast::stmt], expr: Option<@expr>) -> ast::Block { + fn block(&self, span: Span, stmts: ~[@ast::stmt], expr: Option<@expr>) -> ast::Block { self.block_all(span, ~[], stmts, expr) } @@ -435,7 +435,7 @@ impl AstBuilder for @ExtCtxt { self.block_all(expr.span, ~[], ~[], Some(expr)) } fn block_all(&self, - span: span, + span: Span, view_items: ~[ast::view_item], stmts: ~[@ast::stmt], expr: Option<@ast::expr>) -> ast::Block { @@ -449,7 +449,7 @@ impl AstBuilder for @ExtCtxt { } } - fn expr(&self, span: span, node: ast::expr_) -> @ast::expr { + fn expr(&self, span: Span, node: ast::expr_) -> @ast::expr { @ast::expr { id: self.next_id(), node: node, @@ -461,53 +461,53 @@ impl AstBuilder for @ExtCtxt { self.expr(path.span, ast::expr_path(path)) } - fn expr_ident(&self, span: span, id: ast::ident) -> @ast::expr { + fn expr_ident(&self, span: Span, id: ast::ident) -> @ast::expr { self.expr_path(self.path_ident(span, id)) } - fn expr_self(&self, span: span) -> @ast::expr { + fn expr_self(&self, span: Span) -> @ast::expr { self.expr(span, ast::expr_self) } - fn expr_binary(&self, sp: span, op: ast::binop, + fn expr_binary(&self, sp: Span, op: ast::binop, lhs: @ast::expr, rhs: @ast::expr) -> @ast::expr { self.expr(sp, ast::expr_binary(self.next_id(), op, lhs, rhs)) } - fn expr_deref(&self, sp: span, e: @ast::expr) -> @ast::expr { + fn expr_deref(&self, sp: Span, e: @ast::expr) -> @ast::expr { self.expr_unary(sp, ast::deref, e) } - fn expr_unary(&self, sp: span, op: ast::unop, e: @ast::expr) + fn expr_unary(&self, sp: Span, op: ast::unop, e: @ast::expr) -> @ast::expr { self.expr(sp, ast::expr_unary(self.next_id(), op, e)) } - fn expr_managed(&self, sp: span, e: @ast::expr) -> @ast::expr { + fn expr_managed(&self, sp: Span, e: @ast::expr) -> @ast::expr { self.expr_unary(sp, ast::box(ast::m_imm), e) } - fn expr_field_access(&self, sp: span, expr: @ast::expr, ident: ast::ident) -> @ast::expr { + fn expr_field_access(&self, sp: Span, expr: @ast::expr, ident: ast::ident) -> @ast::expr { self.expr(sp, ast::expr_field(expr, ident, ~[])) } - fn expr_addr_of(&self, sp: span, e: @ast::expr) -> @ast::expr { + fn expr_addr_of(&self, sp: Span, e: @ast::expr) -> @ast::expr { self.expr(sp, ast::expr_addr_of(ast::m_imm, e)) } - fn expr_mut_addr_of(&self, sp: span, e: @ast::expr) -> @ast::expr { + fn expr_mut_addr_of(&self, sp: Span, e: @ast::expr) -> @ast::expr { self.expr(sp, ast::expr_addr_of(ast::m_mutbl, e)) } - fn expr_call(&self, span: span, expr: @ast::expr, args: ~[@ast::expr]) -> @ast::expr { + fn expr_call(&self, span: Span, expr: @ast::expr, args: ~[@ast::expr]) -> @ast::expr { self.expr(span, ast::expr_call(expr, args, ast::NoSugar)) } - fn expr_call_ident(&self, span: span, id: ast::ident, args: ~[@ast::expr]) -> @ast::expr { + fn expr_call_ident(&self, span: Span, id: ast::ident, args: ~[@ast::expr]) -> @ast::expr { self.expr(span, ast::expr_call(self.expr_ident(span, id), args, ast::NoSugar)) } - fn expr_call_global(&self, sp: span, fn_path: ~[ast::ident], + fn expr_call_global(&self, sp: Span, fn_path: ~[ast::ident], args: ~[@ast::expr]) -> @ast::expr { let pathexpr = self.expr_path(self.path_global(sp, fn_path)); self.expr_call(sp, pathexpr, args) } - fn expr_method_call(&self, span: span, + fn expr_method_call(&self, span: Span, expr: @ast::expr, ident: ast::ident, args: ~[@ast::expr]) -> @ast::expr { @@ -517,54 +517,54 @@ impl AstBuilder for @ExtCtxt { fn expr_block(&self, b: ast::Block) -> @ast::expr { self.expr(b.span, ast::expr_block(b)) } - fn field_imm(&self, span: span, name: ident, e: @ast::expr) -> ast::Field { + fn field_imm(&self, span: Span, name: ident, e: @ast::expr) -> ast::Field { ast::Field { ident: name, expr: e, span: span } } - fn expr_struct(&self, span: span, path: ast::Path, fields: ~[ast::Field]) -> @ast::expr { + fn expr_struct(&self, span: Span, path: ast::Path, fields: ~[ast::Field]) -> @ast::expr { self.expr(span, ast::expr_struct(path, fields, None)) } - fn expr_struct_ident(&self, span: span, + fn expr_struct_ident(&self, span: Span, id: ast::ident, fields: ~[ast::Field]) -> @ast::expr { self.expr_struct(span, self.path_ident(span, id), fields) } - fn expr_lit(&self, sp: span, lit: ast::lit_) -> @ast::expr { + fn expr_lit(&self, sp: Span, lit: ast::lit_) -> @ast::expr { self.expr(sp, ast::expr_lit(@respan(sp, lit))) } - fn expr_uint(&self, span: span, i: uint) -> @ast::expr { + fn expr_uint(&self, span: Span, i: uint) -> @ast::expr { self.expr_lit(span, ast::lit_uint(i as u64, ast::ty_u)) } - fn expr_int(&self, sp: span, i: int) -> @ast::expr { + fn expr_int(&self, sp: Span, i: int) -> @ast::expr { self.expr_lit(sp, ast::lit_int(i as i64, ast::ty_i)) } - fn expr_u8(&self, sp: span, u: u8) -> @ast::expr { + fn expr_u8(&self, sp: Span, u: u8) -> @ast::expr { self.expr_lit(sp, ast::lit_uint(u as u64, ast::ty_u8)) } - fn expr_bool(&self, sp: span, value: bool) -> @ast::expr { + fn expr_bool(&self, sp: Span, value: bool) -> @ast::expr { self.expr_lit(sp, ast::lit_bool(value)) } - fn expr_vstore(&self, sp: span, expr: @ast::expr, vst: ast::expr_vstore) -> @ast::expr { + fn expr_vstore(&self, sp: Span, expr: @ast::expr, vst: ast::expr_vstore) -> @ast::expr { self.expr(sp, ast::expr_vstore(expr, vst)) } - fn expr_vec(&self, sp: span, exprs: ~[@ast::expr]) -> @ast::expr { + fn expr_vec(&self, sp: Span, exprs: ~[@ast::expr]) -> @ast::expr { self.expr(sp, ast::expr_vec(exprs, ast::m_imm)) } - fn expr_vec_uniq(&self, sp: span, exprs: ~[@ast::expr]) -> @ast::expr { + fn expr_vec_uniq(&self, sp: Span, exprs: ~[@ast::expr]) -> @ast::expr { self.expr_vstore(sp, self.expr_vec(sp, exprs), ast::expr_vstore_uniq) } - fn expr_vec_slice(&self, sp: span, exprs: ~[@ast::expr]) -> @ast::expr { + fn expr_vec_slice(&self, sp: Span, exprs: ~[@ast::expr]) -> @ast::expr { self.expr_vstore(sp, self.expr_vec(sp, exprs), ast::expr_vstore_slice) } - fn expr_str(&self, sp: span, s: @str) -> @ast::expr { + fn expr_str(&self, sp: Span, s: @str) -> @ast::expr { self.expr_lit(sp, ast::lit_str(s)) } - fn expr_str_uniq(&self, sp: span, s: @str) -> @ast::expr { + fn expr_str_uniq(&self, sp: Span, s: @str) -> @ast::expr { self.expr_vstore(sp, self.expr_str(sp, s), ast::expr_vstore_uniq) } - fn expr_unreachable(&self, span: span) -> @ast::expr { + fn expr_unreachable(&self, span: Span) -> @ast::expr { let loc = self.codemap().lookup_char_pos(span.lo); self.expr_call_global( span, @@ -582,38 +582,38 @@ impl AstBuilder for @ExtCtxt { } - fn pat(&self, span: span, pat: ast::pat_) -> @ast::pat { + fn pat(&self, span: Span, pat: ast::pat_) -> @ast::pat { @ast::pat { id: self.next_id(), node: pat, span: span } } - fn pat_wild(&self, span: span) -> @ast::pat { + fn pat_wild(&self, span: Span) -> @ast::pat { self.pat(span, ast::pat_wild) } - fn pat_lit(&self, span: span, expr: @ast::expr) -> @ast::pat { + fn pat_lit(&self, span: Span, expr: @ast::expr) -> @ast::pat { self.pat(span, ast::pat_lit(expr)) } - fn pat_ident(&self, span: span, ident: ast::ident) -> @ast::pat { + fn pat_ident(&self, span: Span, ident: ast::ident) -> @ast::pat { self.pat_ident_binding_mode(span, ident, ast::bind_infer) } fn pat_ident_binding_mode(&self, - span: span, + span: Span, ident: ast::ident, bm: ast::binding_mode) -> @ast::pat { let path = self.path_ident(span, ident); let pat = ast::pat_ident(bm, path, None); self.pat(span, pat) } - fn pat_enum(&self, span: span, path: ast::Path, subpats: ~[@ast::pat]) -> @ast::pat { + fn pat_enum(&self, span: Span, path: ast::Path, subpats: ~[@ast::pat]) -> @ast::pat { let pat = ast::pat_enum(path, Some(subpats)); self.pat(span, pat) } - fn pat_struct(&self, span: span, + fn pat_struct(&self, span: Span, path: ast::Path, field_pats: ~[ast::field_pat]) -> @ast::pat { let pat = ast::pat_struct(path, field_pats, false); self.pat(span, pat) } - fn arm(&self, _span: span, pats: ~[@ast::pat], expr: @ast::expr) -> ast::arm { + fn arm(&self, _span: Span, pats: ~[@ast::pat], expr: @ast::expr) -> ast::arm { ast::arm { pats: pats, guard: None, @@ -621,24 +621,24 @@ impl AstBuilder for @ExtCtxt { } } - fn arm_unreachable(&self, span: span) -> ast::arm { + fn arm_unreachable(&self, span: Span) -> ast::arm { self.arm(span, ~[self.pat_wild(span)], self.expr_unreachable(span)) } - fn expr_match(&self, span: span, arg: @ast::expr, arms: ~[ast::arm]) -> @expr { + fn expr_match(&self, span: Span, arg: @ast::expr, arms: ~[ast::arm]) -> @expr { self.expr(span, ast::expr_match(arg, arms)) } - fn expr_if(&self, span: span, + fn expr_if(&self, span: Span, cond: @ast::expr, then: @ast::expr, els: Option<@ast::expr>) -> @ast::expr { let els = els.map_move(|x| self.expr_block(self.block_expr(x))); self.expr(span, ast::expr_if(cond, self.block_expr(then), els)) } - fn lambda_fn_decl(&self, span: span, fn_decl: ast::fn_decl, blk: ast::Block) -> @ast::expr { + fn lambda_fn_decl(&self, span: Span, fn_decl: ast::fn_decl, blk: ast::Block) -> @ast::expr { self.expr(span, ast::expr_fn_block(fn_decl, blk)) } - fn lambda(&self, span: span, ids: ~[ast::ident], blk: ast::Block) -> @ast::expr { + fn lambda(&self, span: Span, ids: ~[ast::ident], blk: ast::Block) -> @ast::expr { let fn_decl = self.fn_decl( ids.map(|id| self.arg(span, *id, self.ty_infer(span))), self.ty_infer(span)); @@ -646,50 +646,50 @@ impl AstBuilder for @ExtCtxt { self.expr(span, ast::expr_fn_block(fn_decl, blk)) } #[cfg(stage0)] - fn lambda0(&self, _span: span, blk: ast::Block) -> @ast::expr { + fn lambda0(&self, _span: Span, blk: ast::Block) -> @ast::expr { let ext_cx = *self; let blk_e = self.expr(blk.span, ast::expr_block(blk.clone())); quote_expr!(|| $blk_e ) } #[cfg(not(stage0))] - fn lambda0(&self, _span: span, blk: ast::Block) -> @ast::expr { + fn lambda0(&self, _span: Span, blk: ast::Block) -> @ast::expr { let blk_e = self.expr(blk.span, ast::expr_block(blk.clone())); quote_expr!(*self, || $blk_e ) } #[cfg(stage0)] - fn lambda1(&self, _span: span, blk: ast::Block, ident: ast::ident) -> @ast::expr { + fn lambda1(&self, _span: Span, blk: ast::Block, ident: ast::ident) -> @ast::expr { let ext_cx = *self; let blk_e = self.expr(blk.span, ast::expr_block(blk.clone())); quote_expr!(|$ident| $blk_e ) } #[cfg(not(stage0))] - fn lambda1(&self, _span: span, blk: ast::Block, ident: ast::ident) -> @ast::expr { + fn lambda1(&self, _span: Span, blk: ast::Block, ident: ast::ident) -> @ast::expr { let blk_e = self.expr(blk.span, ast::expr_block(blk.clone())); quote_expr!(*self, |$ident| $blk_e ) } - fn lambda_expr(&self, span: span, ids: ~[ast::ident], expr: @ast::expr) -> @ast::expr { + fn lambda_expr(&self, span: Span, ids: ~[ast::ident], expr: @ast::expr) -> @ast::expr { self.lambda(span, ids, self.block_expr(expr)) } - fn lambda_expr_0(&self, span: span, expr: @ast::expr) -> @ast::expr { + fn lambda_expr_0(&self, span: Span, expr: @ast::expr) -> @ast::expr { self.lambda0(span, self.block_expr(expr)) } - fn lambda_expr_1(&self, span: span, expr: @ast::expr, ident: ast::ident) -> @ast::expr { + fn lambda_expr_1(&self, span: Span, expr: @ast::expr, ident: ast::ident) -> @ast::expr { self.lambda1(span, self.block_expr(expr), ident) } - fn lambda_stmts(&self, span: span, ids: ~[ast::ident], stmts: ~[@ast::stmt]) -> @ast::expr { + fn lambda_stmts(&self, span: Span, ids: ~[ast::ident], stmts: ~[@ast::stmt]) -> @ast::expr { self.lambda(span, ids, self.block(span, stmts, None)) } - fn lambda_stmts_0(&self, span: span, stmts: ~[@ast::stmt]) -> @ast::expr { + fn lambda_stmts_0(&self, span: Span, stmts: ~[@ast::stmt]) -> @ast::expr { self.lambda0(span, self.block(span, stmts, None)) } - fn lambda_stmts_1(&self, span: span, stmts: ~[@ast::stmt], ident: ast::ident) -> @ast::expr { + fn lambda_stmts_1(&self, span: Span, stmts: ~[@ast::stmt], ident: ast::ident) -> @ast::expr { self.lambda1(span, self.block(span, stmts, None), ident) } - fn arg(&self, span: span, ident: ast::ident, ty: ast::Ty) -> ast::arg { + fn arg(&self, span: Span, ident: ast::ident, ty: ast::Ty) -> ast::arg { let arg_pat = self.pat_ident(span, ident); ast::arg { is_mutbl: false, @@ -708,7 +708,7 @@ impl AstBuilder for @ExtCtxt { } } - fn item(&self, span: span, + fn item(&self, span: Span, name: ident, attrs: ~[ast::Attribute], node: ast::item_) -> @ast::item { // XXX: Would be nice if our generated code didn't violate // Rust coding conventions @@ -721,7 +721,7 @@ impl AstBuilder for @ExtCtxt { } fn item_fn_poly(&self, - span: span, + span: Span, name: ident, inputs: ~[ast::arg], output: ast::Ty, @@ -738,7 +738,7 @@ impl AstBuilder for @ExtCtxt { } fn item_fn(&self, - span: span, + span: Span, name: ident, inputs: ~[ast::arg], output: ast::Ty, @@ -753,7 +753,7 @@ impl AstBuilder for @ExtCtxt { body) } - fn variant(&self, span: span, name: ident, tys: ~[ast::Ty]) -> ast::variant { + fn variant(&self, span: Span, name: ident, tys: ~[ast::Ty]) -> ast::variant { let args = tys.move_iter().map(|ty| { ast::variant_arg { ty: ty, id: self.next_id() } }).collect(); @@ -769,13 +769,13 @@ impl AstBuilder for @ExtCtxt { }) } - fn item_enum_poly(&self, span: span, name: ident, + fn item_enum_poly(&self, span: Span, name: ident, enum_definition: ast::enum_def, generics: Generics) -> @ast::item { self.item(span, name, ~[], ast::item_enum(enum_definition, generics)) } - fn item_enum(&self, span: span, name: ident, + fn item_enum(&self, span: Span, name: ident, enum_definition: ast::enum_def) -> @ast::item { self.item_enum_poly(span, name, enum_definition, ast_util::empty_generics()) @@ -783,7 +783,7 @@ impl AstBuilder for @ExtCtxt { fn item_struct( &self, - span: span, + span: Span, name: ident, struct_def: ast::struct_def ) -> @ast::item { @@ -797,7 +797,7 @@ impl AstBuilder for @ExtCtxt { fn item_struct_poly( &self, - span: span, + span: Span, name: ident, struct_def: ast::struct_def, generics: Generics @@ -805,7 +805,7 @@ impl AstBuilder for @ExtCtxt { self.item(span, name, ~[], ast::item_struct(@struct_def, generics)) } - fn item_mod(&self, span: span, name: ident, + fn item_mod(&self, span: Span, name: ident, attrs: ~[ast::Attribute], vi: ~[ast::view_item], items: ~[@ast::item]) -> @ast::item { @@ -820,16 +820,16 @@ impl AstBuilder for @ExtCtxt { ) } - fn item_ty_poly(&self, span: span, name: ident, ty: ast::Ty, + fn item_ty_poly(&self, span: Span, name: ident, ty: ast::Ty, generics: Generics) -> @ast::item { self.item(span, name, ~[], ast::item_ty(ty, generics)) } - fn item_ty(&self, span: span, name: ident, ty: ast::Ty) -> @ast::item { + fn item_ty(&self, span: Span, name: ident, ty: ast::Ty) -> @ast::item { self.item_ty_poly(span, name, ty, ast_util::empty_generics()) } - fn attribute(&self, sp: span, mi: @ast::MetaItem) -> ast::Attribute { + fn attribute(&self, sp: Span, mi: @ast::MetaItem) -> ast::Attribute { respan(sp, ast::Attribute_ { style: ast::AttrOuter, value: mi, @@ -837,17 +837,17 @@ impl AstBuilder for @ExtCtxt { }) } - fn meta_word(&self, sp: span, w: @str) -> @ast::MetaItem { + fn meta_word(&self, sp: Span, w: @str) -> @ast::MetaItem { @respan(sp, ast::MetaWord(w)) } - fn meta_list(&self, sp: span, name: @str, mis: ~[@ast::MetaItem]) -> @ast::MetaItem { + fn meta_list(&self, sp: Span, name: @str, mis: ~[@ast::MetaItem]) -> @ast::MetaItem { @respan(sp, ast::MetaList(name, mis)) } - fn meta_name_value(&self, sp: span, name: @str, value: ast::lit_) -> @ast::MetaItem { + fn meta_name_value(&self, sp: Span, name: @str, value: ast::lit_) -> @ast::MetaItem { @respan(sp, ast::MetaNameValue(name, respan(sp, value))) } - fn view_use(&self, sp: span, + fn view_use(&self, sp: Span, vis: ast::visibility, vp: ~[@ast::view_path]) -> ast::view_item { ast::view_item { node: ast::view_item_use(vp), @@ -857,7 +857,7 @@ impl AstBuilder for @ExtCtxt { } } - fn view_use_list(&self, sp: span, vis: ast::visibility, + fn view_use_list(&self, sp: Span, vis: ast::visibility, path: ~[ast::ident], imports: &[ast::ident]) -> ast::view_item { let imports = do imports.map |id| { respan(sp, ast::path_list_ident_ { name: *id, id: self.next_id() }) @@ -870,7 +870,7 @@ impl AstBuilder for @ExtCtxt { self.next_id()))]) } - fn view_use_glob(&self, sp: span, + fn view_use_glob(&self, sp: Span, vis: ast::visibility, path: ~[ast::ident]) -> ast::view_item { self.view_use(sp, vis, ~[@respan(sp, diff --git a/src/libsyntax/ext/bytes.rs b/src/libsyntax/ext/bytes.rs index 8d2d2432736..1c8f582e7ee 100644 --- a/src/libsyntax/ext/bytes.rs +++ b/src/libsyntax/ext/bytes.rs @@ -11,12 +11,12 @@ /* The compiler code necessary to support the bytes! extension. */ use ast; -use codemap::span; +use codemap::Span; use ext::base::*; use ext::base; use ext::build::AstBuilder; -pub fn expand_syntax_ext(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) -> base::MacResult { +pub fn expand_syntax_ext(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> base::MacResult { // Gather all argument expressions let exprs = get_exprs_from_tts(cx, sp, tts); let mut bytes = ~[]; diff --git a/src/libsyntax/ext/cfg.rs b/src/libsyntax/ext/cfg.rs index 5f9437fd253..89e7994530d 100644 --- a/src/libsyntax/ext/cfg.rs +++ b/src/libsyntax/ext/cfg.rs @@ -15,7 +15,7 @@ match the current compilation environment. */ use ast; -use codemap::span; +use codemap::Span; use ext::base::*; use ext::base; use ext::build::AstBuilder; @@ -25,7 +25,7 @@ use parse; use parse::token; use parse::attr::parser_attr; -pub fn expand_cfg(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) -> base::MacResult { +pub fn expand_cfg(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> base::MacResult { let p = parse::new_parser_from_tts(cx.parse_sess(), cx.cfg(), tts.to_owned()); let mut cfgs = ~[]; diff --git a/src/libsyntax/ext/concat_idents.rs b/src/libsyntax/ext/concat_idents.rs index 477f3fde99c..5354a4e2469 100644 --- a/src/libsyntax/ext/concat_idents.rs +++ b/src/libsyntax/ext/concat_idents.rs @@ -9,14 +9,14 @@ // except according to those terms. use ast; -use codemap::span; +use codemap::Span; use ext::base::*; use ext::base; use opt_vec; use parse::token; use parse::token::{str_to_ident}; -pub fn expand_syntax_ext(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) +pub fn expand_syntax_ext(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> base::MacResult { let mut res_str = ~""; for (i, e) in tts.iter().enumerate() { diff --git a/src/libsyntax/ext/deriving/clone.rs b/src/libsyntax/ext/deriving/clone.rs index 02dcb2cdbc9..01cf61f45a4 100644 --- a/src/libsyntax/ext/deriving/clone.rs +++ b/src/libsyntax/ext/deriving/clone.rs @@ -9,13 +9,13 @@ // except according to those terms. use ast::{MetaItem, item, expr}; -use codemap::span; +use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; use ext::deriving::generic::*; pub fn expand_deriving_clone(cx: @ExtCtxt, - span: span, + span: Span, mitem: @MetaItem, in_items: ~[@item]) -> ~[@item] { @@ -40,7 +40,7 @@ pub fn expand_deriving_clone(cx: @ExtCtxt, } pub fn expand_deriving_deep_clone(cx: @ExtCtxt, - span: span, + span: Span, mitem: @MetaItem, in_items: ~[@item]) -> ~[@item] { @@ -68,7 +68,7 @@ pub fn expand_deriving_deep_clone(cx: @ExtCtxt, fn cs_clone( name: &str, - cx: @ExtCtxt, span: span, + cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr { let clone_ident = substr.method_ident; let ctor_ident; diff --git a/src/libsyntax/ext/deriving/cmp/eq.rs b/src/libsyntax/ext/deriving/cmp/eq.rs index a7d9db59130..ce2b9ba7894 100644 --- a/src/libsyntax/ext/deriving/cmp/eq.rs +++ b/src/libsyntax/ext/deriving/cmp/eq.rs @@ -9,22 +9,22 @@ // except according to those terms. use ast::{MetaItem, item, expr}; -use codemap::span; +use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; use ext::deriving::generic::*; pub fn expand_deriving_eq(cx: @ExtCtxt, - span: span, + span: Span, mitem: @MetaItem, in_items: ~[@item]) -> ~[@item] { // structures are equal if all fields are equal, and non equal, if // any fields are not equal or if the enum variants are different - fn cs_eq(cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr { + fn cs_eq(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr { cs_and(|cx, span, _, _| cx.expr_bool(span, false), cx, span, substr) } - fn cs_ne(cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr { + fn cs_ne(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr { cs_or(|cx, span, _, _| cx.expr_bool(span, true), cx, span, substr) } diff --git a/src/libsyntax/ext/deriving/cmp/ord.rs b/src/libsyntax/ext/deriving/cmp/ord.rs index d532eedd291..3f7492bb6b6 100644 --- a/src/libsyntax/ext/deriving/cmp/ord.rs +++ b/src/libsyntax/ext/deriving/cmp/ord.rs @@ -10,13 +10,13 @@ use ast; use ast::{MetaItem, item, expr}; -use codemap::span; +use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; use ext::deriving::generic::*; pub fn expand_deriving_ord(cx: @ExtCtxt, - span: span, + span: Span, mitem: @MetaItem, in_items: ~[@item]) -> ~[@item] { macro_rules! md ( @@ -48,7 +48,7 @@ pub fn expand_deriving_ord(cx: @ExtCtxt, } /// Strict inequality. -fn cs_op(less: bool, equal: bool, cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr { +fn cs_op(less: bool, equal: bool, cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr { let op = if less {ast::lt} else {ast::gt}; cs_fold( false, // need foldr, diff --git a/src/libsyntax/ext/deriving/cmp/totaleq.rs b/src/libsyntax/ext/deriving/cmp/totaleq.rs index 8285de1d561..97b7464b3b5 100644 --- a/src/libsyntax/ext/deriving/cmp/totaleq.rs +++ b/src/libsyntax/ext/deriving/cmp/totaleq.rs @@ -9,16 +9,16 @@ // except according to those terms. use ast::{MetaItem, item, expr}; -use codemap::span; +use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; use ext::deriving::generic::*; pub fn expand_deriving_totaleq(cx: @ExtCtxt, - span: span, + span: Span, mitem: @MetaItem, in_items: ~[@item]) -> ~[@item] { - fn cs_equals(cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr { + fn cs_equals(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr { cs_and(|cx, span, _, _| cx.expr_bool(span, false), cx, span, substr) } diff --git a/src/libsyntax/ext/deriving/cmp/totalord.rs b/src/libsyntax/ext/deriving/cmp/totalord.rs index 001e9235528..8f520ff6c33 100644 --- a/src/libsyntax/ext/deriving/cmp/totalord.rs +++ b/src/libsyntax/ext/deriving/cmp/totalord.rs @@ -10,14 +10,14 @@ use ast; use ast::{MetaItem, item, expr}; -use codemap::span; +use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; use ext::deriving::generic::*; use std::cmp::{Ordering, Equal, Less, Greater}; pub fn expand_deriving_totalord(cx: @ExtCtxt, - span: span, + span: Span, mitem: @MetaItem, in_items: ~[@item]) -> ~[@item] { let trait_def = TraitDef { @@ -41,7 +41,7 @@ pub fn expand_deriving_totalord(cx: @ExtCtxt, } -pub fn ordering_const(cx: @ExtCtxt, span: span, cnst: Ordering) -> ast::Path { +pub fn ordering_const(cx: @ExtCtxt, span: Span, cnst: Ordering) -> ast::Path { let cnst = match cnst { Less => "Less", Equal => "Equal", @@ -53,7 +53,7 @@ pub fn ordering_const(cx: @ExtCtxt, span: span, cnst: Ordering) -> ast::Path { cx.ident_of(cnst)]) } -pub fn cs_cmp(cx: @ExtCtxt, span: span, +pub fn cs_cmp(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr { let test_id = cx.ident_of("__test"); let equals_path = ordering_const(cx, span, Equal); diff --git a/src/libsyntax/ext/deriving/decodable.rs b/src/libsyntax/ext/deriving/decodable.rs index 1abfe246f9d..6a2cddb3583 100644 --- a/src/libsyntax/ext/deriving/decodable.rs +++ b/src/libsyntax/ext/deriving/decodable.rs @@ -16,13 +16,13 @@ encodable.rs for more. use std::vec; use ast::{MetaItem, item, expr, m_mutbl}; -use codemap::span; +use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; use ext::deriving::generic::*; pub fn expand_deriving_decodable(cx: @ExtCtxt, - span: span, + span: Span, mitem: @MetaItem, in_items: ~[@item]) -> ~[@item] { let trait_def = TraitDef { @@ -50,7 +50,7 @@ pub fn expand_deriving_decodable(cx: @ExtCtxt, trait_def.expand(cx, span, mitem, in_items) } -fn decodable_substructure(cx: @ExtCtxt, span: span, +fn decodable_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr { let decoder = substr.nonself_args[0]; let recurse = ~[cx.ident_of("extra"), diff --git a/src/libsyntax/ext/deriving/encodable.rs b/src/libsyntax/ext/deriving/encodable.rs index f16fea7bb06..ee7863bc270 100644 --- a/src/libsyntax/ext/deriving/encodable.rs +++ b/src/libsyntax/ext/deriving/encodable.rs @@ -44,7 +44,7 @@ Other interesting scenarios are whe the item has type parameters or references other non-built-in types. A type definition like: #[deriving(Encodable, Decodable)] - struct spanned<T> {node: T, span: span} + struct spanned<T> {node: T, span: Span} would yield functions like: @@ -76,13 +76,13 @@ would yield functions like: */ use ast::{MetaItem, item, expr, m_imm, m_mutbl}; -use codemap::span; +use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; use ext::deriving::generic::*; pub fn expand_deriving_encodable(cx: @ExtCtxt, - span: span, + span: Span, mitem: @MetaItem, in_items: ~[@item]) -> ~[@item] { let trait_def = TraitDef { @@ -110,7 +110,7 @@ pub fn expand_deriving_encodable(cx: @ExtCtxt, trait_def.expand(cx, span, mitem, in_items) } -fn encodable_substructure(cx: @ExtCtxt, span: span, +fn encodable_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr { let encoder = substr.nonself_args[0]; // throw an underscore in front to suppress unused variable warnings diff --git a/src/libsyntax/ext/deriving/generic.rs b/src/libsyntax/ext/deriving/generic.rs index 6b028e25c0f..c8853e36cdd 100644 --- a/src/libsyntax/ext/deriving/generic.rs +++ b/src/libsyntax/ext/deriving/generic.rs @@ -167,7 +167,7 @@ use ast::{enum_def, expr, ident, Generics, struct_def}; use ext::base::ExtCtxt; use ext::build::AstBuilder; -use codemap::{span,respan}; +use codemap::{Span,respan}; use opt_vec; use std::vec; @@ -263,7 +263,7 @@ Combine the values of all the fields together. The last argument is all the fields of all the structures, see above for details. */ pub type CombineSubstructureFunc<'self> = - &'self fn(@ExtCtxt, span, &Substructure) -> @expr; + &'self fn(@ExtCtxt, Span, &Substructure) -> @expr; /** Deal with non-matching enum variants, the arguments are a list @@ -271,7 +271,7 @@ representing each variant: (variant index, ast::variant instance, [variant fields]), and a list of the nonself args of the type */ pub type EnumNonMatchFunc<'self> = - &'self fn(@ExtCtxt, span, + &'self fn(@ExtCtxt, Span, &[(uint, ast::variant, ~[(Option<ident>, @expr)])], &[@expr]) -> @expr; @@ -279,7 +279,7 @@ pub type EnumNonMatchFunc<'self> = impl<'self> TraitDef<'self> { pub fn expand(&self, cx: @ExtCtxt, - span: span, + span: Span, _mitem: @ast::MetaItem, in_items: ~[@ast::item]) -> ~[@ast::item] { let mut result = ~[]; @@ -314,7 +314,7 @@ impl<'self> TraitDef<'self> { * where B1, B2, ... are the bounds given by `bounds_paths`.' * */ - fn create_derived_impl(&self, cx: @ExtCtxt, span: span, + fn create_derived_impl(&self, cx: @ExtCtxt, span: Span, type_ident: ident, generics: &Generics, methods: ~[@ast::method]) -> @ast::item { let trait_path = self.path.to_path(cx, span, type_ident, generics); @@ -373,7 +373,7 @@ impl<'self> TraitDef<'self> { } fn expand_struct_def(&self, cx: @ExtCtxt, - span: span, + span: Span, struct_def: &struct_def, type_ident: ident, generics: &Generics) -> @ast::item { @@ -404,7 +404,7 @@ impl<'self> TraitDef<'self> { } fn expand_enum_def(&self, - cx: @ExtCtxt, span: span, + cx: @ExtCtxt, span: Span, enum_def: &enum_def, type_ident: ident, generics: &Generics) -> @ast::item { @@ -438,7 +438,7 @@ impl<'self> TraitDef<'self> { impl<'self> MethodDef<'self> { fn call_substructure_method(&self, cx: @ExtCtxt, - span: span, + span: Span, type_ident: ident, self_args: &[@expr], nonself_args: &[@expr], @@ -455,7 +455,7 @@ impl<'self> MethodDef<'self> { &substructure) } - fn get_ret_ty(&self, cx: @ExtCtxt, span: span, + fn get_ret_ty(&self, cx: @ExtCtxt, span: Span, generics: &Generics, type_ident: ident) -> ast::Ty { self.ret_ty.to_ty(cx, span, type_ident, generics) } @@ -464,7 +464,7 @@ impl<'self> MethodDef<'self> { self.explicit_self.is_none() } - fn split_self_nonself_args(&self, cx: @ExtCtxt, span: span, + fn split_self_nonself_args(&self, cx: @ExtCtxt, span: Span, type_ident: ident, generics: &Generics) -> (ast::explicit_self, ~[@expr], ~[@expr], ~[(ident, ast::Ty)]) { @@ -510,7 +510,7 @@ impl<'self> MethodDef<'self> { (ast_explicit_self, self_args, nonself_args, arg_tys) } - fn create_method(&self, cx: @ExtCtxt, span: span, + fn create_method(&self, cx: @ExtCtxt, span: Span, type_ident: ident, generics: &Generics, explicit_self: ast::explicit_self, @@ -569,7 +569,7 @@ impl<'self> MethodDef<'self> { */ fn expand_struct_method_body(&self, cx: @ExtCtxt, - span: span, + span: Span, struct_def: &struct_def, type_ident: ident, self_args: &[@expr], @@ -623,7 +623,7 @@ impl<'self> MethodDef<'self> { fn expand_static_struct_method_body(&self, cx: @ExtCtxt, - span: span, + span: Span, struct_def: &struct_def, type_ident: ident, self_args: &[@expr], @@ -665,7 +665,7 @@ impl<'self> MethodDef<'self> { */ fn expand_enum_method_body(&self, cx: @ExtCtxt, - span: span, + span: Span, enum_def: &enum_def, type_ident: ident, self_args: &[@expr], @@ -700,7 +700,7 @@ impl<'self> MethodDef<'self> { the first call). */ fn build_enum_match(&self, - cx: @ExtCtxt, span: span, + cx: @ExtCtxt, span: Span, enum_def: &enum_def, type_ident: ident, self_args: &[@expr], @@ -850,7 +850,7 @@ impl<'self> MethodDef<'self> { fn expand_static_enum_method_body(&self, cx: @ExtCtxt, - span: span, + span: Span, enum_def: &enum_def, type_ident: ident, self_args: &[@expr], @@ -873,7 +873,7 @@ impl<'self> MethodDef<'self> { } } -fn summarise_struct(cx: @ExtCtxt, span: span, +fn summarise_struct(cx: @ExtCtxt, span: Span, struct_def: &struct_def) -> Either<uint, ~[ident]> { let mut named_idents = ~[]; let mut unnamed_count = 0; @@ -896,7 +896,7 @@ fn summarise_struct(cx: @ExtCtxt, span: span, } pub fn create_subpatterns(cx: @ExtCtxt, - span: span, + span: Span, field_paths: ~[ast::Path], mutbl: ast::mutability) -> ~[@ast::pat] { @@ -912,7 +912,7 @@ enum StructType { } fn create_struct_pattern(cx: @ExtCtxt, - span: span, + span: Span, struct_ident: ident, struct_def: &struct_def, prefix: &str, @@ -973,7 +973,7 @@ fn create_struct_pattern(cx: @ExtCtxt, } fn create_enum_variant_pattern(cx: @ExtCtxt, - span: span, + span: Span, variant: &ast::variant, prefix: &str, mutbl: ast::mutability) @@ -1022,13 +1022,13 @@ Fold the fields. `use_foldl` controls whether this is done left-to-right (`true`) or right-to-left (`false`). */ pub fn cs_fold(use_foldl: bool, - f: &fn(@ExtCtxt, span, + f: &fn(@ExtCtxt, Span, old: @expr, self_f: @expr, other_fs: &[@expr]) -> @expr, base: @expr, enum_nonmatch_f: EnumNonMatchFunc, - cx: @ExtCtxt, span: span, + cx: @ExtCtxt, span: Span, substructure: &Substructure) -> @expr { match *substructure.fields { EnumMatching(_, _, ref all_fields) | Struct(ref all_fields) => { @@ -1064,9 +1064,9 @@ f(cx, span, ~[self_1.method(__arg_1_1, __arg_2_1), ~~~ */ #[inline] -pub fn cs_same_method(f: &fn(@ExtCtxt, span, ~[@expr]) -> @expr, +pub fn cs_same_method(f: &fn(@ExtCtxt, Span, ~[@expr]) -> @expr, enum_nonmatch_f: EnumNonMatchFunc, - cx: @ExtCtxt, span: span, + cx: @ExtCtxt, span: Span, substructure: &Substructure) -> @expr { match *substructure.fields { EnumMatching(_, _, ref all_fields) | Struct(ref all_fields) => { @@ -1097,10 +1097,10 @@ fields. `use_foldl` controls whether this is done left-to-right */ #[inline] pub fn cs_same_method_fold(use_foldl: bool, - f: &fn(@ExtCtxt, span, @expr, @expr) -> @expr, + f: &fn(@ExtCtxt, Span, @expr, @expr) -> @expr, base: @expr, enum_nonmatch_f: EnumNonMatchFunc, - cx: @ExtCtxt, span: span, + cx: @ExtCtxt, span: Span, substructure: &Substructure) -> @expr { cs_same_method( |cx, span, vals| { @@ -1126,7 +1126,7 @@ on all the fields. #[inline] pub fn cs_binop(binop: ast::binop, base: @expr, enum_nonmatch_f: EnumNonMatchFunc, - cx: @ExtCtxt, span: span, + cx: @ExtCtxt, span: Span, substructure: &Substructure) -> @expr { cs_same_method_fold( true, // foldl is good enough @@ -1144,7 +1144,7 @@ pub fn cs_binop(binop: ast::binop, base: @expr, /// cs_binop with binop == or #[inline] pub fn cs_or(enum_nonmatch_f: EnumNonMatchFunc, - cx: @ExtCtxt, span: span, + cx: @ExtCtxt, span: Span, substructure: &Substructure) -> @expr { cs_binop(ast::or, cx.expr_bool(span, false), enum_nonmatch_f, @@ -1153,7 +1153,7 @@ pub fn cs_or(enum_nonmatch_f: EnumNonMatchFunc, /// cs_binop with binop == and #[inline] pub fn cs_and(enum_nonmatch_f: EnumNonMatchFunc, - cx: @ExtCtxt, span: span, + cx: @ExtCtxt, span: Span, substructure: &Substructure) -> @expr { cs_binop(ast::and, cx.expr_bool(span, true), enum_nonmatch_f, diff --git a/src/libsyntax/ext/deriving/iter_bytes.rs b/src/libsyntax/ext/deriving/iter_bytes.rs index b0f442ee638..4dd628ca7b0 100644 --- a/src/libsyntax/ext/deriving/iter_bytes.rs +++ b/src/libsyntax/ext/deriving/iter_bytes.rs @@ -9,14 +9,14 @@ // except according to those terms. use ast::{MetaItem, item, expr, and}; -use codemap::span; +use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; use ext::deriving::generic::*; pub fn expand_deriving_iter_bytes(cx: @ExtCtxt, - span: span, + span: Span, mitem: @MetaItem, in_items: ~[@item]) -> ~[@item] { let trait_def = TraitDef { @@ -42,7 +42,7 @@ pub fn expand_deriving_iter_bytes(cx: @ExtCtxt, trait_def.expand(cx, span, mitem, in_items) } -fn iter_bytes_substructure(cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr { +fn iter_bytes_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr { let (lsb0, f)= match substr.nonself_args { [l, f] => (l, f), _ => cx.span_bug(span, "Incorrect number of arguments in `deriving(IterBytes)`") diff --git a/src/libsyntax/ext/deriving/mod.rs b/src/libsyntax/ext/deriving/mod.rs index cde7dcc5dbe..0123044478c 100644 --- a/src/libsyntax/ext/deriving/mod.rs +++ b/src/libsyntax/ext/deriving/mod.rs @@ -22,7 +22,7 @@ use ast::{enum_def, ident, item, Generics, struct_def}; use ast::{MetaItem, MetaList, MetaNameValue, MetaWord}; use ext::base::ExtCtxt; use ext::build::AstBuilder; -use codemap::span; +use codemap::Span; pub mod clone; pub mod iter_bytes; @@ -45,20 +45,20 @@ pub mod totalord; pub mod generic; pub type ExpandDerivingStructDefFn<'self> = &'self fn(@ExtCtxt, - span, + Span, x: &struct_def, ident, y: &Generics) -> @item; pub type ExpandDerivingEnumDefFn<'self> = &'self fn(@ExtCtxt, - span, + Span, x: &enum_def, ident, y: &Generics) -> @item; pub fn expand_meta_deriving(cx: @ExtCtxt, - _span: span, + _span: Span, mitem: @MetaItem, in_items: ~[@item]) -> ~[@item] { diff --git a/src/libsyntax/ext/deriving/rand.rs b/src/libsyntax/ext/deriving/rand.rs index b8cf3de635f..485df6084a8 100644 --- a/src/libsyntax/ext/deriving/rand.rs +++ b/src/libsyntax/ext/deriving/rand.rs @@ -10,7 +10,7 @@ use ast; use ast::{MetaItem, item, expr, ident}; -use codemap::span; +use codemap::Span; use ext::base::ExtCtxt; use ext::build::{AstBuilder, Duplicate}; use ext::deriving::generic::*; @@ -18,7 +18,7 @@ use ext::deriving::generic::*; use std::vec; pub fn expand_deriving_rand(cx: @ExtCtxt, - span: span, + span: Span, mitem: @MetaItem, in_items: ~[@item]) -> ~[@item] { @@ -48,7 +48,7 @@ pub fn expand_deriving_rand(cx: @ExtCtxt, trait_def.expand(cx, span, mitem, in_items) } -fn rand_substructure(cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr { +fn rand_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr { let rng = match substr.nonself_args { [rng] => ~[ rng ], _ => cx.bug("Incorrect number of arguments to `rand` in `deriving(Rand)`") @@ -128,7 +128,7 @@ fn rand_substructure(cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr { _ => cx.bug("Non-static method in `deriving(Rand)`") }; - fn rand_thing(cx: @ExtCtxt, span: span, + fn rand_thing(cx: @ExtCtxt, span: Span, ctor_ident: ident, summary: &Either<uint, ~[ident]>, rand_call: &fn() -> @expr) -> @expr { diff --git a/src/libsyntax/ext/deriving/to_str.rs b/src/libsyntax/ext/deriving/to_str.rs index 3425352ff0c..1b136983de8 100644 --- a/src/libsyntax/ext/deriving/to_str.rs +++ b/src/libsyntax/ext/deriving/to_str.rs @@ -10,13 +10,13 @@ use ast; use ast::{MetaItem, item, expr}; -use codemap::span; +use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; use ext::deriving::generic::*; pub fn expand_deriving_to_str(cx: @ExtCtxt, - span: span, + span: Span, mitem: @MetaItem, in_items: ~[@item]) -> ~[@item] { @@ -43,7 +43,7 @@ pub fn expand_deriving_to_str(cx: @ExtCtxt, // std::sys::log_str, but this isn't sufficient because it doesn't invoke the // to_str() method on each field. Hence we mirror the logic of the log_str() // method, but with tweaks to call to_str() on sub-fields. -fn to_str_substructure(cx: @ExtCtxt, span: span, +fn to_str_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr { let to_str = cx.ident_of("to_str"); diff --git a/src/libsyntax/ext/deriving/ty.rs b/src/libsyntax/ext/deriving/ty.rs index 255bc6c9877..f0b22d9b288 100644 --- a/src/libsyntax/ext/deriving/ty.rs +++ b/src/libsyntax/ext/deriving/ty.rs @@ -17,7 +17,7 @@ use ast; use ast::{expr,Generics,ident}; use ext::base::ExtCtxt; use ext::build::AstBuilder; -use codemap::{span,respan}; +use codemap::{Span,respan}; use opt_vec; /// The types of pointers @@ -58,7 +58,7 @@ impl<'self> Path<'self> { pub fn to_ty(&self, cx: @ExtCtxt, - span: span, + span: Span, self_ty: ident, self_generics: &Generics) -> ast::Ty { @@ -66,7 +66,7 @@ impl<'self> Path<'self> { } pub fn to_path(&self, cx: @ExtCtxt, - span: span, + span: Span, self_ty: ident, self_generics: &Generics) -> ast::Path { @@ -109,7 +109,7 @@ pub fn nil_ty() -> Ty<'static> { Tuple(~[]) } -fn mk_lifetime(cx: @ExtCtxt, span: span, lt: &Option<&str>) -> Option<ast::Lifetime> { +fn mk_lifetime(cx: @ExtCtxt, span: Span, lt: &Option<&str>) -> Option<ast::Lifetime> { match *lt { Some(ref s) => Some(cx.lifetime(span, cx.ident_of(*s))), None => None @@ -119,7 +119,7 @@ fn mk_lifetime(cx: @ExtCtxt, span: span, lt: &Option<&str>) -> Option<ast::Lifet impl<'self> Ty<'self> { pub fn to_ty(&self, cx: @ExtCtxt, - span: span, + span: Span, self_ty: ident, self_generics: &Generics) -> ast::Ty { @@ -157,7 +157,7 @@ impl<'self> Ty<'self> { pub fn to_path(&self, cx: @ExtCtxt, - span: span, + span: Span, self_ty: ident, self_generics: &Generics) -> ast::Path { @@ -185,7 +185,7 @@ impl<'self> Ty<'self> { } -fn mk_ty_param(cx: @ExtCtxt, span: span, name: &str, bounds: &[Path], +fn mk_ty_param(cx: @ExtCtxt, span: Span, name: &str, bounds: &[Path], self_ident: ident, self_generics: &Generics) -> ast::TyParam { let bounds = opt_vec::from( do bounds.map |b| { @@ -216,7 +216,7 @@ impl<'self> LifetimeBounds<'self> { } pub fn to_generics(&self, cx: @ExtCtxt, - span: span, + span: Span, self_ty: ident, self_generics: &Generics) -> Generics { @@ -235,7 +235,7 @@ impl<'self> LifetimeBounds<'self> { } -pub fn get_explicit_self(cx: @ExtCtxt, span: span, self_ptr: &Option<PtrTy>) +pub fn get_explicit_self(cx: @ExtCtxt, span: Span, self_ptr: &Option<PtrTy>) -> (@expr, ast::explicit_self) { let self_path = cx.expr_self(span); match *self_ptr { diff --git a/src/libsyntax/ext/deriving/zero.rs b/src/libsyntax/ext/deriving/zero.rs index 3c9e842473c..f9cd1b4b35b 100644 --- a/src/libsyntax/ext/deriving/zero.rs +++ b/src/libsyntax/ext/deriving/zero.rs @@ -9,7 +9,7 @@ // except according to those terms. use ast::{MetaItem, item, expr}; -use codemap::span; +use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; use ext::deriving::generic::*; @@ -17,7 +17,7 @@ use ext::deriving::generic::*; use std::vec; pub fn expand_deriving_zero(cx: @ExtCtxt, - span: span, + span: Span, mitem: @MetaItem, in_items: ~[@item]) -> ~[@item] { @@ -55,7 +55,7 @@ pub fn expand_deriving_zero(cx: @ExtCtxt, trait_def.expand(cx, span, mitem, in_items) } -fn zero_substructure(cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr { +fn zero_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr { let zero_ident = ~[ cx.ident_of("std"), cx.ident_of("num"), diff --git a/src/libsyntax/ext/env.rs b/src/libsyntax/ext/env.rs index d906f8f4518..ac8a7d513dd 100644 --- a/src/libsyntax/ext/env.rs +++ b/src/libsyntax/ext/env.rs @@ -15,7 +15,7 @@ */ use ast; -use codemap::span; +use codemap::Span; use ext::base::*; use ext::base; use ext::build::AstBuilder; @@ -23,7 +23,7 @@ use ext::build::AstBuilder; use std::os; #[cfg(stage0)] -pub fn expand_option_env(ext_cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) +pub fn expand_option_env(ext_cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> base::MacResult { let var = get_single_str_from_tts(ext_cx, sp, tts, "option_env!"); @@ -34,7 +34,7 @@ pub fn expand_option_env(ext_cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) MRExpr(e) } #[cfg(not(stage0))] -pub fn expand_option_env(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) +pub fn expand_option_env(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> base::MacResult { let var = get_single_str_from_tts(cx, sp, tts, "option_env!"); @@ -45,7 +45,7 @@ pub fn expand_option_env(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) MRExpr(e) } -pub fn expand_env(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) +pub fn expand_env(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> base::MacResult { let exprs = get_exprs_from_tts(cx, sp, tts); diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 86639c6f121..eb1eaffe757 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -16,7 +16,7 @@ use ast_util::{new_rename, new_mark, resolve}; use attr; use attr::AttrMetaMethods; use codemap; -use codemap::{span, spanned, ExpnInfo, NameAndSpan}; +use codemap::{Span, Spanned, spanned, ExpnInfo, NameAndSpan}; use ext::base::*; use fold::*; use opt_vec; @@ -32,10 +32,10 @@ use std::vec; pub fn expand_expr(extsbox: @mut SyntaxEnv, cx: @ExtCtxt, e: &expr_, - s: span, + s: Span, fld: @ast_fold, - orig: @fn(&expr_, span, @ast_fold) -> (expr_, span)) - -> (expr_, span) { + orig: @fn(&expr_, Span, @ast_fold) -> (expr_, Span)) + -> (expr_, Span) { match *e { // expr_mac should really be expr_ext or something; it's the // entry-point for all syntax extensions. @@ -117,7 +117,7 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv, let lo = s.lo; let hi = s.hi; - pub fn mk_expr(cx: @ExtCtxt, span: span, + pub fn mk_expr(cx: @ExtCtxt, span: Span, node: expr_) -> @ast::expr { @ast::expr { id: cx.next_id(), @@ -129,7 +129,7 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv, fn mk_block(cx: @ExtCtxt, stmts: &[@ast::stmt], expr: Option<@ast::expr>, - span: span) -> ast::Block { + span: Span) -> ast::Block { ast::Block { view_items: ~[], stmts: stmts.to_owned(), @@ -140,7 +140,7 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv, } } - fn mk_simple_path(ident: ast::ident, span: span) -> ast::Path { + fn mk_simple_path(ident: ast::ident, span: Span) -> ast::Path { ast::Path { span: span, global: false, @@ -367,7 +367,7 @@ pub fn expand_item_mac(extsbox: @mut SyntaxEnv, fld: @ast_fold) -> Option<@ast::item> { let (pth, tts) = match it.node { - item_mac(codemap::spanned { node: mac_invoc_tt(ref pth, ref tts), _}) => { + item_mac(codemap::Spanned { node: mac_invoc_tt(ref pth, ref tts), _}) => { (pth, (*tts).clone()) } _ => cx.span_bug(it.span, "invalid item macro invocation") @@ -449,11 +449,11 @@ fn insert_macro(exts: SyntaxEnv, name: ast::Name, transformer: @Transformer) { pub fn expand_stmt(extsbox: @mut SyntaxEnv, cx: @ExtCtxt, s: &stmt_, - sp: span, + sp: Span, fld: @ast_fold, - orig: @fn(&stmt_, span, @ast_fold) - -> (Option<stmt_>, span)) - -> (Option<stmt_>, span) { + orig: @fn(&stmt_, Span, @ast_fold) + -> (Option<stmt_>, Span)) + -> (Option<stmt_>, Span) { let (mac, pth, tts, semi) = match *s { stmt_mac(ref mac, semi) => { match mac.node { @@ -484,7 +484,7 @@ pub fn expand_stmt(extsbox: @mut SyntaxEnv, }); let expanded = match exp(cx, mac.span, tts) { MRExpr(e) => - @codemap::spanned { node: stmt_expr(e, cx.next_id()), + @codemap::Spanned { node: stmt_expr(e, cx.next_id()), span: e.span}, MRAny(_,_,stmt_mkr) => stmt_mkr(), _ => cx.span_fatal( @@ -563,7 +563,7 @@ impl Visitor<()> for NewNameFinderContext { // XXX: Methods below can become default methods. - fn visit_mod(&mut self, module: &ast::_mod, _: span, _: NodeId, _: ()) { + fn visit_mod(&mut self, module: &ast::_mod, _: Span, _: NodeId, _: ()) { visit::walk_mod(self, module, ()) } @@ -621,7 +621,7 @@ impl Visitor<()> for NewNameFinderContext { function_kind: &visit::fn_kind, function_declaration: &ast::fn_decl, block: &ast::Block, - span: span, + span: Span, node_id: NodeId, _: ()) { visit::walk_fn(self, @@ -723,9 +723,9 @@ fn apply_pending_renames(folder : @ast_fold, stmt : ast::stmt) -> @ast::stmt { -pub fn new_span(cx: @ExtCtxt, sp: span) -> span { +pub fn new_span(cx: @ExtCtxt, sp: Span) -> Span { /* this discards information in the case of macro-defining macros */ - return span {lo: sp.lo, hi: sp.hi, expn_info: cx.backtrace()}; + return Span {lo: sp.lo, hi: sp.hi, expn_info: cx.backtrace()}; } // FIXME (#2247): this is a moderately bad kludge to inject some macros into @@ -1193,7 +1193,7 @@ mod test { use ast; use ast::{Attribute_, AttrOuter, MetaWord, empty_ctxt}; use codemap; - use codemap::spanned; + use codemap::Spanned; use parse; use parse::token::{intern, get_ident_interner}; use print::pprust; @@ -1282,11 +1282,11 @@ mod test { // make a MetaWord outer attribute with the given name fn make_dummy_attr(s: @str) -> ast::Attribute { - spanned { + Spanned { span:codemap::dummy_sp(), node: Attribute_ { style: AttrOuter, - value: @spanned { + value: @Spanned { node: MetaWord(s), span: codemap::dummy_sp(), }, diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs index 10f2055b5fb..4bfb4da7a49 100644 --- a/src/libsyntax/ext/fmt.rs +++ b/src/libsyntax/ext/fmt.rs @@ -15,7 +15,7 @@ */ use ast; -use codemap::span; +use codemap::Span; use ext::base::*; use ext::base; use ext::build::AstBuilder; @@ -24,7 +24,7 @@ use std::option; use std::unstable::extfmt::ct::*; use parse::token::{str_to_ident}; -pub fn expand_syntax_ext(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) +pub fn expand_syntax_ext(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> base::MacResult { let args = get_exprs_from_tts(cx, sp, tts); if args.len() == 0 { @@ -35,7 +35,7 @@ pub fn expand_syntax_ext(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) "first argument to fmt! must be a string literal."); let fmtspan = args[0].span; debug!("Format string: %s", fmt); - fn parse_fmt_err_(cx: @ExtCtxt, sp: span, msg: &str) -> ! { + fn parse_fmt_err_(cx: @ExtCtxt, sp: Span, msg: &str) -> ! { cx.span_fatal(sp, msg); } let parse_fmt_err: @fn(&str) -> ! = |s| parse_fmt_err_(cx, fmtspan, s); @@ -47,7 +47,7 @@ pub fn expand_syntax_ext(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) // probably be factored out in common with other code that builds // expressions. Also: Cleanup the naming of these functions. // Note: Moved many of the common ones to build.rs --kevina -fn pieces_to_expr(cx: @ExtCtxt, sp: span, +fn pieces_to_expr(cx: @ExtCtxt, sp: Span, pieces: ~[Piece], args: ~[@ast::expr]) -> @ast::expr { fn make_path_vec(ident: &str) -> ~[ast::ident] { @@ -57,15 +57,15 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: span, str_to_ident("rt"), str_to_ident(ident)]; } - fn make_rt_path_expr(cx: @ExtCtxt, sp: span, nm: &str) -> @ast::expr { + fn make_rt_path_expr(cx: @ExtCtxt, sp: Span, nm: &str) -> @ast::expr { let path = make_path_vec(nm); cx.expr_path(cx.path_global(sp, path)) } // Produces an AST expression that represents a RT::conv record, // which tells the RT::conv* functions how to perform the conversion - fn make_rt_conv_expr(cx: @ExtCtxt, sp: span, cnv: &Conv) -> @ast::expr { - fn make_flags(cx: @ExtCtxt, sp: span, flags: &[Flag]) -> @ast::expr { + fn make_rt_conv_expr(cx: @ExtCtxt, sp: Span, cnv: &Conv) -> @ast::expr { + fn make_flags(cx: @ExtCtxt, sp: Span, flags: &[Flag]) -> @ast::expr { let mut tmp_expr = make_rt_path_expr(cx, sp, "flag_none"); for f in flags.iter() { let fstr = match *f { @@ -80,7 +80,7 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: span, } return tmp_expr; } - fn make_count(cx: @ExtCtxt, sp: span, cnt: Count) -> @ast::expr { + fn make_count(cx: @ExtCtxt, sp: Span, cnt: Count) -> @ast::expr { match cnt { CountImplied => { return make_rt_path_expr(cx, sp, "CountImplied"); @@ -94,7 +94,7 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: span, _ => cx.span_unimpl(sp, "unimplemented fmt! conversion") } } - fn make_ty(cx: @ExtCtxt, sp: span, t: Ty) -> @ast::expr { + fn make_ty(cx: @ExtCtxt, sp: Span, t: Ty) -> @ast::expr { let rt_type = match t { TyHex(c) => match c { CaseUpper => "TyHexUpper", @@ -106,7 +106,7 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: span, }; return make_rt_path_expr(cx, sp, rt_type); } - fn make_conv_struct(cx: @ExtCtxt, sp: span, flags_expr: @ast::expr, + fn make_conv_struct(cx: @ExtCtxt, sp: Span, flags_expr: @ast::expr, width_expr: @ast::expr, precision_expr: @ast::expr, ty_expr: @ast::expr) -> @ast::expr { cx.expr_struct( @@ -127,7 +127,7 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: span, make_conv_struct(cx, sp, rt_conv_flags, rt_conv_width, rt_conv_precision, rt_conv_ty) } - fn make_conv_call(cx: @ExtCtxt, sp: span, conv_type: &str, cnv: &Conv, + fn make_conv_call(cx: @ExtCtxt, sp: Span, conv_type: &str, cnv: &Conv, arg: @ast::expr, buf: @ast::expr) -> @ast::expr { let fname = ~"conv_" + conv_type; let path = make_path_vec(fname); @@ -136,7 +136,7 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: span, cx.expr_call_global(arg.span, path, args) } - fn make_new_conv(cx: @ExtCtxt, sp: span, cnv: &Conv, + fn make_new_conv(cx: @ExtCtxt, sp: Span, cnv: &Conv, arg: @ast::expr, buf: @ast::expr) -> @ast::expr { fn is_signed_type(cnv: &Conv) -> bool { match cnv.ty { diff --git a/src/libsyntax/ext/ifmt.rs b/src/libsyntax/ext/ifmt.rs index d4274746a4e..eab5f657775 100644 --- a/src/libsyntax/ext/ifmt.rs +++ b/src/libsyntax/ext/ifmt.rs @@ -9,7 +9,7 @@ // except according to those terms. use ast; -use codemap::{span, respan}; +use codemap::{Span, respan}; use ext::base::*; use ext::base; use ext::build::AstBuilder; @@ -30,7 +30,7 @@ enum ArgumentType { struct Context { ecx: @ExtCtxt, - fmtsp: span, + fmtsp: Span, // Parsed argument expressions and the types that we've found so far for // them. @@ -53,7 +53,7 @@ struct Context { impl Context { /// Parses the arguments from the given list of tokens, returning None if /// there's a parse error so we can continue parsing other fmt! expressions. - fn parse_args(&mut self, sp: span, + fn parse_args(&mut self, sp: Span, leading_expr: bool, tts: &[ast::token_tree]) -> (Option<@ast::expr>, Option<@ast::expr>) { @@ -294,7 +294,7 @@ impl Context { /// /// Obviously `Some(Some(x)) != Some(Some(y))`, but we consider it true /// that: `Some(None) == Some(Some(x))` - fn verify_same(&self, sp: span, ty: ArgumentType, + fn verify_same(&self, sp: Span, ty: ArgumentType, before: Option<ArgumentType>) { if ty == Unknown { return } let cur = match before { @@ -636,7 +636,7 @@ impl Context { self.ecx.expr_block(self.ecx.block(self.fmtsp, lets, Some(result))) } - fn format_arg(&self, sp: span, arg: Either<uint, @str>, + fn format_arg(&self, sp: Span, arg: Either<uint, @str>, ident: ast::ident) -> @ast::expr { let ty = match arg { Left(i) => self.arg_types[i].unwrap(), @@ -697,22 +697,22 @@ impl Context { } } -pub fn expand_format(ecx: @ExtCtxt, sp: span, +pub fn expand_format(ecx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> base::MacResult { expand_ifmt(ecx, sp, tts, false, false, "format") } -pub fn expand_write(ecx: @ExtCtxt, sp: span, +pub fn expand_write(ecx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> base::MacResult { expand_ifmt(ecx, sp, tts, true, false, "write") } -pub fn expand_writeln(ecx: @ExtCtxt, sp: span, +pub fn expand_writeln(ecx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> base::MacResult { expand_ifmt(ecx, sp, tts, true, true, "write") } -fn expand_ifmt(ecx: @ExtCtxt, sp: span, tts: &[ast::token_tree], +fn expand_ifmt(ecx: @ExtCtxt, sp: Span, tts: &[ast::token_tree], leading_arg: bool, append_newline: bool, function: &str) -> base::MacResult { let mut cx = Context { diff --git a/src/libsyntax/ext/log_syntax.rs b/src/libsyntax/ext/log_syntax.rs index f489583dc6f..206cc7be1fd 100644 --- a/src/libsyntax/ext/log_syntax.rs +++ b/src/libsyntax/ext/log_syntax.rs @@ -18,7 +18,7 @@ use parse::token::{get_ident_interner}; use std::io; pub fn expand_syntax_ext(cx: @ExtCtxt, - sp: codemap::span, + sp: codemap::Span, tt: &[ast::token_tree]) -> base::MacResult { @@ -31,7 +31,7 @@ pub fn expand_syntax_ext(cx: @ExtCtxt, //trivial expression MRExpr(@ast::expr { id: cx.next_id(), - node: ast::expr_lit(@codemap::spanned { + node: ast::expr_lit(@codemap::Spanned { node: ast::lit_nil, span: sp }), diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index fcc5a8c93fa..05e639632ed 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -9,7 +9,7 @@ // except according to those terms. use ast; -use codemap::{BytePos, Pos, span}; +use codemap::{BytePos, Pos, Span}; use ext::base::ExtCtxt; use ext::base; use ext::build::AstBuilder; @@ -37,7 +37,7 @@ pub mod rt { pub use ast::*; pub use parse::token::*; pub use parse::new_parser_from_tts; - pub use codemap::{BytePos, span, dummy_spanned}; + pub use codemap::{BytePos, Span, dummy_spanned}; pub trait ToTokens { fn to_tokens(&self, _cx: @ExtCtxt) -> ~[token_tree]; @@ -290,20 +290,20 @@ pub mod rt { } pub fn expand_quote_tokens(cx: @ExtCtxt, - sp: span, + sp: Span, tts: &[ast::token_tree]) -> base::MacResult { let (cx_expr, expr) = expand_tts(cx, sp, tts); base::MRExpr(expand_wrapper(cx, sp, cx_expr, expr)) } pub fn expand_quote_expr(cx: @ExtCtxt, - sp: span, + sp: Span, tts: &[ast::token_tree]) -> base::MacResult { base::MRExpr(expand_parse_call(cx, sp, "parse_expr", ~[], tts)) } pub fn expand_quote_item(cx: @ExtCtxt, - sp: span, + sp: Span, tts: &[ast::token_tree]) -> base::MacResult { let e_attrs = cx.expr_vec_uniq(sp, ~[]); base::MRExpr(expand_parse_call(cx, sp, "parse_item", @@ -311,7 +311,7 @@ pub fn expand_quote_item(cx: @ExtCtxt, } pub fn expand_quote_pat(cx: @ExtCtxt, - sp: span, + sp: Span, tts: &[ast::token_tree]) -> base::MacResult { let e_refutable = cx.expr_lit(sp, ast::lit_bool(true)); base::MRExpr(expand_parse_call(cx, sp, "parse_pat", @@ -319,7 +319,7 @@ pub fn expand_quote_pat(cx: @ExtCtxt, } pub fn expand_quote_ty(cx: @ExtCtxt, - sp: span, + sp: Span, tts: &[ast::token_tree]) -> base::MacResult { let e_param_colons = cx.expr_lit(sp, ast::lit_bool(false)); base::MRExpr(expand_parse_call(cx, sp, "parse_ty", @@ -327,7 +327,7 @@ pub fn expand_quote_ty(cx: @ExtCtxt, } pub fn expand_quote_stmt(cx: @ExtCtxt, - sp: span, + sp: Span, tts: &[ast::token_tree]) -> base::MacResult { let e_attrs = cx.expr_vec_uniq(sp, ~[]); base::MRExpr(expand_parse_call(cx, sp, "parse_stmt", @@ -343,7 +343,7 @@ fn id_ext(str: &str) -> ast::ident { } // Lift an ident to the expr that evaluates to that ident. -fn mk_ident(cx: @ExtCtxt, sp: span, ident: ast::ident) -> @ast::expr { +fn mk_ident(cx: @ExtCtxt, sp: Span, ident: ast::ident) -> @ast::expr { let e_str = cx.expr_str(sp, cx.str_of(ident)); cx.expr_method_call(sp, cx.expr_ident(sp, id_ext("ext_cx")), @@ -351,13 +351,13 @@ fn mk_ident(cx: @ExtCtxt, sp: span, ident: ast::ident) -> @ast::expr { ~[e_str]) } -fn mk_bytepos(cx: @ExtCtxt, sp: span, bpos: BytePos) -> @ast::expr { +fn mk_bytepos(cx: @ExtCtxt, sp: Span, bpos: BytePos) -> @ast::expr { let path = id_ext("BytePos"); let arg = cx.expr_uint(sp, bpos.to_uint()); cx.expr_call_ident(sp, path, ~[arg]) } -fn mk_binop(cx: @ExtCtxt, sp: span, bop: token::binop) -> @ast::expr { +fn mk_binop(cx: @ExtCtxt, sp: Span, bop: token::binop) -> @ast::expr { let name = match bop { PLUS => "PLUS", MINUS => "MINUS", @@ -373,7 +373,7 @@ fn mk_binop(cx: @ExtCtxt, sp: span, bop: token::binop) -> @ast::expr { cx.expr_ident(sp, id_ext(name)) } -fn mk_token(cx: @ExtCtxt, sp: span, tok: &token::Token) -> @ast::expr { +fn mk_token(cx: @ExtCtxt, sp: Span, tok: &token::Token) -> @ast::expr { match *tok { BINOP(binop) => { @@ -514,7 +514,7 @@ fn mk_token(cx: @ExtCtxt, sp: span, tok: &token::Token) -> @ast::expr { } -fn mk_tt(cx: @ExtCtxt, sp: span, tt: &ast::token_tree) +fn mk_tt(cx: @ExtCtxt, sp: Span, tt: &ast::token_tree) -> ~[@ast::stmt] { match *tt { @@ -556,7 +556,7 @@ fn mk_tt(cx: @ExtCtxt, sp: span, tt: &ast::token_tree) } } -fn mk_tts(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) +fn mk_tts(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> ~[@ast::stmt] { let mut ss = ~[]; for tt in tts.iter() { @@ -566,7 +566,7 @@ fn mk_tts(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) } fn expand_tts(cx: @ExtCtxt, - sp: span, + sp: Span, tts: &[ast::token_tree]) -> (@ast::expr, @ast::expr) { // NB: It appears that the main parser loses its mind if we consider @@ -639,7 +639,7 @@ fn expand_tts(cx: @ExtCtxt, } fn expand_wrapper(cx: @ExtCtxt, - sp: span, + sp: Span, cx_expr: @ast::expr, expr: @ast::expr) -> @ast::expr { let uses = ~[ cx.view_use_glob(sp, ast::public, @@ -654,7 +654,7 @@ fn expand_wrapper(cx: @ExtCtxt, } fn expand_parse_call(cx: @ExtCtxt, - sp: span, + sp: Span, parse_method: &str, arg_exprs: ~[@ast::expr], tts: &[ast::token_tree]) -> @ast::expr { diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index 031f0fb4199..96c8482c418 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -10,7 +10,7 @@ use ast; use codemap; -use codemap::{Pos, span}; +use codemap::{Pos, Span}; use codemap::{ExpnInfo, NameAndSpan}; use ext::base::*; use ext::base; @@ -27,7 +27,7 @@ use std::result; // a given file into the current one. /* line!(): expands to the current line number */ -pub fn expand_line(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) +pub fn expand_line(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> base::MacResult { base::check_zero_tts(cx, sp, tts, "line!"); @@ -38,7 +38,7 @@ pub fn expand_line(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) } /* col!(): expands to the current column number */ -pub fn expand_col(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) +pub fn expand_col(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> base::MacResult { base::check_zero_tts(cx, sp, tts, "col!"); @@ -50,7 +50,7 @@ pub fn expand_col(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) /* file!(): expands to the current filename */ /* The filemap (`loc.file`) contains a bunch more information we could spit * out if we wanted. */ -pub fn expand_file(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) +pub fn expand_file(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> base::MacResult { base::check_zero_tts(cx, sp, tts, "file!"); @@ -60,13 +60,13 @@ pub fn expand_file(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) base::MRExpr(cx.expr_str(topmost.call_site, filename)) } -pub fn expand_stringify(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) +pub fn expand_stringify(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> base::MacResult { let s = pprust::tts_to_str(tts, get_ident_interner()); base::MRExpr(cx.expr_str(sp, s.to_managed())) } -pub fn expand_mod(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) +pub fn expand_mod(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> base::MacResult { base::check_zero_tts(cx, sp, tts, "module_path!"); base::MRExpr(cx.expr_str(sp, @@ -76,7 +76,7 @@ pub fn expand_mod(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) // include! : parse the given file as an expr // This is generally a bad idea because it's going to behave // unhygienically. -pub fn expand_include(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) +pub fn expand_include(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> base::MacResult { let file = get_single_str_from_tts(cx, sp, tts, "include!"); let p = parse::new_sub_parser_from_file( @@ -86,7 +86,7 @@ pub fn expand_include(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) } // include_str! : read the given file, insert it as a literal string expr -pub fn expand_include_str(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) +pub fn expand_include_str(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> base::MacResult { let file = get_single_str_from_tts(cx, sp, tts, "include_str!"); let res = io::read_whole_file_str(&res_rel_file(cx, sp, &Path(file))); @@ -100,7 +100,7 @@ pub fn expand_include_str(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) } } -pub fn expand_include_bin(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) +pub fn expand_include_bin(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> base::MacResult { let file = get_single_str_from_tts(cx, sp, tts, "include_bin!"); match io::read_whole_file(&res_rel_file(cx, sp, &Path(file))) { @@ -142,7 +142,7 @@ fn topmost_expn_info(expn_info: @codemap::ExpnInfo) -> @codemap::ExpnInfo { // resolve a file-system path to an absolute file-system path (if it // isn't already) -fn res_rel_file(cx: @ExtCtxt, sp: codemap::span, arg: &Path) -> Path { +fn res_rel_file(cx: @ExtCtxt, sp: codemap::Span, arg: &Path) -> Path { // NB: relative paths are resolved relative to the compilation unit if !arg.is_absolute { let cu = Path(cx.codemap().span_to_filename(sp)); diff --git a/src/libsyntax/ext/trace_macros.rs b/src/libsyntax/ext/trace_macros.rs index f3e7613d96a..1862d4a88fd 100644 --- a/src/libsyntax/ext/trace_macros.rs +++ b/src/libsyntax/ext/trace_macros.rs @@ -9,7 +9,7 @@ // except according to those terms. use ast; -use codemap::span; +use codemap::Span; use ext::base::ExtCtxt; use ext::base; use parse::lexer::{new_tt_reader, reader}; @@ -17,7 +17,7 @@ use parse::parser::Parser; use parse::token::keywords; pub fn expand_trace_macros(cx: @ExtCtxt, - sp: span, + sp: Span, tt: &[ast::token_tree]) -> base::MacResult { let sess = cx.parse_sess(); diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 327ee331c38..bc4b1010943 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -182,7 +182,7 @@ pub fn initial_matcher_pos(ms: ~[matcher], sep: Option<Token>, lo: BytePos) // ast::matcher it was derived from. pub enum named_match { - matched_seq(~[@named_match], codemap::span), + matched_seq(~[@named_match], codemap::Span), matched_nonterminal(nonterminal) } @@ -193,13 +193,13 @@ pub fn nameize(p_s: @mut ParseSess, ms: &[matcher], res: &[@named_match]) fn n_rec(p_s: @mut ParseSess, m: &matcher, res: &[@named_match], ret_val: &mut HashMap<ident, @named_match>) { match *m { - codemap::spanned {node: match_tok(_), _} => (), - codemap::spanned {node: match_seq(ref more_ms, _, _, _, _), _} => { + codemap::Spanned {node: match_tok(_), _} => (), + codemap::Spanned {node: match_seq(ref more_ms, _, _, _, _), _} => { for next_m in more_ms.iter() { n_rec(p_s, next_m, res, ret_val) }; } - codemap::spanned { + codemap::Spanned { node: match_nonterminal(ref bind_name, _, idx), span: sp } => { if ret_val.contains_key(bind_name) { @@ -217,8 +217,8 @@ pub fn nameize(p_s: @mut ParseSess, ms: &[matcher], res: &[@named_match]) pub enum parse_result { success(HashMap<ident, @named_match>), - failure(codemap::span, ~str), - error(codemap::span, ~str) + failure(codemap::Span, ~str), + error(codemap::Span, ~str) } pub fn parse_or_else( diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 54ac1f1e48f..f336098468b 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -11,7 +11,7 @@ use ast::{ident, matcher_, matcher, match_tok, match_nonterminal, match_seq}; use ast::{tt_delim}; use ast; -use codemap::{span, spanned, dummy_sp}; +use codemap::{Span, Spanned, dummy_sp}; use ext::base::{ExtCtxt, MacResult, MRAny, MRDef, MacroDef, NormalTT}; use ext::base; use ext::tt::macro_parser::{error}; @@ -24,13 +24,13 @@ use parse::token::{FAT_ARROW, SEMI, nt_matchers, nt_tt}; use print; pub fn add_new_extension(cx: @ExtCtxt, - sp: span, + sp: Span, name: ident, arg: ~[ast::token_tree]) -> base::MacResult { // these spans won't matter, anyways fn ms(m: matcher_) -> matcher { - spanned { + Spanned { node: m.clone(), span: dummy_sp() } @@ -74,7 +74,7 @@ pub fn add_new_extension(cx: @ExtCtxt, }; // Given `lhses` and `rhses`, this is the new macro we create - fn generic_extension(cx: @ExtCtxt, sp: span, name: ident, + fn generic_extension(cx: @ExtCtxt, sp: Span, name: ident, arg: &[ast::token_tree], lhses: &[@named_match], rhses: &[@named_match]) -> MacResult { @@ -144,7 +144,7 @@ pub fn add_new_extension(cx: @ExtCtxt, cx.span_fatal(best_fail_spot, best_fail_msg); } - let exp: @fn(@ExtCtxt, span, &[ast::token_tree]) -> MacResult = + let exp: @fn(@ExtCtxt, Span, &[ast::token_tree]) -> MacResult = |cx, sp, arg| generic_extension(cx, sp, name, arg, *lhses, *rhses); return MRDef(MacroDef{ diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index 13bad252243..668805bf7a8 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -10,7 +10,7 @@ use ast; use ast::{token_tree, tt_delim, tt_tok, tt_seq, tt_nonterminal,ident}; -use codemap::{span, dummy_sp}; +use codemap::{Span, dummy_sp}; use diagnostic::span_handler; use ext::tt::macro_parser::{named_match, matched_seq, matched_nonterminal}; use parse::token::{EOF, INTERPOLATED, IDENT, Token, nt_ident}; @@ -39,7 +39,7 @@ pub struct TtReader { repeat_len: ~[uint], /* cached: */ cur_tok: Token, - cur_span: span + cur_span: Span } /** This can do Macro-By-Example transcription. On the other hand, if |
