diff options
Diffstat (limited to 'src/codegen/mod.rs')
-rw-r--r-- | src/codegen/mod.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index 77f654e6..46b0a3e7 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -10,6 +10,7 @@ use ir::annotations::FieldAccessorKind; use ir::comp::{Base, CompInfo, CompKind, Field, Method, MethodKind}; use ir::context::{BindgenContext, ItemId}; use ir::derive::{CanDeriveCopy, CanDeriveDebug, CanDeriveDefault}; +use ir::dot; use ir::enum_ty::{Enum, EnumVariant, EnumVariantValue}; use ir::function::{Function, FunctionSig}; use ir::int::IntKind; @@ -646,6 +647,9 @@ impl CodeGenerator for Type { TypeKind::Enum(ref ei) => { ei.codegen(ctx, result, whitelisted_items, item) } + TypeKind::ObjCId | TypeKind::ObjCSel => { + result.saw_objc(); + } TypeKind::ObjCInterface(ref interface) => { interface.codegen(ctx, result, whitelisted_items, item) } @@ -2275,6 +2279,8 @@ impl ToRustTy for Type { let ident = ctx.rust_ident(&name); quote_ty!(ctx.ext_cx(), $ident) } + TypeKind::ObjCSel => quote_ty!(ctx.ext_cx(), objc::runtime::Sel), + TypeKind::ObjCId | TypeKind::ObjCInterface(..) => quote_ty!(ctx.ext_cx(), id), ref u @ TypeKind::UnresolvedTypeRef(..) => { unreachable!("Should have been resolved after parsing {:?}!", u) @@ -2460,10 +2466,12 @@ impl CodeGenerator for ObjCInterface { } + let trait_name = self.rust_name(); + let trait_block = aster::AstBuilder::new() .item() .pub_() - .trait_(self.name()) + .trait_(&trait_name) .with_items(trait_items) .build(); @@ -2472,7 +2480,7 @@ impl CodeGenerator for ObjCInterface { .item() .impl_() .trait_() - .id(self.name()) + .id(&trait_name) .build() .with_items(impl_items) .build_ty(ty_for_impl); @@ -2502,7 +2510,7 @@ pub fn codegen(context: &mut BindgenContext) -> Vec<P<ast::Item>> { } if let Some(path) = context.options().emit_ir_graphviz.as_ref() { - match context.emit_ir_graphviz(path.clone()) { + match dot::write_dot_file(context, path) { Ok(()) => info!("Your dot file was generated successfully into: {}", path), Err(e) => error!("{}", e), } |