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 | |
| 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')
47 files changed, 565 insertions, 565 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index aec279e9c53..a7fad7def18 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -10,7 +10,7 @@ // The Rust abstract syntax tree. -use codemap::{span, spanned}; +use codemap::{Span, Spanned}; use abi::AbiSet; use opt_vec::OptVec; use parse::token::{interner_get, str_to_ident}; @@ -95,7 +95,7 @@ pub type fn_ident = Option<ident>; #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] pub struct Lifetime { id: NodeId, - span: span, + span: Span, ident: ident } @@ -105,7 +105,7 @@ pub struct Lifetime { // of supporting information. #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] pub struct Path { - span: span, + span: Span, /// A `::foo` path, is relative to the crate root rather than current /// module (like paths in an import). global: bool, @@ -219,10 +219,10 @@ pub struct Crate { module: _mod, attrs: ~[Attribute], config: CrateConfig, - span: span, + span: Span, } -pub type MetaItem = spanned<MetaItem_>; +pub type MetaItem = Spanned<MetaItem_>; #[deriving(Clone, Encodable, Decodable, IterBytes)] pub enum MetaItem_ { @@ -263,14 +263,14 @@ pub struct Block { expr: Option<@expr>, id: NodeId, rules: BlockCheckMode, - span: span, + span: Span, } #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] pub struct pat { id: NodeId, node: pat_, - span: span, + span: Span, } #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] @@ -333,7 +333,7 @@ impl ToStr for Sigil { } } -#[deriving(Eq, Encodable, Decodable,IterBytes)] +#[deriving(Eq, Encodable, Decodable, IterBytes)] pub enum vstore { // FIXME (#3469): Change uint to @expr (actually only constant exprs) vstore_fixed(Option<uint>), // [1,2,3,4] @@ -382,7 +382,7 @@ pub enum unop { neg } -pub type stmt = spanned<stmt_>; +pub type stmt = Spanned<stmt_>; #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] pub enum stmt_ { @@ -408,10 +408,10 @@ pub struct Local { pat: @pat, init: Option<@expr>, id: NodeId, - span: span, + span: Span, } -pub type decl = spanned<decl_>; +pub type decl = Spanned<decl_>; #[deriving(Eq, Encodable, Decodable,IterBytes)] pub enum decl_ { @@ -432,7 +432,7 @@ pub struct arm { pub struct Field { ident: ident, expr: @expr, - span: span, + span: Span, } #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] @@ -445,7 +445,7 @@ pub enum BlockCheckMode { pub struct expr { id: NodeId, node: expr_, - span: span, + span: Span, } impl expr { @@ -538,7 +538,7 @@ pub enum expr_ { #[doc="For macro invocations; parsing is delegated to the macro"] pub enum token_tree { // a single token - tt_tok(span, ::parse::token::Token), + tt_tok(Span, ::parse::token::Token), // a delimited sequence (the delimiters appear as the first // and last elements of the vector) tt_delim(@mut ~[token_tree]), @@ -547,10 +547,10 @@ pub enum token_tree { // a kleene-style repetition sequence with a span, a tt_forest, // an optional separator (?), and a boolean where true indicates // zero or more (*), and false indicates one or more (+). - tt_seq(span, @mut ~[token_tree], Option<::parse::token::Token>, bool), + tt_seq(Span, @mut ~[token_tree], Option<::parse::token::Token>, bool), // a syntactic variable that will be filled in by macro expansion. - tt_nonterminal(span, ident) + tt_nonterminal(Span, ident) } // @@ -605,7 +605,7 @@ pub enum token_tree { // If you understand that, you have closed to loop and understand the whole // macro system. Congratulations. // -pub type matcher = spanned<matcher_>; +pub type matcher = Spanned<matcher_>; #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] pub enum matcher_ { @@ -618,14 +618,14 @@ pub enum matcher_ { match_nonterminal(ident, ident, uint) } -pub type mac = spanned<mac_>; +pub type mac = Spanned<mac_>; #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] pub enum mac_ { mac_invoc_tt(Path,~[token_tree]), // new macro-invocation } -pub type lit = spanned<lit_>; +pub type lit = Spanned<lit_>; #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] pub enum lit_ { @@ -651,7 +651,7 @@ pub struct mt { pub struct TypeField { ident: ident, mt: mt, - span: span, + span: Span, } #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] @@ -663,7 +663,7 @@ pub struct TypeMethod { generics: Generics, explicit_self: explicit_self, id: NodeId, - span: span, + span: Span, } // A trait method is either required (meaning it doesn't have an @@ -724,7 +724,7 @@ impl ToStr for float_ty { pub struct Ty { id: NodeId, node: ty_, - span: span, + span: Span, } // Not represented directly in the AST, referred to by name through a ty_path. @@ -864,7 +864,7 @@ pub enum explicit_self_ { sty_uniq // `~self` } -pub type explicit_self = spanned<explicit_self_>; +pub type explicit_self = Spanned<explicit_self_>; #[deriving(Eq, Encodable, Decodable,IterBytes)] pub struct method { @@ -876,7 +876,7 @@ pub struct method { decl: fn_decl, body: Block, id: NodeId, - span: span, + span: Span, self_id: NodeId, vis: visibility, } @@ -929,7 +929,7 @@ pub struct variant_ { vis: visibility, } -pub type variant = spanned<variant_>; +pub type variant = Spanned<variant_>; #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] pub struct path_list_ident_ { @@ -937,9 +937,9 @@ pub struct path_list_ident_ { id: NodeId, } -pub type path_list_ident = spanned<path_list_ident_>; +pub type path_list_ident = Spanned<path_list_ident_>; -pub type view_path = spanned<view_path_>; +pub type view_path = Spanned<view_path_>; #[deriving(Eq, Encodable, Decodable, IterBytes)] pub enum view_path_ { @@ -963,7 +963,7 @@ pub struct view_item { node: view_item_, attrs: ~[Attribute], vis: visibility, - span: span, + span: Span, } #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] @@ -977,7 +977,7 @@ pub enum view_item_ { } // Meta-data associated with an item -pub type Attribute = spanned<Attribute_>; +pub type Attribute = Spanned<Attribute_>; // Distinguishes between Attributes that decorate items and Attributes that // are contained as statements within items. These two cases need to be @@ -1033,7 +1033,7 @@ pub struct struct_field_ { attrs: ~[Attribute], } -pub type struct_field = spanned<struct_field_>; +pub type struct_field = Spanned<struct_field_>; #[deriving(Eq, Encodable, Decodable,IterBytes)] pub enum struct_field_kind { @@ -1060,7 +1060,7 @@ pub struct item { id: NodeId, node: item_, vis: visibility, - span: span, + span: Span, } #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] @@ -1087,7 +1087,7 @@ pub struct foreign_item { attrs: ~[Attribute], node: foreign_item_, id: NodeId, - span: span, + span: Span, vis: visibility, } diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index 9c9d19ba46b..c900bf2c15d 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -13,7 +13,7 @@ use ast::*; use ast; use ast_util::{inlined_item_utils, stmt_id}; use ast_util; -use codemap::span; +use codemap::Span; use codemap; use diagnostic::span_handler; use parse::token::ident_interner; @@ -148,7 +148,7 @@ impl Ctx { fk: &visit::fn_kind, decl: &fn_decl, body: &Block, - sp: codemap::span, + sp: codemap::Span, id: NodeId) { for a in decl.inputs.iter() { self.map.insert(a.id, node_arg); @@ -282,7 +282,7 @@ impl Visitor<()> for Ctx { function_kind: &fn_kind, function_declaration: &fn_decl, block: &Block, - span: span, + span: Span, node_id: NodeId, _: ()) { self.map_fn(function_kind, function_declaration, block, span, node_id) @@ -294,7 +294,7 @@ impl Visitor<()> for Ctx { // XXX: Methods below can become default methods. - fn visit_mod(&mut self, module: &_mod, _: span, _: NodeId, _: ()) { + fn visit_mod(&mut self, module: &_mod, _: Span, _: NodeId, _: ()) { visit::walk_mod(self, module, ()) } @@ -334,7 +334,7 @@ impl Visitor<()> for Ctx { function_kind: &fn_kind, function_declaration: &fn_decl, block: &Block, - span: span, + span: Span, node_id: NodeId, _: ()) { visit::walk_fn(self, diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 2fe42af65ca..62c2e9af938 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -11,7 +11,7 @@ use ast::*; use ast; use ast_util; -use codemap::{span, dummy_sp}; +use codemap::{Span, dummy_sp}; use opt_vec; use parse::token; use visit::{SimpleVisitor, SimpleVisitorVisitor, Visitor}; @@ -217,7 +217,7 @@ pub fn default_block( } } -pub fn ident_to_path(s: span, identifier: ident) -> Path { +pub fn ident_to_path(s: Span, identifier: ident) -> Path { ast::Path { span: s, global: false, @@ -231,7 +231,7 @@ pub fn ident_to_path(s: span, identifier: ident) -> Path { } } -pub fn ident_to_pat(id: NodeId, s: span, i: ident) -> @pat { +pub fn ident_to_pat(id: NodeId, s: Span, i: ident) -> @pat { @ast::pat { id: id, node: pat_ident(bind_infer, ident_to_path(s, i), None), span: s } @@ -426,7 +426,7 @@ impl IdVisitor { impl Visitor<()> for IdVisitor { fn visit_mod(&mut self, module: &_mod, - _: span, + _: Span, node_id: NodeId, env: ()) { (self.visit_callback)(node_id); @@ -551,7 +551,7 @@ impl Visitor<()> for IdVisitor { function_kind: &visit::fn_kind, function_declaration: &fn_decl, block: &Block, - span: span, + span: Span, node_id: NodeId, env: ()) { if !self.pass_through_items { @@ -691,7 +691,7 @@ struct EachViewItemData { } impl SimpleVisitor for EachViewItemData { - fn visit_mod(&mut self, _: &_mod, _: span, _: NodeId) { + fn visit_mod(&mut self, _: &_mod, _: Span, _: NodeId) { // XXX: Default method. } fn visit_view_item(&mut self, view_item: &view_item) { @@ -737,7 +737,7 @@ impl SimpleVisitor for EachViewItemData { _: &visit::fn_kind, _: &fn_decl, _: &Block, - _: span, + _: Span, _: NodeId) { // XXX: Default method. } diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index 51df08f5228..d365c89eee7 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -14,7 +14,7 @@ use extra; use ast; use ast::{Attribute, Attribute_, MetaItem, MetaWord, MetaNameValue, MetaList}; -use codemap::{spanned, dummy_spanned}; +use codemap::{Spanned, spanned, dummy_spanned}; use codemap::BytePos; use diagnostic::span_handler; use parse::comments::{doc_comment_style, strip_doc_comment_decoration}; @@ -212,7 +212,7 @@ pub fn sort_meta_items(items: &[@MetaItem]) -> ~[@MetaItem] { do v.move_iter().map |(_, m)| { match m.node { MetaList(n, ref mis) => { - @spanned { + @Spanned { node: MetaList(n, sort_meta_items(*mis)), .. /*bad*/ (*m).clone() } diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index d4337523cfb..1c3a8e81e55 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -96,57 +96,57 @@ relative to FileMaps. Methods on the CodeMap can be used to relate spans back to the original source. */ #[deriving(Clone, IterBytes)] -pub struct span { +pub struct Span { lo: BytePos, hi: BytePos, expn_info: Option<@ExpnInfo> } #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] -pub struct spanned<T> { +pub struct Spanned<T> { node: T, - span: span, + span: Span, } -impl cmp::Eq for span { - fn eq(&self, other: &span) -> bool { +impl cmp::Eq for Span { + fn eq(&self, other: &Span) -> bool { return (*self).lo == (*other).lo && (*self).hi == (*other).hi; } - fn ne(&self, other: &span) -> bool { !(*self).eq(other) } + fn ne(&self, other: &Span) -> bool { !(*self).eq(other) } } -impl<S:Encoder> Encodable<S> for span { +impl<S:Encoder> Encodable<S> for Span { /* Note #1972 -- spans are encoded but not decoded */ fn encode(&self, s: &mut S) { s.emit_nil() } } -impl<D:Decoder> Decodable<D> for span { - fn decode(_d: &mut D) -> span { +impl<D:Decoder> Decodable<D> for Span { + fn decode(_d: &mut D) -> Span { dummy_sp() } } -pub fn spanned<T>(lo: BytePos, hi: BytePos, t: T) -> spanned<T> { +pub fn spanned<T>(lo: BytePos, hi: BytePos, t: T) -> Spanned<T> { respan(mk_sp(lo, hi), t) } -pub fn respan<T>(sp: span, t: T) -> spanned<T> { - spanned {node: t, span: sp} +pub fn respan<T>(sp: Span, t: T) -> Spanned<T> { + Spanned {node: t, span: sp} } -pub fn dummy_spanned<T>(t: T) -> spanned<T> { +pub fn dummy_spanned<T>(t: T) -> Spanned<T> { respan(dummy_sp(), t) } /* assuming that we're not in macro expansion */ -pub fn mk_sp(lo: BytePos, hi: BytePos) -> span { - span {lo: lo, hi: hi, expn_info: None} +pub fn mk_sp(lo: BytePos, hi: BytePos) -> Span { + Span {lo: lo, hi: hi, expn_info: None} } // make this a const, once the compiler supports it -pub fn dummy_sp() -> span { return mk_sp(BytePos(0), BytePos(0)); } +pub fn dummy_sp() -> Span { return mk_sp(BytePos(0), BytePos(0)); } @@ -174,12 +174,12 @@ pub struct LocWithOpt { pub struct FileMapAndLine {fm: @FileMap, line: uint} pub struct FileMapAndBytePos {fm: @FileMap, pos: BytePos} #[deriving(IterBytes)] -pub struct NameAndSpan {name: @str, span: Option<span>} +pub struct NameAndSpan {name: @str, span: Option<Span>} /// Extra information for tracking macro expansion of spans #[deriving(IterBytes)] pub struct ExpnInfo { - call_site: span, + call_site: Span, callee: NameAndSpan } @@ -197,7 +197,7 @@ pub enum FileSubstr { FssNone, // indicates that this "file" is actually a substring // of another file that appears earlier in the codemap - FssInternal(span), + FssInternal(Span), } /// Identifies an offset of a multi-byte character in a FileMap @@ -302,7 +302,7 @@ impl CodeMap { return filemap; } - pub fn mk_substr_filename(&self, sp: span) -> ~str { + pub fn mk_substr_filename(&self, sp: Span) -> ~str { let pos = self.lookup_char_pos(sp.lo); return fmt!("<%s:%u:%u>", pos.file.name, pos.line, pos.col.to_uint()); @@ -328,12 +328,12 @@ impl CodeMap { } } - pub fn adjust_span(&self, sp: span) -> span { + pub fn adjust_span(&self, sp: Span) -> Span { let line = self.lookup_line(sp.lo); match (line.fm.substr) { FssNone => sp, FssInternal(s) => { - self.adjust_span(span { + self.adjust_span(Span { lo: s.lo + (sp.lo - line.fm.start_pos), hi: s.lo + (sp.hi - line.fm.start_pos), expn_info: sp.expn_info @@ -342,7 +342,7 @@ impl CodeMap { } } - pub fn span_to_str(&self, sp: span) -> ~str { + pub fn span_to_str(&self, sp: Span) -> ~str { let files = &*self.files; if files.len() == 0 && sp == dummy_sp() { return ~"no-location"; @@ -354,12 +354,12 @@ impl CodeMap { lo.line, lo.col.to_uint(), hi.line, hi.col.to_uint()) } - pub fn span_to_filename(&self, sp: span) -> FileName { + pub fn span_to_filename(&self, sp: Span) -> FileName { let lo = self.lookup_char_pos(sp.lo); lo.file.name } - pub fn span_to_lines(&self, sp: span) -> @FileLines { + pub fn span_to_lines(&self, sp: Span) -> @FileLines { let lo = self.lookup_char_pos(sp.lo); let hi = self.lookup_char_pos(sp.hi); let mut lines = ~[]; @@ -369,7 +369,7 @@ impl CodeMap { return @FileLines {file: lo.file, lines: lines}; } - pub fn span_to_snippet(&self, sp: span) -> Option<~str> { + pub fn span_to_snippet(&self, sp: Span) -> Option<~str> { let begin = self.lookup_byte_offset(sp.lo); let end = self.lookup_byte_offset(sp.hi); @@ -446,7 +446,7 @@ impl CodeMap { }; } - fn span_to_str_no_adj(&self, sp: span) -> ~str { + fn span_to_str_no_adj(&self, sp: Span) -> ~str { let lo = self.lookup_char_pos(sp.lo); let hi = self.lookup_char_pos(sp.hi); return fmt!("%s:%u:%u: %u:%u", lo.file.name, diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index 5cdfe8e0f11..536267a2235 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -8,14 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use codemap::{Pos, span}; +use codemap::{Pos, Span}; use codemap; use std::io; use std::local_data; use extra::term; -pub type Emitter = @fn(cmsp: Option<(@codemap::CodeMap, span)>, +pub type Emitter = @fn(cmsp: Option<(@codemap::CodeMap, Span)>, msg: &str, lvl: level); @@ -35,7 +35,7 @@ pub trait handler { fn bug(@mut self, msg: &str) -> !; fn unimpl(@mut self, msg: &str) -> !; fn emit(@mut self, - cmsp: Option<(@codemap::CodeMap, span)>, + cmsp: Option<(@codemap::CodeMap, Span)>, msg: &str, lvl: level); } @@ -44,12 +44,12 @@ pub trait handler { // accepts span information for source-location // reporting. pub trait span_handler { - fn span_fatal(@mut self, sp: span, msg: &str) -> !; - fn span_err(@mut self, sp: span, msg: &str); - fn span_warn(@mut self, sp: span, msg: &str); - fn span_note(@mut self, sp: span, msg: &str); - fn span_bug(@mut self, sp: span, msg: &str) -> !; - fn span_unimpl(@mut self, sp: span, msg: &str) -> !; + fn span_fatal(@mut self, sp: Span, msg: &str) -> !; + fn span_err(@mut self, sp: Span, msg: &str); + fn span_warn(@mut self, sp: Span, msg: &str); + fn span_note(@mut self, sp: Span, msg: &str); + fn span_bug(@mut self, sp: Span, msg: &str) -> !; + fn span_unimpl(@mut self, sp: Span, msg: &str) -> !; fn handler(@mut self) -> @mut handler; } @@ -64,24 +64,24 @@ struct CodemapT { } impl span_handler for CodemapT { - fn span_fatal(@mut self, sp: span, msg: &str) -> ! { + fn span_fatal(@mut self, sp: Span, msg: &str) -> ! { self.handler.emit(Some((self.cm, sp)), msg, fatal); fail!(); } - fn span_err(@mut self, sp: span, msg: &str) { + fn span_err(@mut self, sp: Span, msg: &str) { self.handler.emit(Some((self.cm, sp)), msg, error); self.handler.bump_err_count(); } - fn span_warn(@mut self, sp: span, msg: &str) { + fn span_warn(@mut self, sp: Span, msg: &str) { self.handler.emit(Some((self.cm, sp)), msg, warning); } - fn span_note(@mut self, sp: span, msg: &str) { + fn span_note(@mut self, sp: Span, msg: &str) { self.handler.emit(Some((self.cm, sp)), msg, note); } - fn span_bug(@mut self, sp: span, msg: &str) -> ! { + fn span_bug(@mut self, sp: Span, msg: &str) -> ! { self.span_fatal(sp, ice_msg(msg)); } - fn span_unimpl(@mut self, sp: span, msg: &str) -> ! { + fn span_unimpl(@mut self, sp: Span, msg: &str) -> ! { self.span_bug(sp, ~"unimplemented " + msg); } fn handler(@mut self) -> @mut handler { @@ -132,7 +132,7 @@ impl handler for HandlerT { self.bug(~"unimplemented " + msg); } fn emit(@mut self, - cmsp: Option<(@codemap::CodeMap, span)>, + cmsp: Option<(@codemap::CodeMap, Span)>, msg: &str, lvl: level) { (self.emit)(cmsp, msg, lvl); @@ -231,13 +231,13 @@ fn print_diagnostic(topic: &str, lvl: level, msg: &str) { } pub fn collect(messages: @mut ~[~str]) - -> @fn(Option<(@codemap::CodeMap, span)>, &str, level) { - let f: @fn(Option<(@codemap::CodeMap, span)>, &str, level) = + -> @fn(Option<(@codemap::CodeMap, Span)>, &str, level) { + let f: @fn(Option<(@codemap::CodeMap, Span)>, &str, level) = |_o, msg: &str, _l| { messages.push(msg.to_str()); }; f } -pub fn emit(cmsp: Option<(@codemap::CodeMap, span)>, msg: &str, lvl: level) { +pub fn emit(cmsp: Option<(@codemap::CodeMap, Span)>, msg: &str, lvl: level) { match cmsp { Some((cm, sp)) => { let sp = cm.adjust_span(sp); @@ -254,7 +254,7 @@ pub fn emit(cmsp: Option<(@codemap::CodeMap, span)>, msg: &str, lvl: level) { } fn highlight_lines(cm: @codemap::CodeMap, - sp: span, lvl: level, + sp: Span, lvl: level, lines: @codemap::FileLines) { let fm = lines.file; @@ -330,7 +330,7 @@ fn highlight_lines(cm: @codemap::CodeMap, } } -fn print_macro_backtrace(cm: @codemap::CodeMap, sp: span) { +fn print_macro_backtrace(cm: @codemap::CodeMap, sp: Span) { for ei in sp.expn_info.iter() { let ss = ei.callee.span.map_default(~"", |span| cm.span_to_str(*span)); print_diagnostic(ss, note, 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 diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 6e3cd8e7159..98ef4e89027 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -10,7 +10,7 @@ use ast::*; use ast; -use codemap::{span, spanned}; +use codemap::{Span, Spanned}; use parse::token; use opt_vec::OptVec; @@ -37,7 +37,7 @@ pub trait ast_fold { fn fold_local(@self, @Local) -> @Local; fn map_exprs(@self, @fn(@expr) -> @expr, &[@expr]) -> ~[@expr]; fn new_id(@self, NodeId) -> NodeId; - fn new_span(@self, span) -> span; + fn new_span(@self, Span) -> Span; } // We may eventually want to be able to fold over type parameters, too @@ -52,21 +52,21 @@ pub struct AstFoldFns { fold_item_underscore: @fn(&item_, @ast_fold) -> item_, fold_method: @fn(@method, @ast_fold) -> @method, fold_block: @fn(&Block, @ast_fold) -> Block, - fold_stmt: @fn(&stmt_, span, @ast_fold) -> (Option<stmt_>, span), + fold_stmt: @fn(&stmt_, Span, @ast_fold) -> (Option<stmt_>, Span), fold_arm: @fn(&arm, @ast_fold) -> arm, - fold_pat: @fn(&pat_, span, @ast_fold) -> (pat_, span), - fold_decl: @fn(&decl_, span, @ast_fold) -> (Option<decl_>, span), - fold_expr: @fn(&expr_, span, @ast_fold) -> (expr_, span), - fold_ty: @fn(&ty_, span, @ast_fold) -> (ty_, span), + fold_pat: @fn(&pat_, Span, @ast_fold) -> (pat_, Span), + fold_decl: @fn(&decl_, Span, @ast_fold) -> (Option<decl_>, Span), + fold_expr: @fn(&expr_, Span, @ast_fold) -> (expr_, Span), + fold_ty: @fn(&ty_, Span, @ast_fold) -> (ty_, Span), fold_mod: @fn(&_mod, @ast_fold) -> _mod, fold_foreign_mod: @fn(&foreign_mod, @ast_fold) -> foreign_mod, - fold_variant: @fn(&variant_, span, @ast_fold) -> (variant_, span), + fold_variant: @fn(&variant_, Span, @ast_fold) -> (variant_, Span), fold_ident: @fn(ident, @ast_fold) -> ident, fold_path: @fn(&Path, @ast_fold) -> Path, fold_local: @fn(@Local, @ast_fold) -> @Local, map_exprs: @fn(@fn(@expr) -> @expr, &[@expr]) -> ~[@expr], new_id: @fn(NodeId) -> NodeId, - new_span: @fn(span) -> span + new_span: @fn(Span) -> Span } pub type ast_fold_fns = @AstFoldFns; @@ -75,7 +75,7 @@ pub type ast_fold_fns = @AstFoldFns; //used in noop_fold_item and noop_fold_crate and noop_fold_crate_directive fn fold_meta_item_(mi: @MetaItem, fld: @ast_fold) -> @MetaItem { - @spanned { + @Spanned { node: match mi.node { MetaWord(id) => MetaWord(id), @@ -92,7 +92,7 @@ fn fold_meta_item_(mi: @MetaItem, fld: @ast_fold) -> @MetaItem { } //used in noop_fold_item and noop_fold_crate fn fold_attribute_(at: Attribute, fld: @ast_fold) -> Attribute { - spanned { + Spanned { span: fld.new_span(at.span), node: ast::Attribute_ { style: at.node.style, @@ -114,7 +114,7 @@ fn fold_arg_(a: arg, fld: @ast_fold) -> arg { //used in noop_fold_expr, and possibly elsewhere in the future fn fold_mac_(m: &mac, fld: @ast_fold) -> mac { - spanned { + Spanned { node: match m.node { mac_invoc_tt(ref p,ref tts) => mac_invoc_tt(fld.fold_path(p), @@ -258,7 +258,7 @@ fn noop_fold_struct_field(sf: @struct_field, fld: @ast_fold) -> @struct_field { let fold_attribute = |x| fold_attribute_(x, fld); - @spanned { + @Spanned { node: ast::struct_field_ { kind: sf.node.kind, id: sf.node.id, @@ -348,7 +348,7 @@ fn fold_trait_ref(p: &trait_ref, fld: @ast_fold) -> trait_ref { } fn fold_struct_field(f: @struct_field, fld: @ast_fold) -> @struct_field { - @spanned { + @Spanned { node: ast::struct_field_ { kind: f.node.kind, id: fld.new_id(f.node.id), @@ -479,8 +479,8 @@ fn noop_fold_decl(d: &decl_, fld: @ast_fold) -> Option<decl_> { } pub fn wrap<T>(f: @fn(&T, @ast_fold) -> T) - -> @fn(&T, span, @ast_fold) -> (T, span) { - let result: @fn(&T, span, @ast_fold) -> (T, span) = |x, s, fld| { + -> @fn(&T, Span, @ast_fold) -> (T, Span) { + let result: @fn(&T, Span, @ast_fold) -> (T, Span) = |x, s, fld| { (f(x, fld), s) }; result @@ -793,7 +793,7 @@ fn noop_map_exprs(f: @fn(@expr) -> @expr, es: &[@expr]) -> ~[@expr] { fn noop_id(i: NodeId) -> NodeId { return i; } -fn noop_span(sp: span) -> span { return sp; } +fn noop_span(sp: Span) -> Span { return sp; } pub fn default_ast_fold() -> ast_fold_fns { @AstFoldFns { @@ -843,7 +843,7 @@ impl ast_fold for AstFoldFns { (self.fold_item)(i, self as @ast_fold) } fn fold_struct_field(@self, sf: @struct_field) -> @struct_field { - @spanned { + @Spanned { node: ast::struct_field_ { kind: sf.node.kind, id: sf.node.id, @@ -865,7 +865,7 @@ impl ast_fold for AstFoldFns { fn fold_stmt(@self, x: &stmt) -> Option<@stmt> { let (n_opt, s) = (self.fold_stmt)(&x.node, x.span, self as @ast_fold); match n_opt { - Some(n) => Some(@spanned { node: n, span: (self.new_span)(s) }), + Some(n) => Some(@Spanned { node: n, span: (self.new_span)(s) }), None => None, } } @@ -883,7 +883,7 @@ impl ast_fold for AstFoldFns { fn fold_decl(@self, x: @decl) -> Option<@decl> { let (n_opt, s) = (self.fold_decl)(&x.node, x.span, self as @ast_fold); match n_opt { - Some(n) => Some(@spanned { node: n, span: (self.new_span)(s) }), + Some(n) => Some(@Spanned { node: n, span: (self.new_span)(s) }), None => None, } } @@ -911,7 +911,7 @@ impl ast_fold for AstFoldFns { } fn fold_variant(@self, x: &variant) -> variant { let (n, s) = (self.fold_variant)(&x.node, x.span, self as @ast_fold); - spanned { node: n, span: (self.new_span)(s) } + Spanned { node: n, span: (self.new_span)(s) } } fn fold_ident(@self, x: ident) -> ident { (self.fold_ident)(x, self as @ast_fold) @@ -931,7 +931,7 @@ impl ast_fold for AstFoldFns { fn new_id(@self, node_id: ast::NodeId) -> NodeId { (self.new_id)(node_id) } - fn new_span(@self, span: span) -> span { + fn new_span(@self, span: Span) -> Span { (self.new_span)(span) } } diff --git a/src/libsyntax/oldvisit.rs b/src/libsyntax/oldvisit.rs index e1dcdb9222c..1c7e9d66191 100644 --- a/src/libsyntax/oldvisit.rs +++ b/src/libsyntax/oldvisit.rs @@ -11,7 +11,7 @@ use abi::AbiSet; use ast::*; use ast; -use codemap::span; +use codemap::Span; use parse; use opt_vec; use opt_vec::OptVec; @@ -71,7 +71,7 @@ pub fn generics_of_fn(fk: &fn_kind) -> Generics { } pub struct Visitor<E> { - visit_mod: @fn(&_mod, span, NodeId, (E, vt<E>)), + visit_mod: @fn(&_mod, Span, NodeId, (E, vt<E>)), visit_view_item: @fn(&view_item, (E, vt<E>)), visit_foreign_item: @fn(@foreign_item, (E, vt<E>)), visit_item: @fn(@item, (E, vt<E>)), @@ -85,7 +85,7 @@ pub struct Visitor<E> { visit_expr_post: @fn(@expr, (E, vt<E>)), visit_ty: @fn(&Ty, (E, vt<E>)), visit_generics: @fn(&Generics, (E, vt<E>)), - visit_fn: @fn(&fn_kind, &fn_decl, &Block, span, NodeId, (E, vt<E>)), + visit_fn: @fn(&fn_kind, &fn_decl, &Block, Span, NodeId, (E, vt<E>)), visit_ty_method: @fn(&TypeMethod, (E, vt<E>)), visit_trait_method: @fn(&trait_method, (E, vt<E>)), visit_struct_def: @fn(@struct_def, ident, &Generics, NodeId, (E, vt<E>)), @@ -123,7 +123,7 @@ pub fn visit_crate<E:Clone>(c: &Crate, (e, v): (E, vt<E>)) { } pub fn visit_mod<E:Clone>(m: &_mod, - _sp: span, + _sp: Span, _id: NodeId, (e, v): (E, vt<E>)) { for vi in m.view_items.iter() { @@ -396,7 +396,7 @@ pub fn visit_method_helper<E:Clone>(m: &method, (e, v): (E, vt<E>)) { pub fn visit_fn<E:Clone>(fk: &fn_kind, decl: &fn_decl, body: &Block, - _sp: span, + _sp: Span, _id: NodeId, (e, v): (E, vt<E>)) { visit_fn_decl(decl, (e.clone(), v)); @@ -595,7 +595,7 @@ pub fn visit_arm<E:Clone>(a: &arm, (e, v): (E, vt<E>)) { // calls the given functions on the nodes. pub struct SimpleVisitor { - visit_mod: @fn(&_mod, span, NodeId), + visit_mod: @fn(&_mod, Span, NodeId), visit_view_item: @fn(&view_item), visit_foreign_item: @fn(@foreign_item), visit_item: @fn(@item), @@ -609,7 +609,7 @@ pub struct SimpleVisitor { visit_expr_post: @fn(@expr), visit_ty: @fn(&Ty), visit_generics: @fn(&Generics), - visit_fn: @fn(&fn_kind, &fn_decl, &Block, span, NodeId), + visit_fn: @fn(&fn_kind, &fn_decl, &Block, Span, NodeId), visit_ty_method: @fn(&TypeMethod), visit_trait_method: @fn(&trait_method), visit_struct_def: @fn(@struct_def, ident, &Generics, NodeId), @@ -648,9 +648,9 @@ pub fn default_simple_visitor() -> @SimpleVisitor { pub fn mk_simple_visitor(v: simple_visitor) -> vt<()> { fn v_mod( - f: @fn(&_mod, span, NodeId), + f: @fn(&_mod, Span, NodeId), m: &_mod, - sp: span, + sp: Span, id: NodeId, (e, v): ((), vt<()>) ) { @@ -734,11 +734,11 @@ pub fn mk_simple_visitor(v: simple_visitor) -> vt<()> { visit_generics(ps, (e, v)); } fn v_fn( - f: @fn(&fn_kind, &fn_decl, &Block, span, NodeId), + f: @fn(&fn_kind, &fn_decl, &Block, Span, NodeId), fk: &fn_kind, decl: &fn_decl, body: &Block, - sp: span, + sp: Span, id: NodeId, (e, v): ((), vt<()>) ) { diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index 78fc1f0babc..1bc334f1140 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -9,7 +9,7 @@ // except according to those terms. use ast; -use codemap::{spanned, mk_sp}; +use codemap::{spanned, Spanned, mk_sp}; use parse::common::*; //resolve bug? use parse::token; use parse::parser::Parser; @@ -95,7 +95,7 @@ impl parser_attr for Parser { } else { ast::AttrOuter }; - return spanned { + return Spanned { span: span, node: ast::Attribute_ { style: style, diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index c7b247f2dd2..26d66cfcaab 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -9,7 +9,7 @@ // except according to those terms. use ast; -use codemap::{BytePos, CharPos, CodeMap, Pos, span}; +use codemap::{BytePos, CharPos, CodeMap, Pos, Span}; use codemap; use diagnostic::span_handler; use ext::tt::transcribe::{tt_next_token}; @@ -36,7 +36,7 @@ pub trait reader { #[deriving(Clone, Eq)] pub struct TokenAndSpan { tok: token::Token, - sp: span, + sp: Span, } pub struct StringReader { @@ -53,7 +53,7 @@ pub struct StringReader { filemap: @codemap::FileMap, /* cached: */ peek_tok: token::Token, - peek_span: span + peek_span: Span } pub fn new_string_reader(span_diagnostic: @mut span_handler, @@ -798,7 +798,7 @@ mod test { use super::*; use ast; - use codemap::{BytePos, CodeMap, span}; + use codemap::{BytePos, CodeMap, Span}; use diagnostic; use parse::token; use parse::token::{str_to_ident}; @@ -827,7 +827,7 @@ mod test { let tok1 = string_reader.next_token(); let tok2 = TokenAndSpan{ tok:token::IDENT(id, false), - sp:span {lo:BytePos(21),hi:BytePos(23),expn_info: None}}; + sp:Span {lo:BytePos(21),hi:BytePos(23),expn_info: None}}; assert_eq!(tok1,tok2); // the 'main' id is already read: assert_eq!(string_reader.last_pos.clone(), BytePos(28)); @@ -835,7 +835,7 @@ mod test { let tok3 = string_reader.next_token(); let tok4 = TokenAndSpan{ tok:token::IDENT(str_to_ident("main"), false), - sp:span {lo:BytePos(24),hi:BytePos(28),expn_info: None}}; + sp:Span {lo:BytePos(24),hi:BytePos(28),expn_info: None}}; assert_eq!(tok3,tok4); // the lparen is already read: assert_eq!(string_reader.last_pos.clone(), BytePos(29)) diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 61dcc6c1947..ea1c9ce9b1e 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -13,7 +13,7 @@ use ast::NodeId; use ast; -use codemap::{span, CodeMap, FileMap, FileSubstr}; +use codemap::{Span, CodeMap, FileMap, FileSubstr}; use codemap; use diagnostic::{span_handler, mk_span_handler, mk_handler, Emitter}; use parse::attr::parser_attr; @@ -247,7 +247,7 @@ pub fn new_sub_parser_from_file( sess: @mut ParseSess, cfg: ast::CrateConfig, path: &Path, - sp: span + sp: Span ) -> Parser { filemap_to_parser(sess,file_to_filemap(sess,path,Some(sp)),cfg) } @@ -272,7 +272,7 @@ pub fn new_parser_from_tts(sess: @mut ParseSess, /// Given a session and a path and an optional span (for error reporting), /// add the path to the session's codemap and return the new filemap. -pub fn file_to_filemap(sess: @mut ParseSess, path: &Path, spanopt: Option<span>) +pub fn file_to_filemap(sess: @mut ParseSess, path: &Path, spanopt: Option<Span>) -> @FileMap { match io::read_whole_file_str(path) { Ok(src) => string_to_filemap(sess, src.to_managed(), path.to_str().to_managed()), @@ -332,7 +332,7 @@ mod test { use extra::serialize::Encodable; use extra; use std::io; - use codemap::{span, BytePos, spanned}; + use codemap::{Span, BytePos, Spanned}; use opt_vec; use ast; use abi; @@ -357,8 +357,8 @@ mod test { } // produce a codemap::span - fn sp (a: uint, b: uint) -> span { - span{lo:BytePos(a),hi:BytePos(b),expn_info:None} + fn sp (a: uint, b: uint) -> Span { + Span{lo:BytePos(a),hi:BytePos(b),expn_info:None} } #[test] fn path_exprs_1() { @@ -463,7 +463,7 @@ mod test { #[test] fn parse_stmt_1 () { assert_eq!(string_to_stmt(@"b;"), - @spanned{ + @Spanned{ node: ast::stmt_expr(@ast::expr { id: 1, node: ast::expr_path(ast::Path { @@ -571,7 +571,7 @@ mod test { }, ast::Block { view_items: ~[], - stmts: ~[@spanned{ + stmts: ~[@Spanned{ node: ast::stmt_semi(@ast::expr{ id: 6, node: ast::expr_path( diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index ab1bde3a3b9..62cf856a2c8 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -19,7 +19,7 @@ removed. use ast::{expr, expr_lit, lit_nil, Attribute}; use ast; -use codemap::{span, respan}; +use codemap::{Span, respan}; use parse::parser::Parser; use parse::token::{keywords, Token}; use parse::token; @@ -76,12 +76,12 @@ impl to_bytes::IterBytes for ObsoleteSyntax { pub trait ParserObsoleteMethods { /// Reports an obsolete syntax non-fatal error. - fn obsolete(&self, sp: span, kind: ObsoleteSyntax); + fn obsolete(&self, sp: Span, kind: ObsoleteSyntax); // Reports an obsolete syntax non-fatal error, and returns // a placeholder expression - fn obsolete_expr(&self, sp: span, kind: ObsoleteSyntax) -> @expr; + fn obsolete_expr(&self, sp: Span, kind: ObsoleteSyntax) -> @expr; fn report(&self, - sp: span, + sp: Span, kind: ObsoleteSyntax, kind_str: &str, desc: &str); @@ -94,7 +94,7 @@ pub trait ParserObsoleteMethods { impl ParserObsoleteMethods for Parser { /// Reports an obsolete syntax non-fatal error. - fn obsolete(&self, sp: span, kind: ObsoleteSyntax) { + fn obsolete(&self, sp: Span, kind: ObsoleteSyntax) { let (kind_str, desc) = match kind { ObsoleteLet => ( "`let` in field declaration", @@ -263,13 +263,13 @@ impl ParserObsoleteMethods for Parser { // Reports an obsolete syntax non-fatal error, and returns // a placeholder expression - fn obsolete_expr(&self, sp: span, kind: ObsoleteSyntax) -> @expr { + fn obsolete_expr(&self, sp: Span, kind: ObsoleteSyntax) -> @expr { self.obsolete(sp, kind); self.mk_expr(sp.lo, sp.hi, expr_lit(@respan(sp, lit_nil))) } fn report(&self, - sp: span, + sp: Span, kind: ObsoleteSyntax, kind_str: &str, desc: &str) { diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index ea7a7540e36..ea3437820a1 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -62,7 +62,7 @@ use ast::visibility; use ast; use ast_util::{as_prec, operator_prec}; use ast_util; -use codemap::{span, BytePos, spanned, mk_sp}; +use codemap::{Span, BytePos, Spanned, spanned, mk_sp}; use codemap; use parse::attr::parser_attr; use parse::classify; @@ -321,9 +321,9 @@ pub struct Parser { // the current token: token: @mut token::Token, // the span of the current token: - span: @mut span, + span: @mut Span, // the span of the prior token: - last_span: @mut span, + last_span: @mut Span, // the previous token or None (only stashed sometimes). last_token: @mut Option<~token::Token>, buffer: @mut [TokenAndSpan, ..4], @@ -666,7 +666,7 @@ impl Parser { ket: &token::Token, sep: SeqSep, f: &fn(&Parser) -> T) - -> spanned<~[T]> { + -> Spanned<~[T]> { let lo = self.span.lo; self.expect(bra); let result = self.parse_seq_to_before_end(ket, sep, f); @@ -736,10 +736,10 @@ impl Parser { pub fn fatal(&self, m: &str) -> ! { self.sess.span_diagnostic.span_fatal(*self.span, m) } - pub fn span_fatal(&self, sp: span, m: &str) -> ! { + pub fn span_fatal(&self, sp: Span, m: &str) -> ! { self.sess.span_diagnostic.span_fatal(sp, m) } - pub fn span_note(&self, sp: span, m: &str) { + pub fn span_note(&self, sp: Span, m: &str) { self.sess.span_diagnostic.span_note(sp, m) } pub fn bug(&self, m: &str) -> ! { @@ -748,7 +748,7 @@ impl Parser { pub fn warn(&self, m: &str) { self.sess.span_diagnostic.span_warn(*self.span, m) } - pub fn span_err(&self, sp: span, m: &str) { + pub fn span_err(&self, sp: Span, m: &str) { self.sess.span_diagnostic.span_err(sp, m) } pub fn abort_if_errors(&self) { @@ -1349,7 +1349,7 @@ impl Parser { let lit = self.lit_from_token(&token); lit }; - codemap::spanned { node: lit, span: mk_sp(lo, self.last_span.hi) } + codemap::Spanned { node: lit, span: mk_sp(lo, self.last_span.hi) } } // matches '-' lit | lit @@ -1686,14 +1686,14 @@ impl Parser { pub fn mk_mac_expr(&self, lo: BytePos, hi: BytePos, m: mac_) -> @expr { @expr { id: self.get_id(), - node: expr_mac(codemap::spanned {node: m, span: mk_sp(lo, hi)}), + node: expr_mac(codemap::Spanned {node: m, span: mk_sp(lo, hi)}), span: mk_sp(lo, hi), } } pub fn mk_lit_u32(&self, i: u32) -> @expr { let span = self.span; - let lv_lit = @codemap::spanned { + let lv_lit = @codemap::Spanned { node: lit_uint(i as u64, ty_u32), span: *span }; @@ -2060,7 +2060,7 @@ impl Parser { ); let (s, z) = p.parse_sep_and_zerok(); let seq = match seq { - spanned { node, _ } => node, + Spanned { node, _ } => node, }; tt_seq( mk_sp(sp.lo, p.span.hi), @@ -2219,7 +2219,7 @@ impl Parser { hi = e.span.hi; // HACK: turn &[...] into a &-evec ex = match e.node { - expr_vec(*) | expr_lit(@codemap::spanned { + expr_vec(*) | expr_lit(@codemap::Spanned { node: lit_str(_), span: _ }) if m == m_imm => { @@ -2244,7 +2244,7 @@ impl Parser { expr_vec(*) | expr_repeat(*) if m == m_mutbl => expr_vstore(e, expr_vstore_mut_box), expr_vec(*) | - expr_lit(@codemap::spanned { node: lit_str(_), span: _}) | + expr_lit(@codemap::Spanned { node: lit_str(_), span: _}) | expr_repeat(*) if m == m_imm => expr_vstore(e, expr_vstore_box), _ => self.mk_unary(box(m), e) }; @@ -2261,7 +2261,7 @@ impl Parser { // HACK: turn ~[...] into a ~-evec ex = match e.node { expr_vec(*) | - expr_lit(@codemap::spanned { node: lit_str(_), span: _}) | + expr_lit(@codemap::Spanned { node: lit_str(_), span: _}) | expr_repeat(*) => expr_vstore(e, expr_vstore_uniq), _ => self.mk_unary(uniq, e) }; @@ -2789,7 +2789,7 @@ impl Parser { // HACK: parse @"..." as a literal of a vstore @str pat = match sub.node { pat_lit(e@@expr { - node: expr_lit(@codemap::spanned { + node: expr_lit(@codemap::Spanned { node: lit_str(_), span: _}), _ }) => { @@ -2817,7 +2817,7 @@ impl Parser { // HACK: parse ~"..." as a literal of a vstore ~str pat = match sub.node { pat_lit(e@@expr { - node: expr_lit(@codemap::spanned { + node: expr_lit(@codemap::Spanned { node: lit_str(_), span: _}), _ }) => { @@ -2846,7 +2846,7 @@ impl Parser { // HACK: parse &"..." as a literal of a borrowed str pat = match sub.node { pat_lit(e@@expr { - node: expr_lit(@codemap::spanned { + node: expr_lit(@codemap::Spanned { node: lit_str(_), span: _}), _ }) => { let vst = @expr { @@ -2884,7 +2884,7 @@ impl Parser { if *self.token == token::RPAREN { hi = self.span.hi; self.bump(); - let lit = @codemap::spanned { + let lit = @codemap::Spanned { node: lit_nil, span: mk_sp(lo, hi)}; let expr = self.mk_expr(lo, hi, expr_lit(lit)); @@ -3320,7 +3320,7 @@ impl Parser { match *self.token { token::SEMI => { self.bump(); - stmts.push(@codemap::spanned { + stmts.push(@codemap::Spanned { node: stmt_semi(e, stmt_id), span: stmt.span, }); @@ -3357,7 +3357,7 @@ impl Parser { if has_semi { self.bump(); - stmts.push(@codemap::spanned { + stmts.push(@codemap::Spanned { node: stmt_mac((*m).clone(), true), span: stmt.span, }); @@ -4125,7 +4125,7 @@ impl Parser { fn eval_src_mod(&self, id: ast::ident, outer_attrs: &[ast::Attribute], - id_sp: span) + id_sp: Span) -> (ast::item_, ~[ast::Attribute]) { let prefix = Path(self.sess.cm.span_to_filename(*self.span)); let prefix = prefix.dir_path(); @@ -4173,7 +4173,7 @@ impl Parser { fn eval_src_mod_from_path(&self, path: Path, outer_attrs: ~[ast::Attribute], - id_sp: span) -> (ast::item_, ~[ast::Attribute]) { + id_sp: Span) -> (ast::item_, ~[ast::Attribute]) { let full_path = path.normalize(); let maybe_i = do self.sess.included_mod_stack.iter().position |p| { *p == full_path }; @@ -4797,7 +4797,7 @@ impl Parser { }; // single-variant-enum... : let m = ast::mac_invoc_tt(pth, tts); - let m: ast::mac = codemap::spanned { node: m, + let m: ast::mac = codemap::Spanned { node: m, span: mk_sp(self.span.lo, self.span.hi) }; let item_ = item_mac(m); diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 9c31d982590..599092f4b14 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -258,10 +258,10 @@ pub fn bopen(s: @ps) { end(s); // close the head-box } -pub fn bclose_(s: @ps, span: codemap::span, indented: uint) { +pub fn bclose_(s: @ps, span: codemap::Span, indented: uint) { bclose_maybe_open(s, span, indented, true); } -pub fn bclose_maybe_open (s: @ps, span: codemap::span, indented: uint, +pub fn bclose_maybe_open (s: @ps, span: codemap::Span, indented: uint, close_box: bool) { maybe_print_comment(s, span.hi); break_offset_if_not_bol(s, 1u, -(indented as int)); @@ -270,7 +270,7 @@ pub fn bclose_maybe_open (s: @ps, span: codemap::span, indented: uint, end(s); // close the outer-box } } -pub fn bclose(s: @ps, span: codemap::span) { bclose_(s, span, indent_unit); } +pub fn bclose(s: @ps, span: codemap::Span) { bclose_(s, span, indent_unit); } pub fn is_begin(s: @ps) -> bool { match s.s.last_token() { pp::BEGIN(_) => true, _ => false } @@ -328,7 +328,7 @@ pub fn commasep<T>(s: @ps, b: breaks, elts: &[T], op: &fn(@ps, &T)) { pub fn commasep_cmnt<T>(s: @ps, b: breaks, elts: &[T], op: &fn(@ps, &T), - get_span: &fn(&T) -> codemap::span) { + get_span: &fn(&T) -> codemap::Span) { box(s, 0u, b); let len = elts.len(); let mut i = 0u; @@ -618,7 +618,7 @@ pub fn print_item(s: @ps, item: &ast::item) { } bclose(s, item.span); } - ast::item_mac(codemap::spanned { node: ast::mac_invoc_tt(ref pth, ref tts), + ast::item_mac(codemap::Spanned { node: ast::mac_invoc_tt(ref pth, ref tts), _}) => { print_visibility(s, item.vis); print_path(s, pth, false); @@ -640,7 +640,7 @@ fn print_trait_ref(s: @ps, t: &ast::trait_ref) { pub fn print_enum_def(s: @ps, enum_definition: &ast::enum_def, generics: &ast::Generics, ident: ast::ident, - span: codemap::span, visibility: ast::visibility) { + span: codemap::Span, visibility: ast::visibility) { head(s, visibility_qualified(visibility, "enum")); print_ident(s, ident); print_generics(s, generics); @@ -650,7 +650,7 @@ pub fn print_enum_def(s: @ps, enum_definition: &ast::enum_def, pub fn print_variants(s: @ps, variants: &[ast::variant], - span: codemap::span) { + span: codemap::Span) { bopen(s); for v in variants.iter() { space_if_not_bol(s); @@ -692,7 +692,7 @@ pub fn print_struct(s: @ps, struct_def: &ast::struct_def, generics: &ast::Generics, ident: ast::ident, - span: codemap::span) { + span: codemap::Span) { print_ident(s, ident); print_generics(s, generics); if ast_util::struct_def_is_tuple_like(struct_def) { @@ -1111,7 +1111,7 @@ pub fn print_expr(s: @ps, expr: &ast::expr) { print_expr(s, field.expr); end(s); } - fn get_span(field: &ast::Field) -> codemap::span { return field.span; } + fn get_span(field: &ast::Field) -> codemap::Span { return field.span; } maybe_print_comment(s, expr.span.lo); ibox(s, indent_unit); @@ -1614,7 +1614,7 @@ pub fn print_pat(s: @ps, pat: &ast::pat) { print_pat(s, f.pat); end(s); } - fn get_span(f: &ast::field_pat) -> codemap::span { return f.pat.span; } + fn get_span(f: &ast::field_pat) -> codemap::Span { return f.pat.span; } commasep_cmnt(s, consistent, *fields, |s, f| print_field(s,f), get_span); @@ -1997,7 +1997,7 @@ pub fn print_ty_fn(s: @ps, end(s); } -pub fn maybe_print_trailing_comment(s: @ps, span: codemap::span, +pub fn maybe_print_trailing_comment(s: @ps, span: codemap::Span, next_pos: Option<BytePos>) { let cm; match s.cm { Some(ccm) => cm = ccm, _ => return } diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 79304aebea2..0656ed1372d 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -11,7 +11,7 @@ use abi::AbiSet; use ast::*; use ast; -use codemap::span; +use codemap::Span; use parse; use opt_vec; use opt_vec::OptVec; @@ -67,7 +67,7 @@ pub fn generics_of_fn(fk: &fn_kind) -> Generics { } pub trait Visitor<E:Clone> { - fn visit_mod(&mut self, m:&_mod, _s:span, _n:NodeId, e:E) { walk_mod(self, m, e) } + fn visit_mod(&mut self, m:&_mod, _s:Span, _n:NodeId, e:E) { walk_mod(self, m, e) } fn visit_view_item(&mut self, i:&view_item, e:E) { walk_view_item(self, i, e) } fn visit_foreign_item(&mut self, i:@foreign_item, e:E) { walk_foreign_item(self, i, e) } fn visit_item(&mut self, i:@item, e:E) { walk_item(self, i, e) } @@ -81,7 +81,7 @@ pub trait Visitor<E:Clone> { fn visit_expr_post(&mut self, _ex:@expr, _e:E) { } fn visit_ty(&mut self, _t:&Ty, _e:E) { } fn visit_generics(&mut self, g:&Generics, e:E) { walk_generics(self, g, e) } - fn visit_fn(&mut self, fk:&fn_kind, fd:&fn_decl, b:&Block, s:span, n:NodeId, e:E) { + fn visit_fn(&mut self, fk:&fn_kind, fd:&fn_decl, b:&Block, s:Span, n:NodeId, e:E) { walk_fn(self, fk, fd, b, s, n , e) } fn visit_ty_method(&mut self, t:&TypeMethod, e:E) { walk_ty_method(self, t, e) } @@ -93,7 +93,7 @@ pub trait Visitor<E:Clone> { } impl<E:Clone> Visitor<E> for @mut Visitor<E> { - fn visit_mod(&mut self, a:&_mod, b:span, c:NodeId, e:E) { + fn visit_mod(&mut self, a:&_mod, b:Span, c:NodeId, e:E) { (*self).visit_mod(a, b, c, e) } fn visit_view_item(&mut self, a:&view_item, e:E) { @@ -135,7 +135,7 @@ impl<E:Clone> Visitor<E> for @mut Visitor<E> { fn visit_generics(&mut self, a:&Generics, e:E) { (*self).visit_generics(a, e) } - fn visit_fn(&mut self, a:&fn_kind, b:&fn_decl, c:&Block, d:span, f:NodeId, e:E) { + fn visit_fn(&mut self, a:&fn_kind, b:&fn_decl, c:&Block, d:Span, f:NodeId, e:E) { (*self).visit_fn(a, b, c, d, f, e) } fn visit_ty_method(&mut self, a:&TypeMethod, e:E) { @@ -444,7 +444,7 @@ pub fn walk_fn<E:Clone, V:Visitor<E>>(visitor: &mut V, function_kind: &fn_kind, function_declaration: &fn_decl, function_body: &Block, - _: span, + _: Span, _: NodeId, env: E) { walk_fn_decl(visitor, function_declaration, env.clone()); @@ -676,7 +676,7 @@ pub fn walk_arm<E:Clone, V:Visitor<E>>(visitor: &mut V, arm: &arm, env: E) { // calls the given functions on the nodes. pub trait SimpleVisitor { - fn visit_mod(&mut self, &_mod, span, NodeId); + fn visit_mod(&mut self, &_mod, Span, NodeId); fn visit_view_item(&mut self, &view_item); fn visit_foreign_item(&mut self, @foreign_item); fn visit_item(&mut self, @item); @@ -690,7 +690,7 @@ pub trait SimpleVisitor { fn visit_expr_post(&mut self, @expr); fn visit_ty(&mut self, &Ty); fn visit_generics(&mut self, &Generics); - fn visit_fn(&mut self, &fn_kind, &fn_decl, &Block, span, NodeId); + fn visit_fn(&mut self, &fn_kind, &fn_decl, &Block, Span, NodeId); fn visit_ty_method(&mut self, &TypeMethod); fn visit_trait_method(&mut self, &trait_method); fn visit_struct_def(&mut self, @struct_def, ident, &Generics, NodeId); @@ -705,7 +705,7 @@ pub struct SimpleVisitorVisitor { impl Visitor<()> for SimpleVisitorVisitor { fn visit_mod(&mut self, module: &_mod, - span: span, + span: Span, node_id: NodeId, env: ()) { self.simple_visitor.visit_mod(module, span, node_id); @@ -766,7 +766,7 @@ impl Visitor<()> for SimpleVisitorVisitor { function_kind: &fn_kind, function_declaration: &fn_decl, block: &Block, - span: span, + span: Span, node_id: NodeId, env: ()) { self.simple_visitor.visit_fn(function_kind, |
