summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/ModLoading/Finders/ReferenceToMissingMemberFinder.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-05-06 00:02:10 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-05-06 00:02:10 -0400
commitf16e477fc22bf76c33d8860acda090a199a0dcdb (patch)
treecfd1c0701869b7254b8122e9ab56a5652df729de /src/SMAPI/Framework/ModLoading/Finders/ReferenceToMissingMemberFinder.cs
parentcfc07c1ee58b113c4e2ec8d6de28a57397589068 (diff)
downloadSMAPI-f16e477fc22bf76c33d8860acda090a199a0dcdb.tar.gz
SMAPI-f16e477fc22bf76c33d8860acda090a199a0dcdb.tar.bz2
SMAPI-f16e477fc22bf76c33d8860acda090a199a0dcdb.zip
add base instruction handler (#711)
Diffstat (limited to 'src/SMAPI/Framework/ModLoading/Finders/ReferenceToMissingMemberFinder.cs')
-rw-r--r--src/SMAPI/Framework/ModLoading/Finders/ReferenceToMissingMemberFinder.cs25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/SMAPI/Framework/ModLoading/Finders/ReferenceToMissingMemberFinder.cs b/src/SMAPI/Framework/ModLoading/Finders/ReferenceToMissingMemberFinder.cs
index 44b531a5..fefa88f4 100644
--- a/src/SMAPI/Framework/ModLoading/Finders/ReferenceToMissingMemberFinder.cs
+++ b/src/SMAPI/Framework/ModLoading/Finders/ReferenceToMissingMemberFinder.cs
@@ -2,12 +2,13 @@ using System.Collections.Generic;
using System.Linq;
using Mono.Cecil;
using Mono.Cecil.Cil;
+using StardewModdingAPI.Framework.ModLoading.Framework;
namespace StardewModdingAPI.Framework.ModLoading.Finders
{
/// <summary>Finds references to a field, property, or method which no longer exists.</summary>
/// <remarks>This implementation is purely heuristic. It should never return a false positive, but won't detect all cases.</remarks>
- internal class ReferenceToMissingMemberFinder : IInstructionHandler
+ internal class ReferenceToMissingMemberFinder : BaseInstructionHandler
{
/*********
** Fields
@@ -17,39 +18,23 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders
/*********
- ** Accessors
- *********/
- /// <summary>A brief noun phrase indicating what the instruction finder matches.</summary>
- public string NounPhrase { get; private set; } = "";
-
-
- /*********
** Public methods
*********/
/// <summary>Construct an instance.</summary>
/// <param name="validateReferencesToAssemblies">The assembly names to which to heuristically detect broken references.</param>
public ReferenceToMissingMemberFinder(string[] validateReferencesToAssemblies)
+ : base(nounPhrase: "")
{
this.ValidateReferencesToAssemblies = new HashSet<string>(validateReferencesToAssemblies);
}
- /// <summary>Perform the predefined logic for a method if applicable.</summary>
- /// <param name="module">The assembly module containing the instruction.</param>
- /// <param name="method">The method definition containing the instruction.</param>
- /// <param name="assemblyMap">Metadata for mapping assemblies to the current platform.</param>
- /// <param name="platformChanged">Whether the mod was compiled on a different platform.</param>
- public virtual InstructionHandleResult Handle(ModuleDefinition module, MethodDefinition method, PlatformAssemblyMap assemblyMap, bool platformChanged)
- {
- return InstructionHandleResult.None;
- }
-
/// <summary>Perform the predefined logic for an instruction if applicable.</summary>
/// <param name="module">The assembly module containing the instruction.</param>
/// <param name="cil">The CIL processor.</param>
- /// <param name="instruction">The instruction to handle.</param>
+ /// <param name="instruction">The CIL instruction to handle.</param>
/// <param name="assemblyMap">Metadata for mapping assemblies to the current platform.</param>
/// <param name="platformChanged">Whether the mod was compiled on a different platform.</param>
- public virtual InstructionHandleResult Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, PlatformAssemblyMap assemblyMap, bool platformChanged)
+ public override InstructionHandleResult Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, PlatformAssemblyMap assemblyMap, bool platformChanged)
{
// field reference
FieldReference fieldRef = RewriteHelper.AsFieldReference(instruction);