Skip to content

Commit a18c796

Browse files
committed
closes #430
1 parent bb03b45 commit a18c796

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

RetailCoder.VBE/Inspections/ImplicitVariantReturnTypeInspection.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using Antlr4.Runtime;
5-
using Microsoft.CSharp.RuntimeBinder;
65
using Rubberduck.Parsing;
7-
using Rubberduck.Parsing.Listeners;
86
using Rubberduck.Parsing.Grammar;
97
using Rubberduck.Parsing.Symbols;
108

RetailCoder.VBE/Inspections/ImplicitVariantReturnTypeInspectionResult.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Diagnostics;
4-
using System.Linq;
54
using Antlr4.Runtime;
65
using Microsoft.Vbe.Interop;
7-
using Rubberduck.Extensions;
86
using Rubberduck.Parsing;
97
using Rubberduck.Parsing.Grammar;
108
using Rubberduck.VBA.Nodes;

Rubberduck.Parsing/Symbols/IdentifierReferenceListener.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,7 @@ public override void EnterAmbiguousIdentifier(VBAParser.AmbiguousIdentifierConte
214214

215215
var selection = context.GetSelection();
216216

217-
if (context.Parent is VBAParser.ForNextStmtContext
218-
|| context.Parent is VBAParser.ForEachStmtContext)
217+
if (IsAssignmentContext(context))
219218
{
220219
EnterIdentifier(context, selection, true);
221220
}
@@ -225,6 +224,14 @@ public override void EnterAmbiguousIdentifier(VBAParser.AmbiguousIdentifierConte
225224
}
226225
}
227226

227+
private bool IsAssignmentContext(ParserRuleContext context)
228+
{
229+
return context.Parent is VBAParser.ForNextStmtContext
230+
|| context.Parent is VBAParser.ForEachStmtContext
231+
|| context.Parent.Parent.Parent.Parent is VBAParser.LineInputStmtContext
232+
|| context.Parent.Parent.Parent.Parent is VBAParser.InputStmtContext;
233+
}
234+
228235
public override void EnterCertainIdentifier(VBAParser.CertainIdentifierContext context)
229236
{
230237
// skip declarations

0 commit comments

Comments
 (0)