Fix CA1854
This commit is contained in:
committed by
Pavel Penev
parent
c2568ebd1f
commit
c8efc5fdd7
@@ -285,10 +285,10 @@ namespace OpenRA.Mods.Common.Lint
|
||||
var isAttribute = !string.IsNullOrEmpty(attribute);
|
||||
var keyWithAtrr = isAttribute ? $"{key}.{attribute}" : key;
|
||||
|
||||
if (!referencedVariablesPerKey.ContainsKey(keyWithAtrr))
|
||||
if (!referencedVariablesPerKey.TryGetValue(keyWithAtrr, out var referencedVariables))
|
||||
return;
|
||||
|
||||
foreach (var referencedVariable in referencedVariablesPerKey[keyWithAtrr])
|
||||
foreach (var referencedVariable in referencedVariables)
|
||||
if (!variableReferences.Contains(referencedVariable))
|
||||
emitError(isAttribute ?
|
||||
$"Missing variable `{referencedVariable}` for attribute `{attribute}` of key `{key}` in {file}." :
|
||||
@@ -302,7 +302,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
|
||||
variableReferences.Add(varName);
|
||||
|
||||
if (!referencedVariablesPerKey.ContainsKey(keyWithAtrr) || !referencedVariablesPerKey[keyWithAtrr].Contains(varName))
|
||||
if (!referencedVariablesPerKey.TryGetValue(keyWithAtrr, out var referencedVariables) || !referencedVariables.Contains(varName))
|
||||
emitWarning(isAttribute ?
|
||||
$"Unused variable `{varName}` for attribute `{attribute}` of key `{key}` in {file}." :
|
||||
$"Unused variable `{varName}` for key `{key}` in {file}.");
|
||||
|
||||
Reference in New Issue
Block a user