Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update VariableRequiresSetAssignmentEvaluator.cs
closes #3712
  • Loading branch information
retailcoder committed Jan 19, 2018
1 parent 6c27601 commit db8aaba
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions Rubberduck.Inspections/VariableRequiresSetAssignmentEvaluator.cs
Expand Up @@ -11,29 +11,19 @@ public static class VariableRequiresSetAssignmentEvaluator
{
public static IEnumerable<Declaration> GetDeclarationsPotentiallyRequiringSetAssignment(IEnumerable<Declaration> 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;
}

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;
Expand Down

0 comments on commit db8aaba

Please sign in to comment.