From 3c7aea3a6a5fcf04066d0368bfd6618e9494176c Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 17 Apr 2013 12:15:08 -0400 Subject: syntax: de-mode and prepare for de-modeing rustc --- src/libsyntax/codemap.rs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/libsyntax/codemap.rs') diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 0ed371d9c9a..bd8aa7011b7 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -71,7 +71,7 @@ impl Sub for BytePos { } impl to_bytes::IterBytes for BytePos { - fn iter_bytes(&self, +lsb0: bool, &&f: to_bytes::Cb) { + fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) { (**self).iter_bytes(lsb0, f) } } @@ -89,7 +89,7 @@ impl cmp::Ord for CharPos { } impl to_bytes::IterBytes for CharPos { - fn iter_bytes(&self, +lsb0: bool, &&f: to_bytes::Cb) { + fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) { (**self).iter_bytes(lsb0, f) } } @@ -141,20 +141,20 @@ impl Decodable for span { } } -pub fn spanned(+lo: BytePos, +hi: BytePos, +t: T) -> spanned { +pub fn spanned(lo: BytePos, hi: BytePos, t: T) -> spanned { respan(mk_sp(lo, hi), t) } -pub fn respan(sp: span, +t: T) -> spanned { +pub fn respan(sp: span, t: T) -> spanned { spanned {node: t, span: sp} } -pub fn dummy_spanned(+t: T) -> spanned { +pub fn dummy_spanned(t: T) -> spanned { respan(dummy_sp(), t) } /* assuming that we're not in macro expansion */ -pub fn mk_sp(+lo: BytePos, +hi: BytePos) -> span { +pub fn mk_sp(lo: BytePos, hi: BytePos) -> span { span {lo: lo, hi: hi, expn_info: None} } @@ -247,7 +247,7 @@ pub impl FileMap { // UNCHECKED INVARIANT: these offsets must be added in the right // order and must be in the right places; there is shared knowledge // about what ends a line between this file and parse.rs - fn next_line(&self, +pos: BytePos) { + fn next_line(&self, pos: BytePos) { // the new charpos must be > the last one (or it's the first one). let lines = &mut *self.lines; assert!((lines.len() == 0) || (lines[lines.len() - 1] < pos)); @@ -287,14 +287,14 @@ pub impl CodeMap { } /// Add a new FileMap to the CodeMap and return it - fn new_filemap(&self, +filename: FileName, src: @~str) -> @FileMap { + fn new_filemap(&self, filename: FileName, src: @~str) -> @FileMap { return self.new_filemap_w_substr(filename, FssNone, src); } fn new_filemap_w_substr( &self, - +filename: FileName, - +substr: FileSubstr, + filename: FileName, + substr: FileSubstr, src: @~str ) -> @FileMap { let files = &mut *self.files; @@ -325,11 +325,11 @@ pub impl CodeMap { } /// Lookup source information about a BytePos - pub fn lookup_char_pos(&self, +pos: BytePos) -> Loc { + pub fn lookup_char_pos(&self, pos: BytePos) -> Loc { return self.lookup_pos(pos); } - pub fn lookup_char_pos_adj(&self, +pos: BytePos) -> LocWithOpt + pub fn lookup_char_pos_adj(&self, pos: BytePos) -> LocWithOpt { let loc = self.lookup_char_pos(pos); match (loc.file.substr) { @@ -405,7 +405,7 @@ pub impl CodeMap { priv impl CodeMap { - fn lookup_filemap_idx(&self, +pos: BytePos) -> uint { + fn lookup_filemap_idx(&self, pos: BytePos) -> uint { let files = &*self.files; let len = files.len(); let mut a = 0u; @@ -440,7 +440,7 @@ priv impl CodeMap { return FileMapAndLine {fm: f, line: a}; } - fn lookup_pos(&self, +pos: BytePos) -> Loc { + fn lookup_pos(&self, pos: BytePos) -> Loc { let FileMapAndLine {fm: f, line: a} = self.lookup_line(pos); let line = a + 1u; // Line numbers start at 1 let chpos = self.bytepos_to_local_charpos(pos); @@ -466,7 +466,7 @@ priv impl CodeMap { lo.line, lo.col.to_uint(), hi.line, hi.col.to_uint()) } - fn lookup_byte_offset(&self, +bpos: BytePos) + fn lookup_byte_offset(&self, bpos: BytePos) -> FileMapAndBytePos { let idx = self.lookup_filemap_idx(bpos); let fm = self.files[idx]; @@ -476,7 +476,7 @@ priv impl CodeMap { // Converts an absolute BytePos to a CharPos relative to the file it is // located in - fn bytepos_to_local_charpos(&self, +bpos: BytePos) -> CharPos { + fn bytepos_to_local_charpos(&self, bpos: BytePos) -> CharPos { debug!("codemap: converting %? to char pos", bpos); let idx = self.lookup_filemap_idx(bpos); let map = self.files[idx]; -- cgit 1.4.1-3-g733a5