@@ -29,12 +29,12 @@ use std::map::HashMap;
2929use std:: map;
3030use std;
3131
32- enum path_elt {
32+ pub enum path_elt {
3333 path_mod( ident ) ,
3434 path_name( ident )
3535}
3636
37- impl path_elt : cmp:: Eq {
37+ pub impl path_elt : cmp:: Eq {
3838 pure fn eq ( & self , other : & path_elt ) -> bool {
3939 match ( * self ) {
4040 path_mod( e0a) => {
@@ -54,10 +54,10 @@ impl path_elt : cmp::Eq {
5454 pure fn ne ( & self , other : & path_elt ) -> bool { !( * self ) . eq ( other) }
5555}
5656
57- type path = ~[ path_elt ] ;
57+ pub type path = ~[ path_elt ] ;
5858
59- fn path_to_str_with_sep ( p : & [ path_elt ] , sep : ~str , itr : @ident_interner )
60- -> ~str {
59+ pub fn path_to_str_with_sep ( p : & [ path_elt ] , sep : ~str , itr : @ident_interner )
60+ -> ~str {
6161 let strs = do p. map |e| {
6262 match * e {
6363 path_mod( s) => * itr. get ( s) ,
@@ -67,7 +67,7 @@ fn path_to_str_with_sep(p: &[path_elt], sep: ~str, itr: @ident_interner)
6767 str:: connect ( strs, sep)
6868}
6969
70- fn path_ident_to_str ( p : path , i : ident , itr : @ident_interner ) -> ~str {
70+ pub fn path_ident_to_str ( p : path , i : ident , itr : @ident_interner ) -> ~str {
7171 if vec:: is_empty ( p) {
7272 //FIXME /* FIXME (#2543) */ copy *i
7373 * itr. get ( i)
@@ -76,18 +76,18 @@ fn path_ident_to_str(p: path, i: ident, itr: @ident_interner) -> ~str {
7676 }
7777}
7878
79- fn path_to_str ( p : & [ path_elt ] , itr : @ident_interner ) -> ~str {
79+ pub fn path_to_str ( p : & [ path_elt ] , itr : @ident_interner ) -> ~str {
8080 path_to_str_with_sep ( p, ~":: ", itr)
8181}
8282
83- fn path_elt_to_str ( pe : path_elt , itr : @ident_interner ) -> ~str {
83+ pub fn path_elt_to_str ( pe : path_elt , itr : @ident_interner ) -> ~str {
8484 match pe {
8585 path_mod( s) => * itr. get ( s) ,
8686 path_name( s) => * itr. get ( s)
8787 }
8888}
8989
90- enum ast_node {
90+ pub enum ast_node {
9191 node_item( @item, @path) ,
9292 node_foreign_item( @foreign_item , foreign_abi , @path) ,
9393 node_trait_method( @trait_method , def_id /* trait did */ ,
@@ -107,20 +107,20 @@ enum ast_node {
107107 node_struct_ctor( @struct_def , @item, @path) ,
108108}
109109
110- type map = std:: map:: HashMap < node_id , ast_node > ;
111- struct ctx {
110+ pub type map = std:: map:: HashMap < node_id , ast_node > ;
111+ pub struct ctx {
112112 map : map ,
113113 mut path : path ,
114114 mut local_id : uint ,
115115 diag : span_handler ,
116116}
117- type vt = visit:: vt < ctx > ;
117+ pub type vt = visit:: vt < ctx > ;
118118
119- fn extend ( cx : ctx , +elt : ident ) -> @path {
119+ pub fn extend ( cx : ctx , +elt : ident ) -> @path {
120120 @( vec:: append ( cx . path, ~[ path_name ( elt ) ] ) )
121121}
122122
123- fn mk_ast_map_visitor ( ) -> vt {
123+ pub fn mk_ast_map_visitor ( ) -> vt {
124124 return visit:: mk_vt ( @visit:: Visitor {
125125 visit_item : map_item,
126126 visit_expr : map_expr,
@@ -134,7 +134,7 @@ fn mk_ast_map_visitor() -> vt {
134134 } ) ;
135135}
136136
137- fn map_crate ( diag : span_handler , c: crate ) -> map {
137+ pub fn map_crate ( diag : span_handler , c: crate ) -> map {
138138 let cx = ctx {
139139 map : std:: map:: HashMap ( ) ,
140140 mut path : ~[ ] ,
@@ -148,8 +148,8 @@ fn map_crate(diag: span_handler, c: crate) -> map {
148148// Used for items loaded from external crate that are being inlined into this
149149// crate. The `path` should be the path to the item but should not include
150150// the item itself.
151- fn map_decoded_item ( diag : span_handler ,
152- map : map , path : path , ii : inlined_item ) {
151+ pub fn map_decoded_item ( diag : span_handler ,
152+ map : map , path : path , ii : inlined_item ) {
153153 // I believe it is ok for the local IDs of inlined items from other crates
154154 // to overlap with the local ids from this crate, so just generate the ids
155155 // starting from 0. (In particular, I think these ids are only used in
@@ -182,8 +182,8 @@ fn map_decoded_item(diag: span_handler,
182182 ii. accept ( cx, v) ;
183183}
184184
185- fn map_fn ( fk : visit:: fn_kind , decl : fn_decl , body : blk ,
186- sp : codemap:: span , id : node_id , cx : ctx , v : vt ) {
185+ pub fn map_fn ( fk : visit:: fn_kind , decl : fn_decl , body : blk ,
186+ sp : codemap:: span , id : node_id , cx : ctx , v : vt ) {
187187 for decl. inputs. each |a| {
188188 cx. map . insert ( a. id ,
189189 node_arg ( /* FIXME (#2543) */
@@ -210,12 +210,12 @@ fn map_fn(fk: visit::fn_kind, decl: fn_decl, body: blk,
210210 visit:: visit_fn ( fk, decl, body, sp, id, cx, v) ;
211211}
212212
213- fn map_block ( b : blk , cx : ctx , v : vt ) {
213+ pub fn map_block ( b : blk , cx : ctx , v : vt ) {
214214 cx. map . insert ( b. node . id , node_block ( /* FIXME (#2543) */ copy b) ) ;
215215 visit:: visit_block ( b, cx, v) ;
216216}
217217
218- fn number_pat ( cx : ctx , pat : @pat) {
218+ pub fn number_pat ( cx : ctx , pat : @pat) {
219219 do ast_util:: walk_pat ( pat ) |p| {
220220 match p. node {
221221 pat_ident( * ) => {
@@ -227,24 +227,24 @@ fn number_pat(cx: ctx, pat: @pat) {
227227 } ;
228228}
229229
230- fn map_local ( loc : @local , cx : ctx , v : vt ) {
230+ pub fn map_local ( loc : @local , cx : ctx , v : vt ) {
231231 number_pat( cx, loc. node. pat) ;
232232 visit:: visit_local ( loc , cx , v ) ;
233233}
234234
235- fn map_arm ( arm : arm , cx : ctx , v : vt ) {
235+ pub fn map_arm ( arm : arm , cx : ctx , v : vt ) {
236236 number_pat( cx, arm. pats[ 0 ] ) ;
237237 visit:: visit_arm ( arm , cx , v ) ;
238238}
239239
240- fn map_method ( impl_did : def_id , impl_path: @path,
241- m : @method , cx : ctx ) {
240+ pub fn map_method ( impl_did : def_id , impl_path: @path,
241+ m : @method , cx : ctx ) {
242242 cx. map . insert ( m. id , node_method ( m, impl_did, impl_path) ) ;
243243 cx. map . insert ( m. self_id , node_local ( cx. local_id ) ) ;
244244 cx. local_id += 1 u;
245245}
246246
247- fn map_item ( i : @item, cx : ctx , v : vt ) {
247+ pub fn map_item ( i : @item, cx : ctx , v : vt ) {
248248 let item_path = @/* FIXME ( #2543 ) * / copy cx. path ;
249249 cx. map . insert ( i. id , node_item ( i, item_path) ) ;
250250 match i. node {
@@ -306,8 +306,8 @@ fn map_item(i: @item, cx: ctx, v: vt) {
306306 cx. path . pop ( ) ;
307307}
308308
309- fn map_struct_def ( struct_def : @ast:: struct_def , parent_node : ast_node ,
310- ident : ast:: ident , cx : ctx , _v : vt ) {
309+ pub fn map_struct_def ( struct_def : @ast:: struct_def , parent_node : ast_node ,
310+ ident : ast:: ident , cx : ctx , _v : vt ) {
311311 let p = extend ( cx, ident) ;
312312 // If this is a tuple-like struct, register the constructor.
313313 match struct_def. ctor_id {
@@ -324,7 +324,7 @@ fn map_struct_def(struct_def: @ast::struct_def, parent_node: ast_node,
324324 }
325325}
326326
327- fn map_view_item ( vi : @view_item , cx : ctx , _v : vt ) {
327+ pub fn map_view_item ( vi : @view_item , cx : ctx , _v : vt ) {
328328 match vi. node {
329329 view_item_export( vps) => for vps. each |vp| {
330330 let ( id, name) = match vp. node {
@@ -341,17 +341,17 @@ fn map_view_item(vi: @view_item, cx: ctx, _v: vt) {
341341 }
342342}
343343
344- fn map_expr ( ex : @expr, cx : ctx , v : vt ) {
344+ pub fn map_expr ( ex : @expr, cx : ctx , v : vt ) {
345345 cx. map . insert ( ex. id , node_expr ( ex) ) ;
346346 visit:: visit_expr ( ex, cx, v) ;
347347}
348348
349- fn map_stmt ( stmt : @stmt, cx : ctx , v : vt ) {
349+ pub fn map_stmt ( stmt : @stmt, cx : ctx , v : vt ) {
350350 cx. map . insert ( stmt_id ( * stmt) , node_stmt ( stmt) ) ;
351351 visit:: visit_stmt ( stmt, cx, v) ;
352352}
353353
354- fn node_id_to_str( map : map , id : node_id , itr : @ident_interner ) -> ~str {
354+ pub fn node_id_to_str( map : map , id : node_id , itr : @ident_interner ) -> ~str {
355355 match map. find ( id) {
356356 None => {
357357 fmt ! ( "unknown node (id=%d)" , id)
@@ -419,7 +419,7 @@ fn node_id_to_str(map: map, id: node_id, itr: @ident_interner) -> ~str {
419419 }
420420}
421421
422- fn node_item_query<Result >( items: map, id: node_id,
422+ pub fn node_item_query<Result >( items: map, id: node_id,
423423 query : fn ( @item) -> Result ,
424424 error_msg: ~str ) -> Result {
425425 match items. find ( id) {
0 commit comments