@@ -104,13 +104,13 @@ fn resolve_ty(ty: @ast::ty, cx: ctxt, visitor: visit::vt<ctxt>) {
104
104
105
105
alt ty. node {
106
106
ast:: ty_rptr ( { id: region_id, node: node} , _) {
107
- let region;
108
107
alt node {
109
- ast : : re_inferred { region = inferred_region ; }
108
+ ast : : re_inferred | ast :: re_self { /* no-op */ }
110
109
ast:: re_named ( ident) {
111
110
// If at item scope, introduce or reuse a binding. If at
112
111
// block scope, require that the binding be introduced.
113
112
let bindings = cx. bindings ;
113
+ let region;
114
114
alt list:: find ( * bindings, { |b| ident == b. name } ) {
115
115
some ( binding) { region = ty:: re_named ( binding. id ) ; }
116
116
none {
@@ -138,34 +138,11 @@ fn resolve_ty(ty: @ast::ty, cx: ctxt, visitor: visit::vt<ctxt>) {
138
138
}
139
139
}
140
140
}
141
- }
142
-
143
- ast:: re_self {
144
- // For blocks, "self" means "the current block".
145
- //
146
- // TODO: What do we do in an alt?
147
- //
148
- // FIXME: Doesn't work in type items.
149
141
150
- alt cx. parent {
151
- pa_item( item_id) | pa_nested_fn ( item_id) {
152
- let def_id = { crate : ast:: local_crate,
153
- node: item_id} ;
154
- region = ty:: re_caller ( def_id) ;
155
- }
156
- pa_block ( block_id) {
157
- region = ty:: re_block ( block_id) ;
158
- }
159
- pa_crate {
160
- cx. sess . span_bug ( ty. span ,
161
- "region type outside item?!" ) ;
162
- }
163
- }
142
+ let ast_type_to_region = cx. region_map . ast_type_to_region ;
143
+ ast_type_to_region. insert ( region_id, region) ;
164
144
}
165
-
166
145
}
167
-
168
- cx. region_map . ast_type_to_region . insert ( region_id, region) ;
169
146
}
170
147
_ { /* nothing to do */ }
171
148
}
0 commit comments