From db8aabacf1447fbcad49a6d0b1872413f9e6016b Mon Sep 17 00:00:00 2001 From: Mathieu Guindon Date: Thu, 18 Jan 2018 22:36:07 -0500 Subject: [PATCH] Update VariableRequiresSetAssignmentEvaluator.cs closes #3712 --- .../VariableRequiresSetAssignmentEvaluator.cs | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/Rubberduck.Inspections/VariableRequiresSetAssignmentEvaluator.cs b/Rubberduck.Inspections/VariableRequiresSetAssignmentEvaluator.cs index 42e1d153ae..a44b924cda 100644 --- a/Rubberduck.Inspections/VariableRequiresSetAssignmentEvaluator.cs +++ b/Rubberduck.Inspections/VariableRequiresSetAssignmentEvaluator.cs @@ -11,9 +11,8 @@ public static class VariableRequiresSetAssignmentEvaluator { public static IEnumerable GetDeclarationsPotentiallyRequiringSetAssignment(IEnumerable declarations) { - //Reduce most of the declaration list with the easy ones - var relevantDeclarations = declarations.Where(dec => dec.AsTypeName == Tokens.Variant - || !SymbolList.ValueTypes.Contains(dec.AsTypeName) + var relevantDeclarations = declarations.Where(dec => dec.AsTypeName != Tokens.Variant + && !SymbolList.ValueTypes.Contains(dec.AsTypeName) &&(MayRequireAssignmentUsingSet(dec) || RequiresAssignmentUsingSet(dec))); return relevantDeclarations; @@ -21,19 +20,10 @@ public static IEnumerable GetDeclarationsPotentiallyRequiringSetAss public static bool RequiresSetAssignment(IdentifierReference reference, RubberduckParserState state) { - //Not an assignment...definitely does not require a 'Set' assignment - if (!reference.IsAssignment) + if (!reference.IsAssignment || !MayRequireAssignmentUsingSet(reference.Declaration)) { return false; } - - //We know for sure it DOES NOT use 'Set' - if (!MayRequireAssignmentUsingSet(reference.Declaration)) - { - return false; - } - - //We know for sure that it DOES use 'Set' if (RequiresAssignmentUsingSet(reference.Declaration)) { return true;