File tree Expand file tree Collapse file tree 4 files changed +22
-22
lines changed Expand file tree Collapse file tree 4 files changed +22
-22
lines changed Original file line number Diff line number Diff line change @@ -22,14 +22,6 @@ use core::to_str::ToStr;
22
22
use std:: serialize:: { Encodable , Decodable , Encoder , Decoder } ;
23
23
24
24
25
- /* can't import macros yet, so this is copied from token.rs. See its comment
26
- * there. */
27
- macro_rules! interner_key (
28
- ( ) => ( cast:: transmute:: <( uint, uint) ,
29
- & fn ( +v: @@:: parse:: token:: ident_interner) >(
30
- ( -3 as uint, 0 u) ) )
31
- )
32
-
33
25
// an identifier contains an index into the interner
34
26
// table and a SyntaxContext to track renaming and
35
27
// macro expansion per Flatt et al., "Macros
Original file line number Diff line number Diff line change @@ -374,16 +374,6 @@ pub impl ident_interner {
374
374
}
375
375
}
376
376
377
- /* Key for thread-local data for sneaking interner information to the
378
- * encoder/decoder. It sounds like a hack because it is one.
379
- * Bonus ultra-hack: functions as keys don't work across crates,
380
- * so we have to use a unique number. See taskgroup_key! in task.rs
381
- * for another case of this. */
382
- macro_rules! interner_key (
383
- () => (cast::transmute::<(uint, uint), &fn(+v: @@token::ident_interner)>(
384
- (-3 as uint, 0u)))
385
- )
386
-
387
377
pub fn mk_ident_interner() -> @ident_interner {
388
378
unsafe {
389
379
match task::local_data::local_data_get(interner_key!()) {
Original file line number Diff line number Diff line change @@ -30,6 +30,13 @@ extern mod std(vers = "0.7-pre");
30
30
31
31
use core::*;
32
32
33
+ // allow the interner_key macro
34
+ // to escape this module:
35
+ #[macro_escape]
36
+ pub mod util {
37
+ pub mod interner;
38
+ }
39
+
33
40
pub mod syntax {
34
41
pub use ext;
35
42
pub use parse;
@@ -45,9 +52,6 @@ pub mod ast_util;
45
52
pub mod ast_map;
46
53
pub mod visit;
47
54
pub mod fold;
48
- pub mod util {
49
- pub mod interner;
50
- }
51
55
52
56
53
57
#[path = "parse/mod.rs"]
Original file line number Diff line number Diff line change 12
12
// allows bidirectional lookup; i.e. given a value, one can easily find the
13
13
// type, and vice versa.
14
14
15
+ // allow the interner_key macro to escape this module:
16
+ #[ macro_escape] ;
17
+
15
18
use core:: prelude:: * ;
16
19
use core:: hashmap:: HashMap ;
17
20
@@ -66,6 +69,17 @@ pub impl<T:Eq + IterBytes + Hash + Const + Copy> Interner<T> {
66
69
fn len ( & self ) -> uint { let vect = & * self . vect ; vect. len ( ) }
67
70
}
68
71
72
+ /* Key for thread-local data for sneaking interner information to the
73
+ * encoder/decoder. It sounds like a hack because it is one.
74
+ * Bonus ultra-hack: functions as keys don't work across crates,
75
+ * so we have to use a unique number. See taskgroup_key! in task.rs
76
+ * for another case of this. */
77
+ macro_rules! interner_key (
78
+ ( ) => ( cast:: transmute:: <( uint, uint) ,
79
+ & fn ( +v: @@:: parse:: token:: ident_interner) >(
80
+ ( -3 as uint, 0 u) ) )
81
+ )
82
+
69
83
#[ cfg( test) ]
70
84
mod tests {
71
85
use super :: * ;
@@ -109,4 +123,4 @@ mod tests {
109
123
assert_eq!(i.get(2), @~" Carol ");
110
124
assert_eq!(i.intern(@~" Bob " ) , 1 ) ;
111
125
}
112
- }
126
+ }
You can’t perform that action at this time.
0 commit comments