Fixes #3242 - Replaces simple null checks (#3248)

* Replace all 342 `== null` with `is null`

* Replace 354 `!= null` with `is { }`

* Wrap these in conditionals since they break tests against Release configuration

The members they depend on do not exist in Release configuration

* Split these up and dispose properly

This test needs to be revisited for several reasons at some point.

* Fix release configuration tests

* Declare interface these already support

* Annotate constructor properly and use throw helper

* Move class to its own file

* Rename these files so they nest in the solution explorer

* Make this a record type and remove now-redundant/illegal members

* Reference passing to avoid some struct copies

* Simplify this

* Carry reference passing through as appropriate

* Turn this into a record struct

* Remove unused internal constructor and its test

It was only used by that test.

* Simplify this constructor

* This should be a property

* Simplify constructor

* Simplify GetHashCode

* Mark this ignored just in case

* Missed a couple of opportunities for reference passing

* record struct already does this by value

* Remove unused class

* Simplify the type initializer and Reset method

* Implement INotifyCollectionChanged and IDictionary by delegating to ColorSchemes

* Fix for reflection-based configuration

* Make CI  build happy by disambiguiating this attribute
This commit is contained in:
dodexahedron
2024-02-16 16:46:25 -07:00
committed by GitHub
parent 7a041fcc73
commit 34bef2c839
94 changed files with 1020 additions and 966 deletions

View File

@@ -282,7 +282,7 @@ internal class CursesDriver : ConsoleDriver
StopReportingMouseMoves ();
SetCursorVisibility (CursorVisibility.Default);
if (_mainLoopDriver != null)
if (_mainLoopDriver is { })
{
_mainLoopDriver.RemoveWatch (_processInputToken);
}
@@ -835,7 +835,7 @@ internal class CursesDriver : ConsoleDriver
/// bits, and the background color is stored in the least significant 4 bits. The Terminal.GUi Color values are
/// converted to curses color encoding before being encoded.
/// </remarks>
public override Attribute MakeColor (Color foreground, Color background)
public override Attribute MakeColor (in Color foreground, in Color background)
{
if (!RunningUnitTests)
{

View File

@@ -118,7 +118,7 @@ internal class UnixMainLoop : IMainLoopDriver
_cursesDriver.ProcessWinChange ();
}
if (_pollMap == null)
if (_pollMap is null)
{
return;
}
@@ -159,7 +159,7 @@ internal class UnixMainLoop : IMainLoopDriver
/// </remarks>
internal object AddWatch (int fileDescriptor, Condition condition, Func<MainLoop, bool> callback)
{
if (callback == null)
if (callback is null)
{
throw new ArgumentNullException (nameof (callback));
}