-
Notifications
You must be signed in to change notification settings - Fork 518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[webkit] Add nullability to (generated and manual) bindings #15028
Changes from 11 commits
6e47560
177f244
044a774
15c03f8
9fd6376
a7d4227
eb6652a
6b4ba77
bc1a82f
f53d91d
ad68797
726192a
a4cb953
0bef34c
9440e6c
b0a178e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#nullable enable | ||
|
||
namespace WebKit { | ||
|
||
public partial class DomCssRuleList { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#nullable enable | ||
|
||
using System; | ||
using ObjCRuntime; | ||
using Foundation; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#nullable enable | ||
|
||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
|
@@ -24,23 +26,27 @@ public void Dispose () { | |
|
||
public T Current { | ||
get { | ||
if (_container is null) | ||
throw new ObjectDisposedException (nameof (_container)); | ||
return _container [_index]; | ||
} | ||
} | ||
|
||
object IEnumerator.Current { | ||
object? IEnumerator.Current { | ||
get { return ((IEnumerator<T>) this).Current; } | ||
} | ||
|
||
public bool MoveNext () { | ||
if (_container is null) | ||
throw new ObjectDisposedException (nameof (_container)); | ||
return ++_index < _container.Count; | ||
} | ||
|
||
public void Reset () { | ||
_index = -1; | ||
} | ||
|
||
IIndexedContainer<T> _container; | ||
IIndexedContainer<T>? _container; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this needed, if the only constructor takes a non-nullable There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rolfbjarne I added this, because the Dispose method assigns null to _container There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rolfbjarne we need a way to init that. The compiler is complaining because the default value of a IIndexedContainer is null. We could probably make the _container a private Init property with the type and remove the need of ? and remove all the Dipose code. Should make things nicer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rolfbjarne @mandel-macaque Should I do this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tj-devel709 yes, keep this since nulling it the field in the Dispose method might be important |
||
int _index; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#nullable enable | ||
|
||
namespace WebKit { | ||
|
||
public partial class DomCssRuleList { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#nullable enable | ||
|
||
using Foundation; | ||
|
||
namespace WebKit { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Highlighting this
!
. The return type cannot be made nullable since it is implementing an interface with that method signature but it is also a getter that is not an indexer so I thought this may be the best optionThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about using:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might make more sense to throw an
ObjectDisposedException
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rolfbjarne good one, that exception should also be a good idea for my other comment.