Skip to content

Commit

Permalink
Remove TodoFunction and TodoProtocols workarounds
Browse files Browse the repository at this point in the history
Directly emit the type that they mapped to instead, along with an inline
comment that details what's missing.
  • Loading branch information
madsmtm committed Nov 25, 2024
1 parent 46f5618 commit 723c865
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
12 changes: 10 additions & 2 deletions crates/header-translator/src/rust_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,14 @@ impl Ty {
[decl] if decl.id.is_nsobject() => write!(f, "NSObject"),
[decl] => write!(f, "ProtocolObject<dyn {}>", decl.id.path()),
// TODO: Handle this better
_ => write!(f, "TodoProtocols"),
[first, rest @ ..] => {
write!(f, "AnyObject /* {}", first.id.path())?;
for protocol in rest {
write!(f, "+ {}", protocol.id.path())?;
}
write!(f, " */")?;
Ok(())
}
},
Self::AnyProtocol => write!(f, "AnyProtocol"),
Self::AnyClass { protocols } => match &**protocols {
Expand All @@ -1431,7 +1438,8 @@ impl Ty {
Self::TypeDef { id, .. } => {
write!(f, "{}", id.path())
}
Self::Fn { .. } => write!(f, "TodoFunction"),
// TODO: Handle this better.
Self::Fn { .. } => write!(f, "core::ffi::c_void /* TODO: Should be a function. */"),
Self::Block {
sendable: _,
no_escape,
Expand Down
3 changes: 0 additions & 3 deletions crates/objc2/src/__framework_prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,3 @@ pub use crate::{
extern_category, extern_class, extern_methods, extern_protocol, ClassType, MainThreadMarker,
MainThreadOnly, Message, ProtocolType,
};

pub type TodoFunction = *const c_void;
pub type TodoProtocols = AnyObject;

0 comments on commit 723c865

Please sign in to comment.