Fix IDE0074

This commit is contained in:
RoosterDragon
2023-04-05 19:20:51 +01:00
committed by Pavel Penev
parent cbd0583289
commit bd2b3d9793
30 changed files with 42 additions and 81 deletions

View File

@@ -600,8 +600,7 @@ namespace OpenRA
Lazy<ScriptActorInterface> luaInterface;
public void OnScriptBind(ScriptContext context)
{
if (luaInterface == null)
luaInterface = Exts.Lazy(() => new ScriptActorInterface(context, this));
luaInterface ??= Exts.Lazy(() => new ScriptActorInterface(context, this));
}
public LuaValue this[LuaRuntime runtime, LuaValue keyValue]

View File

@@ -535,8 +535,7 @@ namespace OpenRA
{
object val;
if (md == null)
md = my.ToDictionary();
md ??= my.ToDictionary();
if (fli.Loader != null)
{
if (!fli.Attribute.Required || md.ContainsKey(fli.YamlName))

View File

@@ -167,8 +167,7 @@ namespace OpenRA.Graphics
CalculateSpriteGeometry(tl, br, 1, out var spriteSize, out var spriteOffset);
CalculateSpriteGeometry(stl, sbr, 2, out var shadowSpriteSize, out var shadowSpriteOffset);
if (sheetBuilderForFrame == null)
sheetBuilderForFrame = new SheetBuilder(SheetType.BGRA, AllocateSheet);
sheetBuilderForFrame ??= new SheetBuilder(SheetType.BGRA, AllocateSheet);
var sprite = sheetBuilderForFrame.Allocate(spriteSize, 0, spriteOffset);
var shadowSprite = sheetBuilderForFrame.Allocate(shadowSpriteSize, 0, shadowSpriteOffset);

View File

@@ -151,8 +151,7 @@ namespace OpenRA
static List<MiniYamlNode> FromLines(IEnumerable<ReadOnlyMemory<char>> lines, string filename, bool discardCommentsAndWhitespace, Dictionary<string, string> stringPool)
{
if (stringPool == null)
stringPool = new Dictionary<string, string>();
stringPool ??= new Dictionary<string, string>();
var levels = new List<List<MiniYamlNode>>
{

View File

@@ -294,8 +294,7 @@ namespace OpenRA
Lazy<ScriptPlayerInterface> luaInterface;
public void OnScriptBind(ScriptContext context)
{
if (luaInterface == null)
luaInterface = Exts.Lazy(() => new ScriptPlayerInterface(context, this));
luaInterface ??= Exts.Lazy(() => new ScriptPlayerInterface(context, this));
}
public LuaValue this[LuaRuntime runtime, LuaValue keyValue]

View File

@@ -55,8 +55,7 @@ namespace OpenRA.Support
Write();
else if (ElapsedMs > thresholdMs)
{
if (parent.children == null)
parent.children = new List<PerfTimer>();
parent.children ??= new List<PerfTimer>();
parent.children.Add(this);
}
}