Skip to content

Commit ed21fad

Browse files
authored
Merge pull request #173 from dtolnay/sourcemap
Rename codemap to source map
2 parents dd7a2a3 + 6c3b070 commit ed21fad

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/fallback.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ impl TokenStream {
3535

3636
#[cfg(span_locations)]
3737
fn get_cursor(src: &str) -> Cursor {
38-
// Create a dummy file & add it to the codemap
39-
CODEMAP.with(|cm| {
38+
// Create a dummy file & add it to the source map
39+
SOURCE_MAP.with(|cm| {
4040
let mut cm = cm.borrow_mut();
4141
let name = format!("<parsed string {}>", cm.files.len());
4242
let span = cm.add_file(&name, src);
@@ -56,7 +56,7 @@ impl FromStr for TokenStream {
5656
type Err = LexError;
5757

5858
fn from_str(src: &str) -> Result<TokenStream, LexError> {
59-
// Create a dummy file & add it to the codemap
59+
// Create a dummy file & add it to the source map
6060
let cursor = get_cursor(src);
6161

6262
match token_stream(cursor) {
@@ -225,7 +225,7 @@ pub struct LineColumn {
225225

226226
#[cfg(span_locations)]
227227
thread_local! {
228-
static CODEMAP: RefCell<Codemap> = RefCell::new(Codemap {
228+
static SOURCE_MAP: RefCell<SourceMap> = RefCell::new(SourceMap {
229229
// NOTE: We start with a single dummy file which all call_site() and
230230
// def_site() spans reference.
231231
files: vec![{
@@ -295,12 +295,12 @@ fn lines_offsets(s: &str) -> Vec<usize> {
295295
}
296296

297297
#[cfg(span_locations)]
298-
struct Codemap {
298+
struct SourceMap {
299299
files: Vec<FileInfo>,
300300
}
301301

302302
#[cfg(span_locations)]
303-
impl Codemap {
303+
impl SourceMap {
304304
fn next_start_pos(&self) -> u32 {
305305
// Add 1 so there's always space between files.
306306
//
@@ -384,7 +384,7 @@ impl Span {
384384

385385
#[cfg(procmacro2_semver_exempt)]
386386
pub fn source_file(&self) -> SourceFile {
387-
CODEMAP.with(|cm| {
387+
SOURCE_MAP.with(|cm| {
388388
let cm = cm.borrow();
389389
let fi = cm.fileinfo(*self);
390390
SourceFile {
@@ -395,7 +395,7 @@ impl Span {
395395

396396
#[cfg(span_locations)]
397397
pub fn start(&self) -> LineColumn {
398-
CODEMAP.with(|cm| {
398+
SOURCE_MAP.with(|cm| {
399399
let cm = cm.borrow();
400400
let fi = cm.fileinfo(*self);
401401
fi.offset_line_column(self.lo as usize)
@@ -404,7 +404,7 @@ impl Span {
404404

405405
#[cfg(span_locations)]
406406
pub fn end(&self) -> LineColumn {
407-
CODEMAP.with(|cm| {
407+
SOURCE_MAP.with(|cm| {
408408
let cm = cm.borrow();
409409
let fi = cm.fileinfo(*self);
410410
fi.offset_line_column(self.hi as usize)
@@ -413,7 +413,7 @@ impl Span {
413413

414414
#[cfg(procmacro2_semver_exempt)]
415415
pub fn join(&self, other: Span) -> Option<Span> {
416-
CODEMAP.with(|cm| {
416+
SOURCE_MAP.with(|cm| {
417417
let cm = cm.borrow();
418418
// If `other` is not within the same FileInfo as us, return None.
419419
if !cm.fileinfo(*self).span_within(other) {

0 commit comments

Comments
 (0)