Skip to content

Commit

Permalink
Debug impls for a few things in syntax::codemap
Browse files Browse the repository at this point in the history
  • Loading branch information
nrc committed Apr 9, 2015
1 parent 287a544 commit 613cf9a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/libsyntax/codemap.rs
Expand Up @@ -26,6 +26,8 @@ use std::num::ToPrimitive;
use std::ops::{Add, Sub};
use std::rc::Rc;

use std::fmt;

use libc::c_uint;
use serialize::{Encodable, Decodable, Encoder, Decoder};

Expand Down Expand Up @@ -199,6 +201,7 @@ pub fn original_sp(cm: &CodeMap, sp: Span, enclosing_sp: Span) -> Span {
//

/// A source code location used for error reporting
#[derive(Debug)]
pub struct Loc {
/// Information about the original source
pub file: Rc<FileMap>,
Expand All @@ -211,6 +214,7 @@ pub struct Loc {
/// A source code location used as the result of lookup_char_pos_adj
// Actually, *none* of the clients use the filename *or* file field;
// perhaps they should just be removed.
#[derive(Debug)]
pub struct LocWithOpt {
pub filename: FileName,
pub line: usize,
Expand All @@ -219,7 +223,9 @@ pub struct LocWithOpt {
}

// used to be structural records. Better names, anyone?
#[derive(Debug)]
pub struct FileMapAndLine { pub fm: Rc<FileMap>, pub line: usize }
#[derive(Debug)]
pub struct FileMapAndBytePos { pub fm: Rc<FileMap>, pub pos: BytePos }


Expand Down Expand Up @@ -449,6 +455,12 @@ impl Decodable for FileMap {
}
}

impl fmt::Debug for FileMap {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!(fmt, "FileMap({})", self.name)
}
}

impl FileMap {
/// EFFECT: register a start-of-line offset in the
/// table of line-beginnings.
Expand Down

0 comments on commit 613cf9a

Please sign in to comment.