Add support for nullable out/ref parameters in the generator
- Dominant language
- C#
- Stars
- 2.9k
- Forks
- 576
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Nullable out/ref variables are annoying, because they can't be expressed with a single (nice) signature.
Example:
```objc
- (void)doSomething:(nullable CGRect *)rect;
```
I suggest adding generator support for generating multiple functions for this, by specifying the Nullable attribute on the out/ref argument (I'll stick with just `ref` in the sample to make it simpler, but it applies to both variations):
```csharp
[Export ("doSomething:")]
void DoSomething ([Nullable] ref CGRect rect);
```
would produce:
```csharp
// This is for subclassing & overriding the implementation.
[Export ("doSomething:")]
protected virtual void DoSomething (IntPtr rect)
{
objc_msgSend (...);
}
// Two overloads with nicer signatures.
public void DoSomething ()
{
return DoSomething (IntPtr.Zero);
}
public void DoSomething (ref CGRect rect)
{
unsafe {
fixed (void *refarg1 = &rect)
DoSomething ((IntPtr) refarg1);
}
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.