Use out var syntax
This commit is contained in:
@@ -89,9 +89,8 @@ namespace OpenRA.Mods.Common.Lint
|
||||
var type = modData.ObjectCreator.FindType(widgetType + "Widget");
|
||||
var keyNames = checkMethods.SelectMany(m => (IEnumerable<string>)type.GetMethod(m).Invoke(null, new object[] { node, emitError, emitWarning }));
|
||||
|
||||
Hotkey unused;
|
||||
foreach (var name in keyNames)
|
||||
if (!namedKeys.Contains(name) && !Hotkey.TryParse(name, out unused))
|
||||
if (!namedKeys.Contains(name) && !Hotkey.TryParse(name, out var unused))
|
||||
emitError("{0} refers to a Key named `{1}` that does not exist".F(node.Location, name));
|
||||
}
|
||||
|
||||
|
||||
@@ -43,9 +43,8 @@ namespace OpenRA.Mods.Common.Lint
|
||||
if (string.IsNullOrEmpty(notification))
|
||||
continue;
|
||||
|
||||
SoundInfo soundInfo;
|
||||
if (string.IsNullOrEmpty(type) || !rules.Notifications.TryGetValue(type.ToLowerInvariant(), out soundInfo) ||
|
||||
!soundInfo.Notifications.ContainsKey(notification))
|
||||
if (string.IsNullOrEmpty(type) || !rules.Notifications.TryGetValue(type.ToLowerInvariant(), out var soundInfo) ||
|
||||
!soundInfo.Notifications.ContainsKey(notification))
|
||||
emitError("Undefined notification reference {0}.{1} detected at {2} for {3}".F(
|
||||
type ?? "(null)", notification, traitInfo.GetType().Name, actorInfo.Key));
|
||||
}
|
||||
|
||||
@@ -95,8 +95,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
if (!playerNames.Contains(ownerName))
|
||||
emitError("Actor {0} is owned by unknown player {1}.".F(kv.Key, ownerName));
|
||||
|
||||
RequiresSpecificOwnersInfo info;
|
||||
if (actorsWithRequiredOwner.TryGetValue(kv.Value.Value, out info))
|
||||
if (actorsWithRequiredOwner.TryGetValue(kv.Value.Value, out var info))
|
||||
if (!info.ValidOwnerNames.Contains(ownerName))
|
||||
emitError("Actor {0} owner {1} is not one of ValidOwnerNames: {2}".F(kv.Key, ownerName, info.ValidOwnerNames.JoinWith(", ")));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user