@@ -228,15 +228,15 @@ impl FileMap {
228228 pub fn next_line ( & self , pos : BytePos ) {
229229 // the new charpos must be > the last one (or it's the first one).
230230 let mut lines = self . lines . borrow_mut ( ) ; ;
231- let line_len = lines. get ( ) . len ( ) ;
232- assert ! ( line_len == 0 || ( * lines. get( ) . get ( line_len - 1 ) < pos) )
233- lines. get ( ) . push ( pos) ;
231+ let line_len = lines. len ( ) ;
232+ assert ! ( line_len == 0 || ( * lines. get( line_len - 1 ) < pos) )
233+ lines. push ( pos) ;
234234 }
235235
236236 // get a line from the list of pre-computed line-beginnings
237237 pub fn get_line ( & self , line : int ) -> ~str {
238238 let mut lines = self . lines . borrow_mut ( ) ;
239- let begin: BytePos = * lines. get ( ) . get ( line as uint ) - self . start_pos ;
239+ let begin: BytePos = * lines. get ( line as uint ) - self . start_pos ;
240240 let begin = begin. to_uint ( ) ;
241241 let slice = self . src . slice_from ( begin) ;
242242 match slice. find ( '\n' ) {
@@ -251,7 +251,7 @@ impl FileMap {
251251 pos : pos,
252252 bytes : bytes,
253253 } ;
254- self . multibyte_chars . borrow_mut ( ) . get ( ) . push ( mbc) ;
254+ self . multibyte_chars . borrow_mut ( ) . push ( mbc) ;
255255 }
256256
257257 pub fn is_real_file ( & self ) -> bool {
@@ -272,9 +272,9 @@ impl CodeMap {
272272
273273 pub fn new_filemap ( & self , filename : FileName , src : ~str ) -> Rc < FileMap > {
274274 let mut files = self . files . borrow_mut ( ) ;
275- let start_pos = match files. get ( ) . last ( ) {
275+ let start_pos = match files. last ( ) {
276276 None => 0 ,
277- Some ( last) => last. deref ( ) . start_pos . to_uint ( ) + last. deref ( ) . src . len ( ) ,
277+ Some ( last) => last. start_pos . to_uint ( ) + last. src . len ( ) ,
278278 } ;
279279
280280 // Remove utf-8 BOM if any.
@@ -302,14 +302,14 @@ impl CodeMap {
302302 multibyte_chars : RefCell :: new ( Vec :: new ( ) ) ,
303303 } ) ;
304304
305- files. get ( ) . push ( filemap. clone ( ) ) ;
305+ files. push ( filemap. clone ( ) ) ;
306306
307307 filemap
308308 }
309309
310310 pub fn mk_substr_filename ( & self , sp : Span ) -> ~str {
311311 let pos = self . lookup_char_pos ( sp. lo ) ;
312- format ! ( "<{}:{}:{}>" , pos. file. deref ( ) . name, pos. line, pos. col. to_uint( ) + 1 )
312+ format ! ( "<{}:{}:{}>" , pos. file. name, pos. line, pos. col. to_uint( ) + 1 )
313313 }
314314
315315 /// Lookup source information about a BytePos
@@ -320,15 +320,15 @@ impl CodeMap {
320320 pub fn lookup_char_pos_adj ( & self , pos : BytePos ) -> LocWithOpt {
321321 let loc = self . lookup_char_pos ( pos) ;
322322 LocWithOpt {
323- filename : loc. file . deref ( ) . name . to_str ( ) ,
323+ filename : loc. file . name . to_str ( ) ,
324324 line : loc. line ,
325325 col : loc. col ,
326326 file : Some ( loc. file )
327327 }
328328 }
329329
330330 pub fn span_to_str ( & self , sp : Span ) -> ~str {
331- if self . files . borrow ( ) . get ( ) . len ( ) == 0 && sp == DUMMY_SP {
331+ if self . files . borrow ( ) . len ( ) == 0 && sp == DUMMY_SP {
332332 return ~"no-location";
333333 }
334334
@@ -339,7 +339,7 @@ impl CodeMap {
339339 }
340340
341341 pub fn span_to_filename ( & self , sp : Span ) -> FileName {
342- self . lookup_char_pos ( sp. lo ) . file . deref ( ) . name . to_str ( )
342+ self . lookup_char_pos ( sp. lo ) . file . name . to_str ( )
343343 }
344344
345345 pub fn span_to_lines ( & self , sp : Span ) -> FileLines {
@@ -360,16 +360,16 @@ impl CodeMap {
360360 // it's testing isn't true for all spans in the AST, so to allow the
361361 // caller to not have to fail (and it can't catch it since the CodeMap
362362 // isn't sendable), return None
363- if begin. fm . deref ( ) . start_pos != end. fm . deref ( ) . start_pos {
363+ if begin. fm . start_pos != end. fm . start_pos {
364364 None
365365 } else {
366- Some ( begin. fm . deref ( ) . src . slice ( begin. pos . to_uint ( ) , end. pos . to_uint ( ) ) . to_owned ( ) )
366+ Some ( begin. fm . src . slice ( begin. pos . to_uint ( ) , end. pos . to_uint ( ) ) . to_owned ( ) )
367367 }
368368 }
369369
370370 pub fn get_filemap ( & self , filename : & str ) -> Rc < FileMap > {
371- for fm in self . files . borrow ( ) . get ( ) . iter ( ) {
372- if filename == fm. deref ( ) . name {
371+ for fm in self . files . borrow ( ) . iter ( ) {
372+ if filename == fm. name {
373373 return fm. clone ( ) ;
374374 }
375375 }
@@ -378,13 +378,13 @@ impl CodeMap {
378378
379379 fn lookup_filemap_idx ( & self , pos : BytePos ) -> uint {
380380 let files = self . files . borrow ( ) ;
381- let files = files. get ( ) ;
381+ let files = files;
382382 let len = files. len ( ) ;
383383 let mut a = 0 u;
384384 let mut b = len;
385385 while b - a > 1 u {
386386 let m = ( a + b) / 2 u;
387- if files. get ( m) . deref ( ) . start_pos > pos {
387+ if files. get ( m) . start_pos > pos {
388388 b = m;
389389 } else {
390390 a = m;
@@ -394,8 +394,8 @@ impl CodeMap {
394394 // filemap, but are not the filemaps we want (because they are length 0, they cannot
395395 // contain what we are looking for). So, rewind until we find a useful filemap.
396396 loop {
397- let lines = files. get ( a) . deref ( ) . lines . borrow ( ) ;
398- let lines = lines. get ( ) ;
397+ let lines = files. get ( a) . lines . borrow ( ) ;
398+ let lines = lines;
399399 if lines. len ( ) > 0 {
400400 break ;
401401 }
@@ -415,14 +415,14 @@ impl CodeMap {
415415 let idx = self . lookup_filemap_idx ( pos) ;
416416
417417 let files = self . files . borrow ( ) ;
418- let f = files. get ( ) . get ( idx) . clone ( ) ;
418+ let f = files. get ( idx) . clone ( ) ;
419419 let mut a = 0 u;
420420 {
421- let mut lines = f. deref ( ) . lines . borrow_mut ( ) ;
422- let mut b = lines. get ( ) . len ( ) ;
421+ let mut lines = f. lines . borrow_mut ( ) ;
422+ let mut b = lines. len ( ) ;
423423 while b - a > 1 u {
424424 let m = ( a + b) / 2 u;
425- if * lines. get ( ) . get ( m) > pos { b = m; } else { a = m; }
425+ if * lines. get ( m) > pos { b = m; } else { a = m; }
426426 }
427427 }
428428 FileMapAndLine { fm : f, line : a}
@@ -432,7 +432,7 @@ impl CodeMap {
432432 let FileMapAndLine { fm : f, line : a} = self . lookup_line ( pos) ;
433433 let line = a + 1 u; // Line numbers start at 1
434434 let chpos = self . bytepos_to_file_charpos ( pos) ;
435- let linebpos = * f. deref ( ) . lines . borrow ( ) . get ( ) . get ( a) ;
435+ let linebpos = * f. lines . borrow ( ) . get ( a) ;
436436 let linechpos = self . bytepos_to_file_charpos ( linebpos) ;
437437 debug ! ( "codemap: byte pos {:?} is on the line at byte pos {:?}" ,
438438 pos, linebpos) ;
@@ -449,8 +449,8 @@ impl CodeMap {
449449
450450 fn lookup_byte_offset ( & self , bpos : BytePos ) -> FileMapAndBytePos {
451451 let idx = self . lookup_filemap_idx ( bpos) ;
452- let fm = self . files . borrow ( ) . get ( ) . get ( idx) . clone ( ) ;
453- let offset = bpos - fm. deref ( ) . start_pos ;
452+ let fm = self . files . borrow ( ) . get ( idx) . clone ( ) ;
453+ let offset = bpos - fm. start_pos ;
454454 FileMapAndBytePos { fm : fm, pos : offset}
455455 }
456456
@@ -459,12 +459,12 @@ impl CodeMap {
459459 debug ! ( "codemap: converting {:?} to char pos" , bpos) ;
460460 let idx = self . lookup_filemap_idx ( bpos) ;
461461 let files = self . files . borrow ( ) ;
462- let map = files. get ( ) . get ( idx) ;
462+ let map = files. get ( idx) ;
463463
464464 // The number of extra bytes due to multibyte chars in the FileMap
465465 let mut total_extra_bytes = 0 ;
466466
467- for mbc in map. deref ( ) . multibyte_chars . borrow ( ) . get ( ) . iter ( ) {
467+ for mbc in map. multibyte_chars . borrow ( ) . iter ( ) {
468468 debug ! ( "codemap: {:?}-byte char at {:?}" , mbc. bytes, mbc. pos) ;
469469 if mbc. pos < bpos {
470470 // every character is at least one byte, so we only
@@ -478,8 +478,8 @@ impl CodeMap {
478478 }
479479 }
480480
481- assert ! ( map. deref ( ) . start_pos. to_uint( ) + total_extra_bytes <= bpos. to_uint( ) ) ;
482- CharPos ( bpos. to_uint ( ) - map. deref ( ) . start_pos . to_uint ( ) - total_extra_bytes)
481+ assert ! ( map. start_pos. to_uint( ) + total_extra_bytes <= bpos. to_uint( ) ) ;
482+ CharPos ( bpos. to_uint ( ) - map. start_pos . to_uint ( ) - total_extra_bytes)
483483 }
484484}
485485
0 commit comments