@@ -22,8 +22,8 @@ use std::fmt;
22
22
use std:: fmt:: Debug ;
23
23
24
24
use self :: ty:: {
25
- GenericPredicates , Generics , ImplDef , ImplTrait , IndexedVal , Span , TraitDecl , TraitDef , Ty ,
26
- TyKind ,
25
+ GenericPredicates , Generics , ImplDef , ImplTrait , IndexedVal , LineInfo , Span , TraitDecl ,
26
+ TraitDef , Ty , TyKind ,
27
27
} ;
28
28
29
29
#[ macro_use]
@@ -108,6 +108,7 @@ pub struct Crate {
108
108
}
109
109
110
110
pub type DefKind = Opaque ;
111
+ pub type Filename = Opaque ;
111
112
112
113
/// Holds information about an item in the crate.
113
114
/// For now, it only stores the item DefId. Use functions inside `rustc_internal` module to
@@ -196,13 +197,19 @@ pub trait Context {
196
197
/// Find a crate with the given name.
197
198
fn find_crates ( & self , name : & str ) -> Vec < Crate > ;
198
199
199
- /// Prints the name of given `DefId`
200
+ /// Returns the name of given `DefId`
200
201
fn name_of_def_id ( & self , def_id : DefId ) -> String ;
201
202
202
- /// Prints a human readable form of `Span`
203
+ /// Returns printable, human readable form of `Span`
203
204
fn print_span ( & self , span : Span ) -> String ;
204
205
205
- /// Prints the kind of given `DefId`
206
+ /// Return filename from given `Span`, for diagnostic purposes
207
+ fn get_filename ( & self , span : & Span ) -> Filename ;
208
+
209
+ /// Return lines corresponding to this `Span`
210
+ fn get_lines ( & self , span : & Span ) -> Vec < LineInfo > ;
211
+
212
+ /// Returns the `kind` of given `DefId`
206
213
fn def_kind ( & mut self , def_id : DefId ) -> DefKind ;
207
214
208
215
/// `Span` of an item
0 commit comments