summaryrefslogtreecommitdiff
path: root/src/SMAPI.ModBuildConfig.Analyzer/NetFieldAnalyzer.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2018-04-09 23:43:13 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2018-04-09 23:43:13 -0400
commit971ed1a17559064ee0ee42a83e786b3e3076059f (patch)
treeb8665f8289ccfc2ef0667d87d22f8849c7f167f1 /src/SMAPI.ModBuildConfig.Analyzer/NetFieldAnalyzer.cs
parentc8db771e11a0e5224aa3b0766134afc8e733896e (diff)
downloadSMAPI-971ed1a17559064ee0ee42a83e786b3e3076059f.tar.gz
SMAPI-971ed1a17559064ee0ee42a83e786b3e3076059f.tar.bz2
SMAPI-971ed1a17559064ee0ee42a83e786b3e3076059f.zip
fix net field replacements not reported for a subclass reference (#471)
Diffstat (limited to 'src/SMAPI.ModBuildConfig.Analyzer/NetFieldAnalyzer.cs')
-rw-r--r--src/SMAPI.ModBuildConfig.Analyzer/NetFieldAnalyzer.cs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/SMAPI.ModBuildConfig.Analyzer/NetFieldAnalyzer.cs b/src/SMAPI.ModBuildConfig.Analyzer/NetFieldAnalyzer.cs
index a9987733..2cb1ac4c 100644
--- a/src/SMAPI.ModBuildConfig.Analyzer/NetFieldAnalyzer.cs
+++ b/src/SMAPI.ModBuildConfig.Analyzer/NetFieldAnalyzer.cs
@@ -209,9 +209,13 @@ namespace StardewModdingAPI.ModBuildConfig.Analyzer
string propertyName = node.Name.Identifier.Text;
// suggest replacement
- if (this.NetFieldWrapperProperties.TryGetValue($"{declaringType}::{propertyName}", out string suggestedPropertyName))
+ for (ITypeSymbol type = declaringType; type != null; type = type.BaseType)
{
- context.ReportDiagnostic(Diagnostic.Create(this.Rules["SMAPI002"], context.Node.GetLocation(), node, memberType.Type.Name, suggestedPropertyName));
+ if (this.NetFieldWrapperProperties.TryGetValue($"{type}::{propertyName}", out string suggestedPropertyName))
+ {
+ context.ReportDiagnostic(Diagnostic.Create(this.Rules["SMAPI002"], context.Node.GetLocation(), node, memberType.Type.Name, suggestedPropertyName));
+ break;
+ }
}
}
catch (Exception ex)