Skip to content

Commit fe4fe8d

Browse files
authored
Merge pull request #1923 from Hosch250/bugs
Untyped functions are now resolved correctly
2 parents c751d9c + 507ee65 commit fe4fe8d

File tree

6 files changed

+453
-15
lines changed

6 files changed

+453
-15
lines changed

RetailCoder.VBE/Inspections/UntypedFunctionUsageInspection.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,9 @@ public UntypedFunctionUsageInspection(RubberduckParserState state)
4343
public override IEnumerable<InspectionResultBase> GetInspectionResults()
4444
{
4545
var declarations = BuiltInDeclarations
46-
// note: these *should* be functions, but somehow they're not defined as such
4746
.Where(item =>
4847
_tokens.Any(token => item.IdentifierName == token || item.IdentifierName == "_B_var_" + token) &&
49-
item.References.Any(reference => _tokens.Contains(reference.IdentifierName)));
48+
item.Scope.StartsWith("VBE7.DLL;"));
5049

5150
return declarations.SelectMany(declaration => declaration.References
5251
.Where(item => _tokens.Contains(item.IdentifierName))

RetailCoder.VBE/Inspections/UntypedFunctionUsageInspectionResult.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ public override void Fix()
6767
var module = Selection.QualifiedName.Component.CodeModule;
6868
var lines = module.Lines[selection.StartLine, selection.LineCount];
6969

70-
var result = lines.Replace(originalInstruction, newInstruction);
70+
var result = lines.Remove(Context.Start.Column, originalInstruction.Length)
71+
.Insert(Context.Start.Column, newInstruction);
7172
module.ReplaceLine(selection.StartLine, result);
7273
}
7374

Rubberduck.Parsing/Rubberduck.Parsing.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@
134134
<Compile Include="Symbols\CommentNode.cs" />
135135
<Compile Include="Symbols\ComParameter.cs" />
136136
<Compile Include="Symbols\DebugDeclarations.cs" />
137+
<Compile Include="Symbols\AliasDeclarations.cs" />
137138
<Compile Include="Symbols\FormEventDeclarations.cs" />
138139
<Compile Include="Symbols\ICustomDelarationLoader.cs" />
139140
<Compile Include="Symbols\Identifier.cs" />

0 commit comments

Comments
 (0)