parent
7a52154d78
commit
cc1f0027c7
6 changed files with 20 additions and 13 deletions
|
@ -146,6 +146,7 @@ impl Reflector {
|
|||
// Entrypoint
|
||||
pub fn visit_ty(&mut self, t: ty::t) {
|
||||
let bcx = self.bcx;
|
||||
let tcx = bcx.ccx().tcx;
|
||||
debug!("reflect::visit_ty %s", ty_to_str(bcx.ccx().tcx, t));
|
||||
|
||||
match ty::get(t).sty {
|
||||
|
@ -248,8 +249,6 @@ impl Reflector {
|
|||
}
|
||||
|
||||
ty::ty_struct(did, ref substs) => {
|
||||
let bcx = self.bcx;
|
||||
let tcx = bcx.ccx().tcx;
|
||||
let fields = ty::struct_fields(tcx, did, substs);
|
||||
|
||||
let extra = ~[self.c_slice(ty_to_str(tcx, t).to_managed()),
|
||||
|
@ -270,7 +269,6 @@ impl Reflector {
|
|||
// let the visitor tell us if it wants to visit only a particular
|
||||
// variant?
|
||||
ty::ty_enum(did, ref substs) => {
|
||||
let bcx = self.bcx;
|
||||
let ccx = bcx.ccx();
|
||||
let repr = adt::represent_type(bcx.ccx(), t);
|
||||
let variants = ty::substd_enum_variants(ccx.tcx, did, substs);
|
||||
|
@ -336,8 +334,12 @@ impl Reflector {
|
|||
}
|
||||
}
|
||||
|
||||
// Miscallaneous extra types
|
||||
ty::ty_trait(_, _, _, _, _) => self.leaf("trait"),
|
||||
ty::ty_trait(_, _, _, _, _) => {
|
||||
let extra = [self.c_slice(ty_to_str(tcx, t).to_managed())];
|
||||
self.visit("trait", extra);
|
||||
}
|
||||
|
||||
// Miscellaneous extra types
|
||||
ty::ty_infer(_) => self.leaf("infer"),
|
||||
ty::ty_err => self.leaf("err"),
|
||||
ty::ty_param(ref p) => {
|
||||
|
|
|
@ -450,9 +450,9 @@ impl<V:TyVisitor + MovePtr> TyVisitor for MovePtrAdaptor<V> {
|
|||
true
|
||||
}
|
||||
|
||||
fn visit_trait(&mut self) -> bool {
|
||||
fn visit_trait(&mut self, name: &str) -> bool {
|
||||
self.align_to::<@TyVisitor>();
|
||||
if ! self.inner.visit_trait() { return false; }
|
||||
if ! self.inner.visit_trait(name) { return false; }
|
||||
self.bump_past::<@TyVisitor>();
|
||||
true
|
||||
}
|
||||
|
|
|
@ -571,7 +571,11 @@ impl<'self> TyVisitor for ReprVisitor<'self> {
|
|||
_n_inputs: uint, _retstyle: uint) -> bool { true }
|
||||
|
||||
|
||||
fn visit_trait(&mut self) -> bool { true }
|
||||
fn visit_trait(&mut self, name: &str) -> bool {
|
||||
self.writer.write(name.as_bytes());
|
||||
true
|
||||
}
|
||||
|
||||
fn visit_param(&mut self, _i: uint) -> bool { true }
|
||||
fn visit_self(&mut self) -> bool { true }
|
||||
fn visit_type(&mut self) -> bool { true }
|
||||
|
@ -661,6 +665,7 @@ fn test_repr() {
|
|||
"(10u64, ~\"hello\")");
|
||||
|
||||
exact_test(&(&println), "&fn()");
|
||||
exact_test(&(~5 as ~ToStr), "~to_str::ToStr:Send");
|
||||
|
||||
struct Foo;
|
||||
exact_test(&(~[Foo, Foo]), "~[repr::test_repr::Foo, repr::test_repr::Foo]");
|
||||
|
|
|
@ -256,7 +256,7 @@ pub trait TyVisitor {
|
|||
fn visit_leave_fn(&mut self, purity: uint, proto: uint,
|
||||
n_inputs: uint, retstyle: uint) -> bool;
|
||||
|
||||
fn visit_trait(&mut self) -> bool;
|
||||
fn visit_trait(&mut self, name: &str) -> bool;
|
||||
fn visit_param(&mut self, i: uint) -> bool;
|
||||
fn visit_self(&mut self) -> bool;
|
||||
fn visit_type(&mut self) -> bool;
|
||||
|
|
|
@ -428,9 +428,9 @@ impl<V:TyVisitor + movable_ptr> TyVisitor for ptr_visit_adaptor<V> {
|
|||
true
|
||||
}
|
||||
|
||||
fn visit_trait(&mut self) -> bool {
|
||||
fn visit_trait(&mut self, name: &str) -> bool {
|
||||
self.align_to::<@TyVisitor>();
|
||||
if ! self.inner.visit_trait() { return false; }
|
||||
if ! self.inner.visit_trait(name) { return false; }
|
||||
self.bump_past::<@TyVisitor>();
|
||||
true
|
||||
}
|
||||
|
@ -616,7 +616,7 @@ impl TyVisitor for my_visitor {
|
|||
_n_inputs: uint, _retstyle: uint) -> bool { true }
|
||||
|
||||
|
||||
fn visit_trait(&mut self) -> bool { true }
|
||||
fn visit_trait(&mut self, _name: &str) -> bool { true }
|
||||
fn visit_param(&mut self, _i: uint) -> bool { true }
|
||||
fn visit_self(&mut self) -> bool { true }
|
||||
fn visit_type(&mut self) -> bool { true }
|
||||
|
|
|
@ -139,7 +139,7 @@ impl TyVisitor for MyVisitor {
|
|||
_n_inputs: uint, _retstyle: uint) -> bool { true }
|
||||
|
||||
|
||||
fn visit_trait(&mut self) -> bool { true }
|
||||
fn visit_trait(&mut self, _name: &str) -> bool { true }
|
||||
fn visit_param(&mut self, _i: uint) -> bool { true }
|
||||
fn visit_self(&mut self) -> bool { true }
|
||||
fn visit_type(&mut self) -> bool { true }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue