mirror of
https://git.ryujinx.app/kenji-nx/ryujinx.git
synced 2025-12-12 01:37:02 +00:00
Use the new C# 14 null propagation setter
This commit is contained in:
parent
b7c13715f1
commit
e349ef72fb
13 changed files with 33 additions and 123 deletions
|
|
@ -359,10 +359,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)
|
||||
{
|
||||
|
|
@ -570,10 +567,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;
|
||||
if (nodeParent == null)
|
||||
|
|
@ -601,10 +595,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;
|
||||
if (nodeParent == null)
|
||||
|
|
@ -651,10 +642,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>
|
||||
|
|
|
|||
|
|
@ -384,10 +384,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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -232,10 +232,7 @@ namespace Ryujinx.Common.Collections
|
|||
parent = ParentOf(element);
|
||||
color = ColorOf(element);
|
||||
|
||||
if (child != null)
|
||||
{
|
||||
child.Parent = parent;
|
||||
}
|
||||
child?.Parent = parent;
|
||||
|
||||
if (parent == null)
|
||||
{
|
||||
|
|
@ -255,8 +252,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)
|
||||
{
|
||||
|
|
@ -289,10 +285,7 @@ namespace Ryujinx.Common.Collections
|
|||
parent = ParentOf(nodeToDelete);
|
||||
color = ColorOf(nodeToDelete);
|
||||
|
||||
if (child != null)
|
||||
{
|
||||
child.Parent = parent;
|
||||
}
|
||||
child?.Parent = parent;
|
||||
|
||||
if (parent == null)
|
||||
{
|
||||
|
|
@ -311,11 +304,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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -238,10 +238,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;
|
||||
if (nodeParent == null)
|
||||
|
|
@ -267,10 +264,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;
|
||||
if (nodeParent == null)
|
||||
|
|
@ -313,10 +307,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>
|
||||
|
|
|
|||
|
|
@ -318,10 +318,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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -885,10 +885,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
|||
result = new NestedName(name, prev);
|
||||
}
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
context.FinishWithTemplateArguments = false;
|
||||
}
|
||||
context?.FinishWithTemplateArguments = false;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -1068,10 +1065,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
|||
return null;
|
||||
}
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
context.CtorDtorConversion = true;
|
||||
}
|
||||
context?.CtorDtorConversion = true;
|
||||
|
||||
return new ConversionOperatorType(type);
|
||||
default:
|
||||
|
|
@ -1339,10 +1333,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
|||
|
||||
_position++;
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
context.CtorDtorConversion = true;
|
||||
}
|
||||
context?.CtorDtorConversion = true;
|
||||
|
||||
if (isInherited && ParseName(context) == null)
|
||||
{
|
||||
|
|
@ -1362,10 +1353,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
|||
|
||||
_position++;
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
context.CtorDtorConversion = true;
|
||||
}
|
||||
context?.CtorDtorConversion = true;
|
||||
|
||||
return new CtorDtorNameType(prev, true);
|
||||
}
|
||||
|
|
@ -2968,16 +2956,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"))
|
||||
{
|
||||
|
|
@ -3022,10 +3004,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;
|
||||
|
|
@ -3215,10 +3194,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
|||
return null;
|
||||
}
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
context.FinishWithTemplateArguments = true;
|
||||
}
|
||||
context?.FinishWithTemplateArguments = true;
|
||||
|
||||
return new NameTypeWithTemplateArguments(substitution, templateArguments);
|
||||
}
|
||||
|
|
@ -3238,10 +3214,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler
|
|||
return null;
|
||||
}
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
context.FinishWithTemplateArguments = true;
|
||||
}
|
||||
context?.FinishWithTemplateArguments = true;
|
||||
|
||||
return new NameTypeWithTemplateArguments(result, templateArguments);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -177,10 +177,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 (var handle in _handles)
|
||||
{
|
||||
if (handle != null)
|
||||
{
|
||||
handle?.RegisterAction((_, _) => action(handle.Address, handle.Size));
|
||||
}
|
||||
handle?.RegisterAction((_, _) => action(handle.Address, handle.Size));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -69,10 +66,7 @@ namespace Ryujinx.Memory.Tracking
|
|||
{
|
||||
foreach (var handle in _handles)
|
||||
{
|
||||
if (handle != null)
|
||||
{
|
||||
handle?.RegisterPreciseAction((_, _, write) => action(handle.Address, handle.Size, write));
|
||||
}
|
||||
handle?.RegisterPreciseAction((_, _, write) => action(handle.Address, handle.Size, write));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -508,18 +508,12 @@ namespace Ryujinx.Ava
|
|||
|
||||
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