CtorFn, // o
StaticMethod, // F
UnsafeStaticMethod, // U
+ Method, // h
+ UnsafeMethod, // H
Type, // y
ForeignType, // T
Mod, // m
'o' => CtorFn,
'F' => StaticMethod,
'U' => UnsafeStaticMethod,
+ 'h' => Method,
+ 'H' => UnsafeMethod,
'y' => Type,
'T' => ForeignType,
'm' => Mod,
UnsafeFn => DlDef(def::DefFn(did, ast::UnsafeFn, false)),
Fn => DlDef(def::DefFn(did, ast::NormalFn, false)),
CtorFn => DlDef(def::DefFn(did, ast::NormalFn, true)),
+ UnsafeMethod => DlDef(def::DefMethod(did, ast::UnsafeFn, false)),
+ Method => DlDef(def::DefMethod(did, ast::NormalFn, false)),
StaticMethod | UnsafeStaticMethod => {
let fn_style = if fam == UnsafeStaticMethod {
ast::UnsafeFn
ty::StaticExplicitSelfCategory => {
encode_family(rbml_w, fn_style_static_method_family(fn_style));
}
- _ => encode_family(rbml_w, style_fn_family(fn_style))
+ _ => encode_family(rbml_w, fn_style_method_family(fn_style))
}
encode_provided_source(rbml_w, method_ty.provided_source);
}
}
}
+fn fn_style_method_family(s: FnStyle) -> char {
+ match s {
+ UnsafeFn => 'h',
+ NormalFn => 'H',
+ }
+}
+
fn should_inline(attrs: &[Attribute]) -> bool {
use syntax::attr::*;
}
_ => {
encode_family(rbml_w,
- style_fn_family(
+ fn_style_method_family(
method_ty.fty.fn_style));
}
}
encode_parent_sort(rbml_w, 't');
let trait_item = &ms[i];
- match &ms[i] {
- &RequiredMethod(ref tm) => {
- encode_attributes(rbml_w, tm.attrs.as_slice());
+ let foo = |rbml_w: &mut Encoder| {
+ // If this is a static method, we've already
+ // encoded this.
+ if is_nonstatic_method {
+ // FIXME: I feel like there is something funny
+ // going on.
+ let pty = ty::lookup_item_type(tcx, item_def_id.def_id());
+ encode_bounds_and_type(rbml_w, ecx, &pty);
+ }
+ };
+ match trait_item {
+ &RequiredMethod(ref m) => {
+ encode_attributes(rbml_w, m.attrs.as_slice());
+ foo(rbml_w);
encode_item_sort(rbml_w, 'r');
- encode_method_argument_names(rbml_w, &*tm.decl);
+ encode_method_argument_names(rbml_w, &*m.decl);
}
&ProvidedMethod(ref m) => {
encode_attributes(rbml_w, m.attrs.as_slice());
- // If this is a static method, we've already
- // encoded this.
- if is_nonstatic_method {
- // FIXME: I feel like there is something funny
- // going on.
- let pty = ty::lookup_item_type(tcx,
- item_def_id.def_id());
- encode_bounds_and_type(rbml_w, ecx, &pty);
- }
+ foo(rbml_w);
encode_item_sort(rbml_w, 'p');
- encode_inlined_item(ecx,
- rbml_w,
- IITraitItemRef(def_id, trait_item));
- encode_method_argument_names(rbml_w,
- &*m.pe_fn_decl());
+ encode_inlined_item(ecx, rbml_w, IITraitItemRef(def_id, trait_item));
+ encode_method_argument_names(rbml_w, &*m.pe_fn_decl());
}
&TypeTraitItem(ref associated_type) => {
csearch::get_tuple_struct_definition_if_ctor(&self.session.cstore, ctor_id)
.map_or(def, |_| DefStruct(ctor_id)), DUMMY_SP, is_public);
}
- DefFn(..) | DefStaticMethod(..) | DefStatic(..) | DefConst(..) => {
+ DefFn(..) | DefStaticMethod(..) | DefStatic(..) | DefConst(..) | DefMethod(..) => {
debug!("(building reduced graph for external \
crate) building value (fn/static) {}", final_ident);
child_name_bindings.define_value(def, DUMMY_SP, is_public);
// Record the def ID and fields of this struct.
self.structs.insert(def_id, fields);
}
- DefMethod(..) => {
- debug!("(building reduced graph for external crate) \
- ignoring {}", def);
- // Ignored; handled elsewhere.
- }
DefLocal(..) | DefPrimTy(..) | DefTyParam(..) |
DefUse(..) | DefUpvar(..) | DefRegion(..) |
DefTyParamBinder(..) | DefLabel(..) | DefSelfTy(..) => {