diff options
| author | Mark Rowe <mark@vector35.com> | 2026-03-23 19:49:56 -0700 |
|---|---|---|
| committer | Mark Rowe <mark@vector35.com> | 2026-03-30 09:19:20 -0700 |
| commit | 20adc82b8f85a78fe2cd6ddc2b3a8c78558999a5 (patch) | |
| tree | e89c4e5ce635669af210bd9468a89172ef590992 /plugins/workflow_objc/src/metadata | |
| parent | efbde23abcf1f38d98a096044e2256c5619f9004 (diff) | |
[ObjC] Set return type on objc_msgSend calls that send an init message to a known class
Diffstat (limited to 'plugins/workflow_objc/src/metadata')
| -rw-r--r-- | plugins/workflow_objc/src/metadata/selector.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/plugins/workflow_objc/src/metadata/selector.rs b/plugins/workflow_objc/src/metadata/selector.rs index a48be14d..de2e883e 100644 --- a/plugins/workflow_objc/src/metadata/selector.rs +++ b/plugins/workflow_objc/src/metadata/selector.rs @@ -23,6 +23,19 @@ impl Selector { Ok(Selector { name, addr }) } + /// Returns true if this selector belongs to the `init` method family. + /// + /// Per the ObjC ARC spec, a selector is in the init family if it starts with + /// "init" and the next character is either uppercase or absent (e.g. `init`, + /// `initWithFrame:`, but NOT `initialize` or `initials`). + pub fn is_init_family(&self) -> bool { + if let Some(rest) = self.name.strip_prefix("init") { + rest.is_empty() || rest.starts_with(|c: char| c.is_ascii_uppercase() || c == ':') + } else { + false + } + } + pub fn argument_labels(&self) -> Vec<String> { if !self.name.contains(':') { return vec![]; |
