Get rid of the unsafe hacks in resolve3. Closes #3267.
This commit is contained in:
parent
7706262a73
commit
2c96a43cf1
@ -676,7 +676,7 @@ struct Resolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The main name resolution procedure.
|
/// The main name resolution procedure.
|
||||||
fn resolve(this: @Resolver) {
|
fn resolve(@self, this: @Resolver) {
|
||||||
self.build_reduced_graph(this);
|
self.build_reduced_graph(this);
|
||||||
self.session.abort_if_errors();
|
self.session.abort_if_errors();
|
||||||
|
|
||||||
@ -2792,25 +2792,22 @@ struct Resolver {
|
|||||||
return none;
|
return none;
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: This shouldn't be unsafe!
|
fn resolve_crate(@self) {
|
||||||
fn resolve_crate() unsafe {
|
|
||||||
debug!("(resolving crate) starting");
|
debug!("(resolving crate) starting");
|
||||||
|
|
||||||
// XXX: This is awful!
|
|
||||||
let this = ptr::addr_of(self);
|
|
||||||
visit_crate(*self.crate, (), mk_vt(@{
|
visit_crate(*self.crate, (), mk_vt(@{
|
||||||
visit_item: |item, _context, visitor|
|
visit_item: |item, _context, visitor|
|
||||||
(*this).resolve_item(item, visitor),
|
self.resolve_item(item, visitor),
|
||||||
visit_arm: |arm, _context, visitor|
|
visit_arm: |arm, _context, visitor|
|
||||||
(*this).resolve_arm(arm, visitor),
|
self.resolve_arm(arm, visitor),
|
||||||
visit_block: |block, _context, visitor|
|
visit_block: |block, _context, visitor|
|
||||||
(*this).resolve_block(block, visitor),
|
self.resolve_block(block, visitor),
|
||||||
visit_expr: |expr, _context, visitor|
|
visit_expr: |expr, _context, visitor|
|
||||||
(*this).resolve_expr(expr, visitor),
|
self.resolve_expr(expr, visitor),
|
||||||
visit_local: |local, _context, visitor|
|
visit_local: |local, _context, visitor|
|
||||||
(*this).resolve_local(local, visitor),
|
self.resolve_local(local, visitor),
|
||||||
visit_ty: |ty, _context, visitor|
|
visit_ty: |ty, _context, visitor|
|
||||||
(*this).resolve_type(ty, visitor)
|
self.resolve_type(ty, visitor)
|
||||||
with *default_visitor()
|
with *default_visitor()
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@ -4542,7 +4539,7 @@ fn resolve_crate(session: session, lang_items: LanguageItems, crate: @crate)
|
|||||||
trait_map: TraitMap } {
|
trait_map: TraitMap } {
|
||||||
|
|
||||||
let resolver = @Resolver(session, lang_items, crate);
|
let resolver = @Resolver(session, lang_items, crate);
|
||||||
(*resolver).resolve(resolver);
|
resolver.resolve(resolver);
|
||||||
return {
|
return {
|
||||||
def_map: resolver.def_map,
|
def_map: resolver.def_map,
|
||||||
exp_map: resolver.export_map,
|
exp_map: resolver.export_map,
|
||||||
|
Loading…
Reference in New Issue
Block a user