From 26c1a2c347120ddf7fb7c7715a7a7c7fbc7513af Mon Sep 17 00:00:00 2001 From: Ynse Hoornenborg Date: Sat, 4 Mar 2023 17:15:12 +0100 Subject: [PATCH] Fix build for changed code --- .../PreferReadOnlyParametersAnalyzer.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Philips.CodeAnalysis.MaintainabilityAnalyzers/Maintainability/PreferReadOnlyParametersAnalyzer.cs b/Philips.CodeAnalysis.MaintainabilityAnalyzers/Maintainability/PreferReadOnlyParametersAnalyzer.cs index 6b98dcf6f..ca1ddac9a 100644 --- a/Philips.CodeAnalysis.MaintainabilityAnalyzers/Maintainability/PreferReadOnlyParametersAnalyzer.cs +++ b/Philips.CodeAnalysis.MaintainabilityAnalyzers/Maintainability/PreferReadOnlyParametersAnalyzer.cs @@ -29,23 +29,23 @@ public class PreferReadOnlyParametersNodeAction : SyntaxNodeAction parameters = Node.ParameterList.Parameters; if (!parameters.Any()) { return; } - var aliases = Helper.GetUsingAliases(Node); - var collections = parameters.Where(p => IsReadWriteCollection(p.Type, aliases)); + IReadOnlyDictionary aliases = Helper.GetUsingAliases(Node); + IEnumerable collections = parameters.Where(p => IsReadWriteCollection(p.Type, aliases)); if (!collections.Any()) { return; } - var accesses = Node.DescendantNodes().OfType(); - var setters = Node.DescendantNodes() + IEnumerable accesses = Node.DescendantNodes().OfType(); + IEnumerable setters = Node.DescendantNodes() .OfType() .Select(ass => ass.Left as ElementAccessExpressionSyntax); - var invocations = Node.DescendantNodes().OfType(); + IEnumerable invocations = Node.DescendantNodes().OfType(); foreach (ParameterSyntax collectionParameter in collections) { var parameterName = collectionParameter.Identifier.Text; @@ -57,7 +57,7 @@ public override void Analyze() !setters.Any(element => element != null && IsCallingParameter(element.Expression, parameterName)) && !invocations.Any(voc => RequiresReadWrite(voc, parameterName))) { - var location = collectionParameter.Type.GetLocation(); + Location location = collectionParameter.Type.GetLocation(); ReportDiagnostic(location, collectionParameter.Identifier.Text); } } @@ -82,13 +82,13 @@ private static bool IsModifyingMember(SimpleNameSyntax name) private bool RequiresReadWrite(InvocationExpressionSyntax invocation, string parameterName) { - var arguments = invocation.ArgumentList.Arguments.Where(arg => IsCallingParameter(arg.Expression, parameterName)); + IEnumerable arguments = invocation.ArgumentList.Arguments.Where(arg => IsCallingParameter(arg.Expression, parameterName)); if (!arguments.Any()) { return false; } - bool needsReadWrite = false; - var symbol = Context.SemanticModel.GetSymbolInfo(invocation).Symbol; + var needsReadWrite = false; + ISymbol symbol = Context.SemanticModel.GetSymbolInfo(invocation).Symbol; foreach (ArgumentSyntax argument in arguments) { if (symbol != null)