rustc: Create def IDs for region parameters
This commit is contained in:
parent
2975bcdd7d
commit
0d4cb75949
@ -434,6 +434,7 @@ impl of tr for ast::def {
|
||||
ast::def_class_method(did0, did1) {
|
||||
ast::def_class_method(did0.tr(xcx), did1.tr(xcx))
|
||||
}
|
||||
ast::def_region_param(did) { ast::def_region_param(did.tr(xcx)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1004,4 +1005,4 @@ fn test_simplification() {
|
||||
}
|
||||
_ { fail; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1711,7 +1711,8 @@ fn ns_for_def(d: def) -> namespace {
|
||||
{ ns_val(value_or_enum) }
|
||||
ast::def_mod(_) | ast::def_native_mod(_) { ns_module }
|
||||
ast::def_ty(_) | ast::def_binding(_) | ast::def_use(_) |
|
||||
ast::def_ty_param(_, _) | ast::def_prim_ty(_) | ast::def_class(_)
|
||||
ast::def_ty_param(_, _) | ast::def_prim_ty(_) | ast::def_class(_) |
|
||||
ast::def_region_param(_)
|
||||
{ ns_type }
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,8 @@ enum ty_param_bound {
|
||||
|
||||
type ty_param = {ident: ident, id: node_id, bounds: @[ty_param_bound]};
|
||||
|
||||
type region_param = {ident: ident, id: node_id};
|
||||
|
||||
enum def {
|
||||
def_fn(def_id, purity),
|
||||
def_self(node_id),
|
||||
@ -50,7 +52,8 @@ enum def {
|
||||
def_class_field(def_id, def_id),
|
||||
// No purity allowed for now, I guess
|
||||
// (simpler this way, b/c presumably methods read mutable state)
|
||||
def_class_method(def_id, def_id)
|
||||
def_class_method(def_id, def_id),
|
||||
def_region_param(def_id),
|
||||
}
|
||||
|
||||
// The set of meta_items that define the compilation environment of the crate,
|
||||
@ -342,7 +345,7 @@ enum prim_ty {
|
||||
|
||||
enum region {
|
||||
re_inferred,
|
||||
re_named(ident),
|
||||
re_named(region_param),
|
||||
re_self
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,8 @@ fn def_id_of_def(d: def) -> def_id {
|
||||
def_native_mod(id) | def_const(id) |
|
||||
def_variant(_, id) | def_ty(id) | def_ty_param(id, _) |
|
||||
def_use(id) |
|
||||
def_class(id) | def_class_field(_, id) | def_class_method(_, id) { id }
|
||||
def_class(id) | def_class_field(_, id) | def_class_method(_, id) |
|
||||
def_region_param(id) { id }
|
||||
|
||||
def_arg(id, _) | def_local(id, _) | def_self(id) |
|
||||
def_upvar(id, _, _) | def_binding(id) {
|
||||
|
@ -424,7 +424,7 @@ fn parse_region(p: parser) -> ast::region {
|
||||
if string == "self" {
|
||||
ast::re_self
|
||||
} else {
|
||||
ast::re_named(string)
|
||||
ast::re_named({ ident: string, id: p.get_id()})
|
||||
}
|
||||
}
|
||||
_ { ast::re_inferred }
|
||||
|
@ -316,7 +316,7 @@ fn print_native_mod(s: ps, nmod: ast::native_mod, attrs: [ast::attribute]) {
|
||||
fn print_region(s: ps, region: ast::region) {
|
||||
alt region {
|
||||
ast::re_inferred { /* no-op */ }
|
||||
ast::re_named(name) { word(s.s, name); word(s.s, "."); }
|
||||
ast::re_named(name) { word(s.s, name.ident); word(s.s, "."); }
|
||||
ast::re_self { word(s.s, "self"); word(s.s, "."); }
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user