From 6c3b0705ee2e409044029de1b180d8464f6e16e6 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 22 Apr 2019 16:48:34 -0700 Subject: [PATCH] Rename codemap to source map --- src/fallback.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/fallback.rs b/src/fallback.rs index 2ce32f13..f40a8746 100644 --- a/src/fallback.rs +++ b/src/fallback.rs @@ -35,8 +35,8 @@ impl TokenStream { #[cfg(span_locations)] fn get_cursor(src: &str) -> Cursor { - // Create a dummy file & add it to the codemap - CODEMAP.with(|cm| { + // Create a dummy file & add it to the source map + SOURCE_MAP.with(|cm| { let mut cm = cm.borrow_mut(); let name = format!("", cm.files.len()); let span = cm.add_file(&name, src); @@ -56,7 +56,7 @@ impl FromStr for TokenStream { type Err = LexError; fn from_str(src: &str) -> Result { - // Create a dummy file & add it to the codemap + // Create a dummy file & add it to the source map let cursor = get_cursor(src); match token_stream(cursor) { @@ -225,7 +225,7 @@ pub struct LineColumn { #[cfg(span_locations)] thread_local! { - static CODEMAP: RefCell = RefCell::new(Codemap { + static SOURCE_MAP: RefCell = RefCell::new(SourceMap { // NOTE: We start with a single dummy file which all call_site() and // def_site() spans reference. files: vec![{ @@ -295,12 +295,12 @@ fn lines_offsets(s: &str) -> Vec { } #[cfg(span_locations)] -struct Codemap { +struct SourceMap { files: Vec, } #[cfg(span_locations)] -impl Codemap { +impl SourceMap { fn next_start_pos(&self) -> u32 { // Add 1 so there's always space between files. // @@ -384,7 +384,7 @@ impl Span { #[cfg(procmacro2_semver_exempt)] pub fn source_file(&self) -> SourceFile { - CODEMAP.with(|cm| { + SOURCE_MAP.with(|cm| { let cm = cm.borrow(); let fi = cm.fileinfo(*self); SourceFile { @@ -395,7 +395,7 @@ impl Span { #[cfg(span_locations)] pub fn start(&self) -> LineColumn { - CODEMAP.with(|cm| { + SOURCE_MAP.with(|cm| { let cm = cm.borrow(); let fi = cm.fileinfo(*self); fi.offset_line_column(self.lo as usize) @@ -404,7 +404,7 @@ impl Span { #[cfg(span_locations)] pub fn end(&self) -> LineColumn { - CODEMAP.with(|cm| { + SOURCE_MAP.with(|cm| { let cm = cm.borrow(); let fi = cm.fileinfo(*self); fi.offset_line_column(self.hi as usize) @@ -413,7 +413,7 @@ impl Span { #[cfg(procmacro2_semver_exempt)] pub fn join(&self, other: Span) -> Option { - CODEMAP.with(|cm| { + SOURCE_MAP.with(|cm| { let cm = cm.borrow(); // If `other` is not within the same FileInfo as us, return None. if !cm.fileinfo(*self).span_within(other) {