@@ -19,8 +19,6 @@ use parse::token;
19
19
20
20
use std:: fmt;
21
21
use std:: fmt:: Show ;
22
- use std:: cell:: RefCell ;
23
- use collections:: HashMap ;
24
22
use std:: option:: Option ;
25
23
use std:: rc:: Rc ;
26
24
use std:: vec_ng:: Vec ;
@@ -42,7 +40,10 @@ pub fn P<T: 'static>(value: T) -> P<T> {
42
40
// macro expansion per Flatt et al., "Macros
43
41
// That Work Together"
44
42
#[ deriving( Clone , Hash , TotalEq , TotalOrd , Show ) ]
45
- pub struct Ident { name : Name , ctxt : SyntaxContext }
43
+ pub struct Ident {
44
+ name : Name ,
45
+ ctxt : SyntaxContext
46
+ }
46
47
47
48
impl Ident {
48
49
/// Construct an identifier with the given name and an empty context:
@@ -88,43 +89,9 @@ impl Eq for Ident {
88
89
// this uint is a reference to a table stored in thread-local
89
90
// storage.
90
91
pub type SyntaxContext = u32 ;
91
-
92
- // the SCTable contains a table of SyntaxContext_'s. It
93
- // represents a flattened tree structure, to avoid having
94
- // managed pointers everywhere (that caused an ICE).
95
- // the mark_memo and rename_memo fields are side-tables
96
- // that ensure that adding the same mark to the same context
97
- // gives you back the same context as before. This shouldn't
98
- // change the semantics--everything here is immutable--but
99
- // it should cut down on memory use *a lot*; applying a mark
100
- // to a tree containing 50 identifiers would otherwise generate
101
- pub struct SCTable {
102
- table : RefCell < Vec < SyntaxContext_ > > ,
103
- mark_memo : RefCell < HashMap < ( SyntaxContext , Mrk ) , SyntaxContext > > ,
104
- rename_memo : RefCell < HashMap < ( SyntaxContext , Ident , Name ) , SyntaxContext > > ,
105
- }
106
-
107
- // NB: these must be placed in any SCTable...
108
92
pub static EMPTY_CTXT : SyntaxContext = 0 ;
109
93
pub static ILLEGAL_CTXT : SyntaxContext = 1 ;
110
94
111
- #[ deriving( Eq , Encodable , Decodable , Hash ) ]
112
- pub enum SyntaxContext_ {
113
- EmptyCtxt ,
114
- Mark ( Mrk , SyntaxContext ) ,
115
- // flattening the name and syntaxcontext into the rename...
116
- // HIDDEN INVARIANTS:
117
- // 1) the first name in a Rename node
118
- // can only be a programmer-supplied name.
119
- // 2) Every Rename node with a given Name in the
120
- // "to" slot must have the same name and context
121
- // in the "from" slot. In essence, they're all
122
- // pointers to a single "rename" event node.
123
- Rename ( Ident , Name , SyntaxContext ) ,
124
- // actually, IllegalCtxt may not be necessary.
125
- IllegalCtxt
126
- }
127
-
128
95
/// A name is a part of an identifier, representing a string or gensym. It's
129
96
/// the result of interning.
130
97
pub type Name = u32 ;
0 commit comments