Skip to content

Commit f5b4a6c

Browse files
committed
Replace dynamic in IndentifierReference
1 parent 9bbafdd commit f5b4a6c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Rubberduck.Parsing/Symbols/IdentifierReference.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,20 @@ public bool HasTypeHint(out string token)
9797
return false;
9898
}
9999

100-
var hint = ((dynamic)Context.Parent).typeHint() as VBAParser.TypeHintContext;
100+
VBAParser.TypeHintContext hint;
101+
switch (Context.Parent)
102+
{
103+
case VBAParser.TypedIdentifierContext typedIdentifierContext:
104+
hint = typedIdentifierContext.typeHint();
105+
break;
106+
case VBAParser.LiteralExpressionContext literalExpressionContext:
107+
hint = literalExpressionContext.typeHint();
108+
break;
109+
default:
110+
hint = null;
111+
break;
112+
}
113+
101114
token = hint?.GetText();
102115
_hasTypeHint = hint != null;
103116
return _hasTypeHint.Value;

0 commit comments

Comments
 (0)