From 18a825bda0a6098d3d8982784f3dffb908df5e40 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Mon, 12 Nov 2012 17:14:15 -0800 Subject: [PATCH] Reorder codemap decls --- src/libsyntax/codemap.rs | 64 ++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index a616e73e549..be7e2025120 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -39,8 +39,40 @@ export get_filemap; export new_codemap; +struct span {lo: uint, hi: uint, expn_info: expn_info} + +impl span : cmp::Eq { + pure fn eq(other: &span) -> bool { + return self.lo == (*other).lo && self.hi == (*other).hi; + } + pure fn ne(other: &span) -> bool { !self.eq(other) } +} + +impl span: Serializable { + /* Note #1972 -- spans are serialized but not deserialized */ + fn serialize(&self, _s: &S) { } +} + +impl span: Deserializable { + static fn deserialize(_d: &D) -> span { + ast_util::dummy_sp() + } +} + +enum expn_info_ { + expanded_from({call_site: span, + callie: {name: ~str, span: Option}}) +} +type expn_info = Option<@expn_info_>; + type filename = ~str; +type lookup_fn = pure fn(file_pos) -> uint; + +struct loc { + file: @filemap, line: uint, col: uint +} + struct file_pos { ch: uint, byte: uint } @@ -90,10 +122,6 @@ struct CodeMap { files: DVec<@filemap> } -struct loc { - file: @filemap, line: uint, col: uint -} - fn new_codemap() -> CodeMap { CodeMap { files: DVec() @@ -110,8 +138,6 @@ fn next_line(file: @filemap, chpos: uint, byte_pos: uint) { file.lines.push(file_pos {ch: chpos, byte: byte_pos + file.start_pos.byte}); } -type lookup_fn = pure fn(file_pos) -> uint; - fn lookup_line(map: @CodeMap, pos: uint, lookup: lookup_fn) -> {fm: @filemap, line: uint} { @@ -186,32 +212,6 @@ fn adjust_span(map: @CodeMap, sp: span) -> span { } } -enum expn_info_ { - expanded_from({call_site: span, - callie: {name: ~str, span: Option}}) -} -type expn_info = Option<@expn_info_>; - -struct span {lo: uint, hi: uint, expn_info: expn_info} - -impl span : cmp::Eq { - pure fn eq(other: &span) -> bool { - return self.lo == (*other).lo && self.hi == (*other).hi; - } - pure fn ne(other: &span) -> bool { !self.eq(other) } -} - -impl span: Serializable { - /* Note #1972 -- spans are serialized but not deserialized */ - fn serialize(&self, _s: &S) { } -} - -impl span: Deserializable { - static fn deserialize(_d: &D) -> span { - ast_util::dummy_sp() - } -} - fn span_to_str_no_adj(sp: span, cm: @CodeMap) -> ~str { let lo = lookup_char_pos(cm, sp.lo); let hi = lookup_char_pos(cm, sp.hi); -- GitLab