File tree Expand file tree Collapse file tree 3 files changed +608
-10
lines changed
branches/try/src/librustc_save_analysis Expand file tree Collapse file tree 3 files changed +608
-10
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
refs/heads/master: 6dbb0e86aec11050480beb76eade6fb805010ba7
3
3
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
4
- refs/heads/try: e7b8c5e3ab49e11d0d1ca60d843c90abf213fb4d
4
+ refs/heads/try: 91b5ed5ce38e3833e985c2cf023e1902891f30e2
5
5
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
6
6
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
7
7
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Original file line number Diff line number Diff line change @@ -18,7 +18,37 @@ use std::hash::Hasher;
18
18
use rustc:: hir:: def_id:: DefId ;
19
19
use rustc:: ty;
20
20
use syntax:: ast:: { CrateNum , NodeId } ;
21
- use syntax:: codemap:: Span ;
21
+ use syntax:: codemap:: { Span , CodeMap } ;
22
+
23
+ #[ derive( Debug , Clone , RustcEncodable ) ]
24
+ pub struct SpanData {
25
+ file_name : String ,
26
+ byte_start : u32 ,
27
+ byte_end : u32 ,
28
+ /// 1-based.
29
+ line_start : usize ,
30
+ line_end : usize ,
31
+ /// 1-based, character offset.
32
+ column_start : usize ,
33
+ column_end : usize ,
34
+ }
35
+
36
+ impl SpanData {
37
+ pub fn from_span ( span : Span , cm : & CodeMap ) -> SpanData {
38
+ let start = cm. lookup_char_pos ( span. lo ) ;
39
+ let end = cm. lookup_char_pos ( span. hi ) ;
40
+
41
+ SpanData {
42
+ file_name : start. file . name . clone ( ) ,
43
+ byte_start : span. lo . 0 ,
44
+ byte_end : span. hi . 0 ,
45
+ line_start : start. line ,
46
+ line_end : end. line ,
47
+ column_start : start. col . 0 + 1 ,
48
+ column_end : end. col . 0 + 1 ,
49
+ }
50
+ }
51
+ }
22
52
23
53
pub struct CrateData {
24
54
pub name : String ,
You can’t perform that action at this time.
0 commit comments