Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
153 commits
Select commit Hold shift + click to select a range
7cfadbb
A few Extract Interface tests
Hosch250 Jul 18, 2016
3c72bc9
More tests for Extract Interface.
Hosch250 Jul 18, 2016
ec350ec
Make everything happy again.
Hosch250 Jul 18, 2016
746a780
Merge branch 'next' into Issue2065
Hosch250 Jul 18, 2016
98f6446
Merge pull request #2082 from Hosch250/Issue2065
Hosch250 Jul 18, 2016
36ec6bc
FindAllReferences tests. Remove obsolete TodoController tests
Hosch250 Jul 19, 2016
03e0447
Merge branch 'Issue2065' of https://github.com/Hosch250/Rubberduck
Hosch250 Jul 19, 2016
98cc9ce
Merge branch 'next' of https://github.com/rubberduck-vba/Rubberduck i…
Hosch250 Jul 19, 2016
029d1ff
Merge pull request #2083 from Hosch250/Issue2065
Hosch250 Jul 19, 2016
95bf91c
FindAllImplementations tests
Hosch250 Jul 19, 2016
a6dde40
Merge pull request #2088 from Hosch250/Issue2065
Hosch250 Jul 19, 2016
d54612a
Make Todo explorer update when the declarations are resolved so it re…
Hosch250 Jul 19, 2016
e4bc593
Merge pull request #2089 from Hosch250/Issue2085
Hosch250 Jul 19, 2016
0645d2d
Close #2069
Hosch250 Jul 19, 2016
4385dfb
Merge branch 'next' into Issue2069
Hosch250 Jul 19, 2016
af1a539
Merge pull request #2090 from Hosch250/Issue2069
Hosch250 Jul 19, 2016
3976556
Make CE double click listen for node dc instead of tree dc
Hosch250 Jul 19, 2016
d112a03
Merge branch 'Issue2069' of https://github.com/Hosch250/Rubberduck
Hosch250 Jul 19, 2016
03629a0
Merge branch 'next' into Issue2069
Hosch250 Jul 19, 2016
d8aefb5
Merge pull request #2091 from Hosch250/Issue2069
Hosch250 Jul 19, 2016
84e1f6d
Essentially close #1681
Hosch250 Jul 19, 2016
56ff99d
UI tweaks
Hosch250 Jul 19, 2016
71ef474
Close #2063
Hosch250 Jul 19, 2016
83b4634
Merge pull request #2093 from Hosch250/Issue2063
Hosch250 Jul 19, 2016
e7fff50
Merge branch 'next' into Issue1681
Hosch250 Jul 19, 2016
113aae8
Close #984 (English only)
Hosch250 Jul 19, 2016
cc2565c
Merge branch 'next' into Issue984
Hosch250 Jul 19, 2016
a792006
Close #2077
Hosch250 Jul 20, 2016
35a0d1f
Merge branch 'next' into Issue2077
Hosch250 Jul 20, 2016
7855e3c
Correctly clear SC view when tracked project is closed
Hosch250 Jul 20, 2016
0b24243
Merge branch 'next' into sourceControlBugs
Hosch250 Jul 20, 2016
a2a79d0
Fix obsolete comment inspection bugs
Hosch250 Jul 20, 2016
0e571b9
Merge branch 'next' into obsoleteCommentBugs
Hosch250 Jul 20, 2016
49db64c
Merge pull request #2102 from Hosch250/obsoleteCommentBugs
Hosch250 Jul 20, 2016
5082a03
Merge pull request #2100 from Hosch250/sourceControlBugs
retailcoder Jul 21, 2016
325c590
Tweak wording
Hosch250 Jul 21, 2016
fefa438
Merge branch 'Issue984' of https://github.com/Hosch250/Rubberduck
Hosch250 Jul 21, 2016
e15c360
Merge branch 'next' into Issue984
Hosch250 Jul 21, 2016
b50294a
Respond to comments. Still one bug when adding item and editing at t…
Hosch250 Jul 21, 2016
9788cc3
Merge branch 'Issue1681' of https://github.com/Hosch250/Rubberduck
Hosch250 Jul 21, 2016
2219fc8
Merge branch 'next' into Issue1681
Hosch250 Jul 21, 2016
a87bb84
Merge pull request #2092 from Hosch250/Issue1681
retailcoder Jul 21, 2016
f990bdb
Get the website working again
Hosch250 Jul 21, 2016
0d65142
Merge branch 'next' into Issue1681
Hosch250 Jul 21, 2016
bbd3821
Close #2111
Hosch250 Jul 21, 2016
c811561
Merge branch 'next' of https://github.com/rubberduck-vba/Rubberduck i…
Hosch250 Jul 21, 2016
89b9639
Warn when documents do not exist (only when loading the repo/switchin…
Hosch250 Jul 21, 2016
c9424d4
Tweak error wording
Hosch250 Jul 21, 2016
2b7711c
Merge pull request #2112 from Hosch250/Issue1681
Hosch250 Jul 21, 2016
6a32091
Merge branch 'next' into sourceControlBugs
Hosch250 Jul 21, 2016
b017124
Merge pull request #2114 from Hosch250/sourceControlBugs
Hosch250 Jul 21, 2016
5e16e8a
Remove IEnumerable<IInspection> dependency from CodeInspectionSettings
comintern Jul 22, 2016
5cfc091
Merge branch 'next' into next
comintern Jul 22, 2016
f9cbca9
Make Find Symbol set focus after the modal dialog closes.
comintern Jul 22, 2016
cd6d4d2
Merge pull request #2115 from comintern/next
retailcoder Jul 22, 2016
fbd01e7
Merge pull request #2095 from Hosch250/Issue2077
retailcoder Jul 22, 2016
e18f999
Merge pull request #2094 from Hosch250/Issue984
retailcoder Jul 22, 2016
0c2e7f9
Close #2023
Hosch250 Jul 22, 2016
c04f432
Merge pull request #2117 from Hosch250/Issue2023
Hosch250 Jul 22, 2016
8494653
Close #2116. Fix broken Encapsulate Public Field quick fix
Hosch250 Jul 22, 2016
71deb65
Merge pull request #2118 from Hosch250/Issue2116
Hosch250 Jul 22, 2016
8e97dd1
Fixed Strings in InspectionsUI (fixes #984 german), normalized Rubber…
Vogel612 Jul 22, 2016
eaf30a1
Updated German Localization in RubberduckUI
Vogel612 Jul 22, 2016
b4b4888
Close #219. Fix sinks bug.
Hosch250 Jul 22, 2016
d48dd14
Merge pull request #2119 from Vogel612/i18n
Hosch250 Jul 22, 2016
ec70baf
Merge branch 'next' into Issue2116
Hosch250 Jul 22, 2016
ee0ea0a
Merge pull request #2120 from Hosch250/Issue2116
Hosch250 Jul 22, 2016
b0c331b
Close #2097
Hosch250 Jul 22, 2016
721474c
Fix tests
Hosch250 Jul 22, 2016
43efbf8
Merge pull request #2122 from Hosch250/Issue2097
Hosch250 Jul 22, 2016
06fab45
Make tests not access registry
Hosch250 Jul 22, 2016
4e18363
Merge branch 'next' into Issue2097
Hosch250 Jul 22, 2016
fd88129
Merge pull request #2123 from Hosch250/Issue2097
Hosch250 Jul 22, 2016
e393052
Fix memory leak in Parameter Not Used inspection
Hosch250 Jul 22, 2016
5112a8b
Merge branch 'Issue2097' of https://github.com/Hosch250/Rubberduck
Hosch250 Jul 22, 2016
5d320de
Merge branch 'next' into Issue2097
Hosch250 Jul 22, 2016
4ee7f82
Merge pull request #2124 from Hosch250/Issue2097
Hosch250 Jul 22, 2016
cf7b969
Delete Swedish and Japanese translations because they date from 1.4.3…
Hosch250 Jul 22, 2016
159bef8
Merge branch 'Issue2097' of https://github.com/Hosch250/Rubberduck
Hosch250 Jul 22, 2016
c837272
Use fr-CA instead of sv-SV in the tests
Hosch250 Jul 22, 2016
c4ff4ba
Merge branch 'next' into Issue2097
Hosch250 Jul 22, 2016
5c6c020
Close #2101
Hosch250 Jul 22, 2016
120ad5f
Merge with conflicts
Hosch250 Jul 22, 2016
f2d2d67
Merge pull request #2126 from Hosch250/Issue2101
Hosch250 Jul 22, 2016
7055b17
Merge pull request #2125 from Hosch250/Issue2097
retailcoder Jul 24, 2016
c7a813c
A couple tests.
Hosch250 Jul 25, 2016
8cfab14
More unit tests
Hosch250 Jul 25, 2016
f359010
Merge branch 'next' into unitTests
Hosch250 Jul 25, 2016
90005ea
A couple more tests
Hosch250 Jul 25, 2016
f2cb78e
Merge branch 'unitTests' of https://github.com/Hosch250/Rubberduck
Hosch250 Jul 25, 2016
b4ad2ac
Refactor unit test commands
Hosch250 Jul 25, 2016
817e2ff
Tweak SC bindings
Hosch250 Jul 26, 2016
ac88973
Merge pull request #2134 from Hosch250/unitTests
retailcoder Jul 26, 2016
ff80a41
Close #2138
Hosch250 Jul 26, 2016
f0d401f
Various small tweaks. Close #2142
Hosch250 Jul 26, 2016
1fd8061
Merge pull request #2140 from Hosch250/Issue2138
Hosch250 Jul 26, 2016
81e4c24
Merge branch 'next' into Issue2142
Hosch250 Jul 26, 2016
6230fa4
Merge pull request #2143 from Hosch250/Issue2142
Hosch250 Jul 26, 2016
d095a11
Adjust Encapsulate Field tab order
Hosch250 Jul 26, 2016
d050e34
Set tab order for Extract Interface dialog
Hosch250 Jul 26, 2016
fd20c23
Set tab stop for Extract Method dialog
Hosch250 Jul 26, 2016
ecb2955
Set Remove Parameters tab order
Hosch250 Jul 26, 2016
3e5362d
Set tab order for Rename dialog
Hosch250 Jul 26, 2016
e1dc6e7
Set tab order for Reorder Parameters dialog
Hosch250 Jul 26, 2016
c3a506e
Remove parameters signature bugs are gone
Hosch250 Jul 26, 2016
86d006b
Fix bugs in generated remove params callers
Hosch250 Jul 26, 2016
cb279a5
Correctly remove parameters from contexts resolved into "IndexExpress…
Hosch250 Jul 26, 2016
1847ab1
Merge pull request #2146 from Hosch250/Issue2135
Hosch250 Jul 26, 2016
e5c3cda
Fix reorder params signature bugs.
Hosch250 Jul 26, 2016
8941329
Fix reorder params caller bugs
Hosch250 Jul 26, 2016
3fbaef7
Fix reorder params with parens around caller
Hosch250 Jul 26, 2016
0eb2cf4
Merge branch 'next' into Issue2135
Hosch250 Jul 26, 2016
4f5f532
Merge pull request #2148 from Hosch250/Issue2135
Hosch250 Jul 26, 2016
6938cd2
Add a bunch of tests
Hosch250 Jul 26, 2016
836d459
Merge branch 'Issue2135' of https://github.com/Hosch250/Rubberduck
Hosch250 Jul 26, 2016
6a3f2c0
Merge branch 'next' into Issue2135
Hosch250 Jul 26, 2016
332994f
A bunch more tests
Hosch250 Jul 27, 2016
61a43eb
Merge branch 'Issue2135' of https://github.com/Hosch250/Rubberduck
Hosch250 Jul 27, 2016
15b9aea
Merge pull request #2149 from Hosch250/Issue2135
Hosch250 Jul 27, 2016
09d024e
Give Write Only Property a custom quick fix
Hosch250 Jul 27, 2016
d67f66a
Merge branch 'next' into Issue2135
Hosch250 Jul 27, 2016
2d01027
Clean up memory leaks from the dockable presenters
Hosch250 Jul 27, 2016
64117cd
Fix messed-up config.
Hosch250 Jul 27, 2016
0b99ef9
Fix more memory leaks.
Hosch250 Jul 27, 2016
968632d
Make EmptyNamespace and OutputXmlSettings static
Hosch250 Jul 27, 2016
c1bbbe2
Merge branch 'next' into ninjectMemoryLeaks
Hosch250 Jul 27, 2016
acd5038
Close #2056
Hosch250 Jul 27, 2016
bbeaffb
Merge pull request #2152 from Hosch250/Issue2056
Hosch250 Jul 27, 2016
2320149
Merge branch 'next' into Issue2135
Hosch250 Jul 27, 2016
c2d0696
Merge pull request #2150 from Hosch250/Issue2135
Hosch250 Jul 27, 2016
458ec20
Merge branch 'next' into ninjectMemoryLeaks
Hosch250 Jul 27, 2016
596f1f0
Close #984 (delete French translation to keep us reminded)
Hosch250 Jul 27, 2016
cd9d575
Merge branch 'next' into Issue2056
Hosch250 Jul 27, 2016
a9da168
Merge pull request #2153 from Hosch250/Issue2056
Hosch250 Jul 27, 2016
e30c994
Dispose of RubberduckParserState in App
Hosch250 Jul 27, 2016
4ccf9cc
Merge branch 'ninjectMemoryLeaks' of https://github.com/Hosch250/Rubb…
Hosch250 Jul 27, 2016
d931a6d
Fix a couple settings UI bugs
Hosch250 Jul 28, 2016
21fbaec
Merge pull request #2157 from Hosch250/settingsBug
Hosch250 Jul 28, 2016
12878c3
Close #2130
Hosch250 Jul 28, 2016
9340a52
Merge pull request #2158 from Hosch250/Issue2130
Hosch250 Jul 28, 2016
f81dd86
Merge branch 'next' into ninjectMemoryLeaks
Hosch250 Jul 28, 2016
bb9e7cc
Merge pull request #2151 from Hosch250/ninjectMemoryLeaks
Hosch250 Jul 28, 2016
7fb1f8b
Make the indenter settings gridsplitter a little more obvious
Hosch250 Jul 28, 2016
8a74be3
Improve gridsplitter UI more.
Hosch250 Jul 29, 2016
cef981b
Merge pull request #2159 from Hosch250/settingsBug
Hosch250 Jul 29, 2016
596870a
Fix bug in Convert Function/Property Get to Procedure quick fix
Hosch250 Jul 29, 2016
c3a0206
Merge pull request #2160 from Hosch250/convertToProcBug
Hosch250 Jul 29, 2016
591b7fb
Close #1667
Hosch250 Jul 29, 2016
0eb936c
Close #2053
Hosch250 Jul 29, 2016
090be5d
Merge pull request #2162 from Hosch250/Issue2053
Hosch250 Jul 29, 2016
af99f5b
Merge pull request #2161 from Hosch250/Issue1667
retailcoder Jul 29, 2016
ebb0cad
Change build number
Hosch250 Jul 29, 2016
2e25afe
Merge pull request #2165 from Hosch250/release
Hosch250 Jul 29, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions RetailCoder.VBE/API/ParserState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ public void Initialize(VBE vbe)
throw new InvalidOperationException("ParserState is already initialized.");
}

_state = new RubberduckParserState(vbe, new Sinks(vbe));
_state = new RubberduckParserState(new Sinks(vbe));
_state.StateChanged += _state_StateChanged;

Func<IVBAPreprocessor> preprocessorFactory = () => new VBAPreprocessor(double.Parse(vbe.Version, CultureInfo.InvariantCulture));
_attributeParser = new AttributeParser(new ModuleExporter(), preprocessorFactory);
_parser = new RubberduckParser(_state, _attributeParser, preprocessorFactory,
_parser = new RubberduckParser(vbe, _state, _attributeParser, preprocessorFactory,
new List<ICustomDeclarationLoader> { new DebugDeclarations(_state), new FormEventDeclarations(_state), new AliasDeclarations(_state) });
}

Expand Down
1 change: 1 addition & 0 deletions RetailCoder.VBE/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ public void Dispose()
{
_parser.State.StateChanged -= Parser_StateChanged;
_parser.State.StatusMessageUpdate -= State_StatusMessageUpdate;
_parser.State.Dispose();
_parser.Dispose();
// I won't set this to null because other components may try to release things
}
Expand Down
62 changes: 31 additions & 31 deletions RetailCoder.VBE/Inspections/ConvertToProcedureQuickFix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,18 @@
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Microsoft.Vbe.Interop;
using Rubberduck.Parsing.Symbols;

namespace Rubberduck.Inspections
{
public class ConvertToProcedureQuickFix : CodeInspectionQuickFix
{
private readonly IEnumerable<string> _returnStatements;
private readonly Declaration _target;

public ConvertToProcedureQuickFix(ParserRuleContext context, QualifiedSelection selection)
: this(context, selection, new List<string>())
{
}

public ConvertToProcedureQuickFix(ParserRuleContext context, QualifiedSelection selection, IEnumerable<string> returnStatements)
public ConvertToProcedureQuickFix(ParserRuleContext context, QualifiedSelection selection, Declaration target)
: base(context, selection, InspectionsUI.ConvertFunctionToProcedureQuickFix)
{
_returnStatements = returnStatements;
_target = target;
}

public override void Fix()
Expand All @@ -37,47 +31,53 @@ public override void Fix()
throw new InvalidOperationException(string.Format(InspectionsUI.InvalidContextTypeInspectionFix, Context.GetType(), GetType()));
}

var functionName = Context is VBAParser.FunctionStmtContext
? ((VBAParser.FunctionStmtContext) Context).functionName()
: ((VBAParser.PropertyGetStmtContext) Context).functionName();

VBAParser.FunctionNameContext functionName = null;
if (Context is VBAParser.FunctionStmtContext)
{
functionName = ((VBAParser.FunctionStmtContext)Context).functionName();
}
else
{
functionName = ((VBAParser.PropertyGetStmtContext)Context).functionName();
}

string token = functionContext != null
var token = functionContext != null
? Tokens.Function
: Tokens.Property + ' ' + Tokens.Get;
string endToken = token == Tokens.Function
var endToken = token == Tokens.Function
? token
: Tokens.Property;

string visibility = context.visibility() == null ? string.Empty : context.visibility().GetText() + ' ';
string name = ' ' + Identifier.GetName(functionName.identifier());
bool hasTypeHint = Identifier.GetTypeHintValue(functionName.identifier()) != null;
var name = ' ' + Identifier.GetName(functionName.identifier());
var hasTypeHint = Identifier.GetTypeHintValue(functionName.identifier()) != null;

string args = context.argList().GetText();
string asType = context.asTypeClause() == null ? string.Empty : ' ' + context.asTypeClause().GetText();

string oldSignature = visibility + token + name + (hasTypeHint ? Identifier.GetTypeHintValue(functionName.identifier()) : string.Empty) + args + asType;
string newSignature = visibility + Tokens.Sub + name + args;
var oldSignature = visibility + token + name + (hasTypeHint ? Identifier.GetTypeHintValue(functionName.identifier()) : string.Empty) + args + asType;
var newSignature = visibility + Tokens.Sub + name + args;

string procedure = Context.GetText();
string noReturnStatements = procedure;
_returnStatements.ToList().ForEach(returnStatement =>
var procedure = Context.GetText();
var noReturnStatements = procedure;

GetReturnStatements(_target).ToList().ForEach(returnStatement =>
noReturnStatements = Regex.Replace(noReturnStatements, @"[ \t\f]*" + returnStatement + @"[ \t\f]*\r?\n?", ""));
string result = noReturnStatements.Replace(oldSignature, newSignature)
var result = noReturnStatements.Replace(oldSignature, newSignature)
.Replace(Tokens.End + ' ' + endToken, Tokens.End + ' ' + Tokens.Sub)
.Replace(Tokens.Exit + ' ' + endToken, Tokens.Exit + ' ' + Tokens.Sub);

CodeModule module = Selection.QualifiedName.Component.CodeModule;
Selection selection = Context.GetSelection();
var module = Selection.QualifiedName.Component.CodeModule;
var selection = Context.GetSelection();

module.DeleteLines(selection.StartLine, selection.LineCount);
module.InsertLines(selection.StartLine, result);
}

private IEnumerable<string> GetReturnStatements(Declaration declaration)
{
return declaration.References
.Where(usage => IsReturnStatement(declaration, usage))
.Select(usage => usage.Context.Parent.GetText());
}

private bool IsReturnStatement(Declaration declaration, IdentifierReference assignment)
{
return assignment.ParentScoping.Equals(declaration) && assignment.Declaration.Equals(declaration);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@

namespace Rubberduck.Inspections
{
using SmartIndenter;

public sealed class EncapsulatePublicFieldInspection : InspectionBase
{
public EncapsulatePublicFieldInspection(RubberduckParserState state)
private readonly IIndenter _indenter;

public EncapsulatePublicFieldInspection(RubberduckParserState state, IIndenter indenter)
: base(state, CodeInspectionSeverity.Suggestion)
{
_indenter = indenter;
}

public override string Meta { get { return InspectionsUI.EncapsulatePublicFieldInspectionMeta; } }
Expand All @@ -21,7 +26,7 @@ public override IEnumerable<InspectionResultBase> GetInspectionResults()
var issues = UserDeclarations
.Where(declaration => declaration.DeclarationType == DeclarationType.Variable
&& declaration.Accessibility == Accessibility.Public)
.Select(issue => new EncapsulatePublicFieldInspectionResult(this, issue, State))
.Select(issue => new EncapsulatePublicFieldInspectionResult(this, issue, State, _indenter))
.ToList();

return issues;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@

namespace Rubberduck.Inspections
{
using SmartIndenter;

public class EncapsulatePublicFieldInspectionResult : InspectionResultBase
{
private readonly IEnumerable<CodeInspectionQuickFix> _quickFixes;

public EncapsulatePublicFieldInspectionResult(IInspection inspection, Declaration target, RubberduckParserState state)
public EncapsulatePublicFieldInspectionResult(IInspection inspection, Declaration target, RubberduckParserState state, IIndenter indenter)
: base(inspection, target)
{
_quickFixes = new CodeInspectionQuickFix[]
{
new EncapsulateFieldQuickFix(target.Context, target.QualifiedSelection, target, state),
new EncapsulateFieldQuickFix(target.Context, target.QualifiedSelection, target, state, indenter),
new IgnoreOnceQuickFix(Context, QualifiedSelection, Inspection.AnnotationName)
};
}
Expand All @@ -38,22 +40,24 @@ public class EncapsulateFieldQuickFix : CodeInspectionQuickFix
{
private readonly Declaration _target;
private readonly RubberduckParserState _state;
private readonly IIndenter _indenter;

public EncapsulateFieldQuickFix(ParserRuleContext context, QualifiedSelection selection, Declaration target, RubberduckParserState state)
public EncapsulateFieldQuickFix(ParserRuleContext context, QualifiedSelection selection, Declaration target, RubberduckParserState state, IIndenter indenter)
: base(context, selection, string.Format(InspectionsUI.EncapsulatePublicFieldInspectionQuickFix, target.IdentifierName))
{
_target = target;
_state = state;
_indenter = indenter;
}

public override void Fix()
{
var vbe = Selection.QualifiedName.Project.VBE;

using (var view = new EncapsulateFieldDialog())
using (var view = new EncapsulateFieldDialog(_state, _indenter))
{
var factory = new EncapsulateFieldPresenterFactory(vbe, _state, view);
var refactoring = new EncapsulateFieldRefactoring(vbe, factory);
var refactoring = new EncapsulateFieldRefactoring(vbe, _indenter, factory);
refactoring.Refactor(_target);
IsCancelled = view.DialogResult != DialogResult.OK;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,10 @@ private IEnumerable<FunctionReturnValueNotUsedInspectionResult> GetInterfaceMemb
implementationMember =>
Tuple.Create(implementationMember.Context,
new QualifiedSelection(implementationMember.QualifiedName.QualifiedModuleName,
implementationMember.Selection), GetReturnStatements(implementationMember)))
implementationMember.Selection), implementationMember))
select
new FunctionReturnValueNotUsedInspectionResult(this, interfaceMember.Context,
interfaceMember.QualifiedName, GetReturnStatements(interfaceMember),
implementationMemberIssues, interfaceMember);
interfaceMember.QualifiedName, implementationMemberIssues, interfaceMember);
}

private IEnumerable<FunctionReturnValueNotUsedInspectionResult> GetNonInterfaceIssues(IEnumerable<Declaration> nonInterfaceFunctions)
Expand All @@ -62,18 +61,10 @@ private IEnumerable<FunctionReturnValueNotUsedInspectionResult> GetNonInterfaceI
this,
function.Context,
function.QualifiedName,
GetReturnStatements(function),
function));
return nonInterfaceIssues;
}

private IEnumerable<string> GetReturnStatements(Declaration function)
{
return function.References
.Where(usage => IsReturnStatement(function, usage))
.Select(usage => usage.Context.Parent.Parent.Parent.GetText());
}

private bool IsReturnValueUsed(Declaration function)
{
foreach (var usage in function.References)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,20 @@ public FunctionReturnValueNotUsedInspectionResult(
IInspection inspection,
ParserRuleContext context,
QualifiedMemberName qualifiedName,
IEnumerable<string> returnStatements,
Declaration target)
: this(inspection, context, qualifiedName, returnStatements, new List<Tuple<ParserRuleContext, QualifiedSelection, IEnumerable<string>>>(), target)
: this(inspection, context, qualifiedName, new List<Tuple<ParserRuleContext, QualifiedSelection, Declaration>>(), target)
{
}

public FunctionReturnValueNotUsedInspectionResult(
IInspection inspection,
ParserRuleContext context,
QualifiedMemberName qualifiedName,
IEnumerable<string> returnStatements,
IEnumerable<Tuple<ParserRuleContext, QualifiedSelection, IEnumerable<string>>> children,
IEnumerable<Tuple<ParserRuleContext, QualifiedSelection, Declaration>> children,
Declaration target)
: base(inspection, qualifiedName.QualifiedModuleName, context, target)
{
var root = new ConvertToProcedureQuickFix(context, QualifiedSelection, returnStatements);
var root = new ConvertToProcedureQuickFix(context, QualifiedSelection, target);
var compositeFix = new CompositeCodeInspectionFix(root);
children.ToList().ForEach(child => compositeFix.AddChild(new ConvertToProcedureQuickFix(child.Item1, child.Item2, child.Item3)));
_quickFixes = new CodeInspectionQuickFix[]
Expand Down
2 changes: 1 addition & 1 deletion RetailCoder.VBE/Inspections/IInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Rubberduck.Inspections
{
public interface IInspector
public interface IInspector : IDisposable
{
Task<IEnumerable<ICodeInspectionResult>> FindIssuesAsync(RubberduckParserState state, CancellationToken token);
}
Expand Down
2 changes: 1 addition & 1 deletion RetailCoder.VBE/Inspections/IParseTreeInspection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ public ParseTreeResults()
public IEnumerable<QualifiedContext> ObsoleteLetContexts;
public IEnumerable<QualifiedContext> ArgListsWithOneByRefParam;
public IEnumerable<QualifiedContext> EmptyStringLiterals;
public IEnumerable<QualifiedContext<VBAParser.AnnotationContext>> MalformedAnnotations;
public IEnumerable<QualifiedContext> MalformedAnnotations;
}
}
12 changes: 11 additions & 1 deletion RetailCoder.VBE/Inspections/InspectionsUI.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion RetailCoder.VBE/Inspections/InspectionsUI.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@
<value>Variable wird genutzt ohne das ihr ein Wert zugewiesen wurde.</value>
</data>
<data name="UntypedFunctionUsageInspectionMeta" xml:space="preserve">
<value>Eine gibt eine Funktion, die einen String Äquivalnet zurückgibt. Diese sollte bevorzugt genutzt werden, um implitizite Typumwandlungen zu vermeiden.</value>
<value>Eine gibt eine Funktion, die einen String Äquivalent zurückgibt. Diese sollte bevorzugt genutzt werden, um implitizite Typumwandlungen zu vermeiden.
Falls der Parameter 'null' sein kann, bitte dieses Auftreten ignorieren. 'null' an die Funktion zu übergeben, die einen String erwartet würde zu einem "Type Mismatch"-Laufzeitfehler führen.</value>
</data>
<data name="UntypedFunctionUsageInspectionName" xml:space="preserve">
<value>Nutzung einer Funktion, die einen 'String Variant' zurückgibt.</value>
Expand Down Expand Up @@ -554,4 +555,13 @@
<data name="MultipleDeclarationsInspectionResultFormat" xml:space="preserve">
<value>Instruktion enthält Mehrfachdeklaration</value>
</data>
<data name="MalformedAnnotationInspectionName">
<value>Unlesbare Annotation</value>
</data>
<data name="MalformedAnnotationInspectionResultFormat">
<value>Annotation '{0}' ist nicht lesbar</value>
</data>
<data name="MalformedAnnotationInspectionMeta">
<value>Eine Annotation in einem Kommentar konnte nicht gelesen werden.</value>
</data>
</root>
Loading