mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-12-14 04:36:59 +00:00
Use the new C# 14 null propagation setter
This commit is contained in:
parent
456db46065
commit
09748b140a
13 changed files with 33 additions and 123 deletions
|
|
@ -361,10 +361,7 @@ namespace ARMeilleure.Translation
|
|||
|
||||
IntervalTreeNode<TK, TV> tmp = LeftOf(replacementNode) ?? RightOf(replacementNode);
|
||||
|
||||
if (tmp != null)
|
||||
{
|
||||
tmp.Parent = ParentOf(replacementNode);
|
||||
}
|
||||
tmp?.Parent = ParentOf(replacementNode);
|
||||
|
||||
if (ParentOf(replacementNode) == null)
|
||||
{
|
||||
|
|
@ -582,10 +579,7 @@ namespace ARMeilleure.Translation
|
|||
{
|
||||
IntervalTreeNode<TK, TV> right = RightOf(node);
|
||||
node.Right = LeftOf(right);
|
||||
if (node.Right != null)
|
||||
{
|
||||
node.Right.Parent = node;
|
||||
}
|
||||
node.Right?.Parent = node;
|
||||
|
||||
IntervalTreeNode<TK, TV> nodeParent = ParentOf(node);
|
||||
right.Parent = nodeParent;
|
||||
|
|
@ -615,10 +609,7 @@ namespace ARMeilleure.Translation
|
|||
{
|
||||
IntervalTreeNode<TK, TV> left = LeftOf(node);
|
||||
node.Left = RightOf(left);
|
||||
if (node.Left != null)
|
||||
{
|
||||
node.Left.Parent = node;
|
||||
}
|
||||
node.Left?.Parent = node;
|
||||
|
||||
IntervalTreeNode<TK, TV> nodeParent = ParentOf(node);
|
||||
left.Parent = nodeParent;
|
||||
|
|
@ -667,10 +658,7 @@ namespace ARMeilleure.Translation
|
|||
/// <param name="color">Color (Boolean)</param>
|
||||
private static void SetColor(IntervalTreeNode<TK, TV> node, bool color)
|
||||
{
|
||||
if (node != null)
|
||||
{
|
||||
node.Color = color;
|
||||
}
|
||||
node?.Color = color;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -386,10 +386,7 @@ namespace Ryujinx.Common.Collections
|
|||
|
||||
IntervalTreeNode<TKey, TValue> tmp = LeftOf(replacementNode) ?? RightOf(replacementNode);
|
||||
|
||||
if (tmp != null)
|
||||
{
|
||||
tmp.Parent = ParentOf(replacementNode);
|
||||
}
|
||||
tmp?.Parent = ParentOf(replacementNode);
|
||||
|
||||
if (ParentOf(replacementNode) == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -235,10 +235,7 @@ namespace Ryujinx.Common.Collections
|
|||
parent = ParentOf(element);
|
||||
color = ColorOf(element);
|
||||
|
||||
if (child != null)
|
||||
{
|
||||
child.Parent = parent;
|
||||
}
|
||||
child?.Parent = parent;
|
||||
|
||||
if (parent == null)
|
||||
{
|
||||
|
|
@ -258,8 +255,7 @@ namespace Ryujinx.Common.Collections
|
|||
element.Right = old.Right;
|
||||
element.Parent = old.Parent;
|
||||
element.Predecessor = old.Predecessor;
|
||||
if (element.Predecessor != null)
|
||||
element.Predecessor.Successor = element;
|
||||
element.Predecessor?.Successor = element;
|
||||
|
||||
if (ParentOf(old) == null)
|
||||
{
|
||||
|
|
@ -292,10 +288,7 @@ namespace Ryujinx.Common.Collections
|
|||
parent = ParentOf(nodeToDelete);
|
||||
color = ColorOf(nodeToDelete);
|
||||
|
||||
if (child != null)
|
||||
{
|
||||
child.Parent = parent;
|
||||
}
|
||||
child?.Parent = parent;
|
||||
|
||||
if (parent == null)
|
||||
{
|
||||
|
|
@ -314,11 +307,9 @@ namespace Ryujinx.Common.Collections
|
|||
{
|
||||
RestoreBalanceAfterRemoval(child);
|
||||
}
|
||||
|
||||
if (old.Successor != null)
|
||||
old.Successor.Predecessor = old.Predecessor;
|
||||
if (old.Predecessor != null)
|
||||
old.Predecessor.Successor = old.Successor;
|
||||
|
||||
old.Successor?.Predecessor = old.Predecessor;
|
||||
old.Predecessor?.Successor = old.Successor;
|
||||
|
||||
return old;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -250,10 +250,7 @@ namespace Ryujinx.Common.Collections
|
|||
{
|
||||
T right = RightOf(node);
|
||||
node.Right = LeftOf(right);
|
||||
if (node.Right != null)
|
||||
{
|
||||
node.Right.Parent = node;
|
||||
}
|
||||
node.Right?.Parent = node;
|
||||
|
||||
T nodeParent = ParentOf(node);
|
||||
right.Parent = nodeParent;
|
||||
|
|
@ -281,10 +278,7 @@ namespace Ryujinx.Common.Collections
|
|||
{
|
||||
T left = LeftOf(node);
|
||||
node.Left = RightOf(left);
|
||||
if (node.Left != null)
|
||||
{
|
||||
node.Left.Parent = node;
|
||||
}
|
||||
node.Left?.Parent = node;
|
||||
|
||||
T nodeParent = ParentOf(node);
|
||||
left.Parent = nodeParent;
|
||||
|
|
@ -329,10 +323,7 @@ namespace Ryujinx.Common.Collections
|
|||
/// <param name="color">Color (Boolean)</param>
|
||||
protected static void SetColor(T node, bool color)
|
||||
{
|
||||
if (node != null)
|
||||
{
|
||||
node.Color = color;
|
||||
}
|
||||
node?.Color = color;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -328,10 +328,7 @@ namespace Ryujinx.Common.Collections
|
|||
|
||||
Node<TKey, TValue> tmp = LeftOf(replacementNode) ?? RightOf(replacementNode);
|
||||
|
||||
if (tmp != null)
|
||||
{
|
||||
tmp.Parent = ParentOf(replacementNode);
|
||||
}
|
||||
tmp?.Parent = ParentOf(replacementNode);
|
||||
|
||||
if (ParentOf(replacementNode) == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -84,10 +84,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
ICounterEvent evt = _items[index + i].Event;
|
||||
if (evt != null)
|
||||
{
|
||||
evt.Invalid = true;
|
||||
}
|
||||
evt?.Invalid = true;
|
||||
}
|
||||
|
||||
_items.RemoveRange(index, count);
|
||||
|
|
|
|||
|
|
@ -26,12 +26,8 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
|||
// - Both branches are jumping to the same location.
|
||||
// In this case, the branch on the current block can be removed,
|
||||
// as the next block is going to jump to the same place anyway.
|
||||
if (nextBlock == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (nextBlock.Operations.First?.Value is not Operation next)
|
||||
if (nextBlock?.Operations.First?.Value is not Operation next)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -891,10 +891,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
|||
result = new NestedName(name, prev);
|
||||
}
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
context.FinishWithTemplateArguments = false;
|
||||
}
|
||||
context?.FinishWithTemplateArguments = false;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -1074,10 +1071,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
|||
return null;
|
||||
}
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
context.CtorDtorConversion = true;
|
||||
}
|
||||
context?.CtorDtorConversion = true;
|
||||
|
||||
return new ConversionOperatorType(type);
|
||||
default:
|
||||
|
|
@ -1349,10 +1343,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
|||
|
||||
_position++;
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
context.CtorDtorConversion = true;
|
||||
}
|
||||
context?.CtorDtorConversion = true;
|
||||
|
||||
if (isInherited && ParseName(context) == null)
|
||||
{
|
||||
|
|
@ -1372,10 +1363,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
|||
|
||||
_position++;
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
context.CtorDtorConversion = true;
|
||||
}
|
||||
context?.CtorDtorConversion = true;
|
||||
|
||||
return new CtorDtorNameType(prev, true);
|
||||
}
|
||||
|
|
@ -3005,16 +2993,10 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
|||
|
||||
BaseNode result = null;
|
||||
CvType cv = new(ParseCvQualifiers(), null);
|
||||
if (context != null)
|
||||
{
|
||||
context.Cv = cv;
|
||||
}
|
||||
context?.Cv = cv;
|
||||
|
||||
SimpleReferenceType Ref = ParseRefQualifiers();
|
||||
if (context != null)
|
||||
{
|
||||
context.Ref = Ref;
|
||||
}
|
||||
context?.Ref = Ref;
|
||||
|
||||
if (ConsumeIf("St"))
|
||||
{
|
||||
|
|
@ -3060,10 +3042,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
|||
}
|
||||
|
||||
result = new NameTypeWithTemplateArguments(result, templateArgument);
|
||||
if (context != null)
|
||||
{
|
||||
context.FinishWithTemplateArguments = true;
|
||||
}
|
||||
context?.FinishWithTemplateArguments = true;
|
||||
|
||||
_substitutionList.Add(result);
|
||||
continue;
|
||||
|
|
@ -3256,10 +3235,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
|||
return null;
|
||||
}
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
context.FinishWithTemplateArguments = true;
|
||||
}
|
||||
context?.FinishWithTemplateArguments = true;
|
||||
|
||||
return new NameTypeWithTemplateArguments(substitution, templateArguments);
|
||||
}
|
||||
|
|
@ -3279,10 +3255,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
|||
return null;
|
||||
}
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
context.FinishWithTemplateArguments = true;
|
||||
}
|
||||
context?.FinishWithTemplateArguments = true;
|
||||
|
||||
return new NameTypeWithTemplateArguments(result, templateArguments);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,10 +174,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
|
|||
|
||||
if (previousThread != nextThread)
|
||||
{
|
||||
if (previousThread != null)
|
||||
{
|
||||
previousThread.LastScheduledTime = PerformanceCounter.ElapsedTicks;
|
||||
}
|
||||
previousThread?.LastScheduledTime = PerformanceCounter.ElapsedTicks;
|
||||
|
||||
_state.SelectedThread = nextThread;
|
||||
_state.NeedsScheduling = true;
|
||||
|
|
|
|||
|
|
@ -1169,9 +1169,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
|
|||
|
||||
public override void DestroyAtExit()
|
||||
{
|
||||
if (_context != null) {
|
||||
_context.Dispose();
|
||||
}
|
||||
_context?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,10 +58,7 @@ namespace Ryujinx.Memory.Tracking
|
|||
{
|
||||
foreach (RegionHandle handle in _handles)
|
||||
{
|
||||
if (handle != null)
|
||||
{
|
||||
handle?.RegisterAction((address, size) => action(handle.Address, handle.Size));
|
||||
}
|
||||
handle?.RegisterAction((address, size) => action(handle.Address, handle.Size));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -69,10 +66,7 @@ namespace Ryujinx.Memory.Tracking
|
|||
{
|
||||
foreach (RegionHandle handle in _handles)
|
||||
{
|
||||
if (handle != null)
|
||||
{
|
||||
handle?.RegisterPreciseAction((address, size, write) => action(handle.Address, handle.Size, write));
|
||||
}
|
||||
handle?.RegisterPreciseAction((address, size, write) => action(handle.Address, handle.Size, write));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -501,18 +501,12 @@ namespace Ryujinx.Ava.Systems
|
|||
|
||||
private void UpdateIgnoreMissingServicesState(object sender, ReactiveEventArgs<bool> args)
|
||||
{
|
||||
if (Device != null)
|
||||
{
|
||||
Device.Configuration.IgnoreMissingServices = args.NewValue;
|
||||
}
|
||||
Device?.Configuration.IgnoreMissingServices = args.NewValue;
|
||||
}
|
||||
|
||||
private void UpdateAspectRatioState(object sender, ReactiveEventArgs<AspectRatio> args)
|
||||
{
|
||||
if (Device != null)
|
||||
{
|
||||
Device.Configuration.AspectRatio = args.NewValue;
|
||||
}
|
||||
Device?.Configuration.AspectRatio = args.NewValue;
|
||||
}
|
||||
|
||||
private void UpdateAntiAliasing(object sender, ReactiveEventArgs<AntiAliasing> e)
|
||||
|
|
|
|||
|
|
@ -167,10 +167,7 @@ namespace Ryujinx.Ava.UI.Controls
|
|||
|
||||
private void Message_TextInput(object sender, TextInputEventArgs e)
|
||||
{
|
||||
if (_host != null)
|
||||
{
|
||||
_host.IsPrimaryButtonEnabled = _checkLength(Message.Length) && _checkInput(Message);
|
||||
}
|
||||
_host?.IsPrimaryButtonEnabled = _checkLength(Message.Length) && _checkInput(Message);
|
||||
}
|
||||
|
||||
private void Message_KeyUp(object sender, KeyEventArgs e)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue