summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Framework/ModLoading/IInstructionRewriter.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/StardewModdingAPI/Framework/ModLoading/IInstructionRewriter.cs')
-rw-r--r--src/StardewModdingAPI/Framework/ModLoading/IInstructionRewriter.cs32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/StardewModdingAPI/Framework/ModLoading/IInstructionRewriter.cs b/src/StardewModdingAPI/Framework/ModLoading/IInstructionRewriter.cs
index ce12c717..be2e10ee 100644
--- a/src/StardewModdingAPI/Framework/ModLoading/IInstructionRewriter.cs
+++ b/src/StardewModdingAPI/Framework/ModLoading/IInstructionRewriter.cs
@@ -3,38 +3,34 @@ using Mono.Cecil.Cil;
namespace StardewModdingAPI.Framework.ModLoading
{
- /// <summary>Rewrites CIL instructions for compatibility.</summary>
- internal interface IInstructionRewriter
+ /// <summary>Performs predefined logic for detected CIL instructions.</summary>
+ internal interface IInstructionHandler
{
/*********
** Accessors
*********/
- /// <summary>A brief noun phrase indicating what the rewriter matches.</summary>
+ /// <summary>A brief noun phrase indicating what the handler matches.</summary>
string NounPhrase { get; }
/*********
** Methods
*********/
- /// <summary>Rewrite a method definition for compatibility.</summary>
- /// <param name="mod">The mod to which the module belongs.</param>
- /// <param name="module">The module being rewritten.</param>
- /// <param name="method">The method definition to rewrite.</param>
+ /// <summary>Perform the predefined logic for a method if applicable.</summary>
+ /// <param name="mod">The mod containing the instruction.</param>
+ /// <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>
- /// <returns>Returns whether the instruction was rewritten.</returns>
- /// <exception cref="IncompatibleInstructionException">The CIL instruction is not compatible, and can't be rewritten.</exception>
- bool Rewrite(IModMetadata mod, ModuleDefinition module, MethodDefinition method, PlatformAssemblyMap assemblyMap, bool platformChanged);
+ InstructionHandleResult Handle(IModMetadata mod, ModuleDefinition module, MethodDefinition method, PlatformAssemblyMap assemblyMap, bool platformChanged);
- /// <summary>Rewrite a CIL instruction for compatibility.</summary>
- /// <param name="mod">The mod to which the module belongs.</param>
- /// <param name="module">The module being rewritten.</param>
- /// <param name="cil">The CIL rewriter.</param>
- /// <param name="instruction">The instruction to rewrite.</param>
+ /// <summary>Perform the predefined logic for an instruction if applicable.</summary>
+ /// <param name="mod">The mod containing the instruction.</param>
+ /// <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="assemblyMap">Metadata for mapping assemblies to the current platform.</param>
/// <param name="platformChanged">Whether the mod was compiled on a different platform.</param>
- /// <returns>Returns whether the instruction was rewritten.</returns>
- /// <exception cref="IncompatibleInstructionException">The CIL instruction is not compatible, and can't be rewritten.</exception>
- bool Rewrite(IModMetadata mod, ModuleDefinition module, ILProcessor cil, Instruction instruction, PlatformAssemblyMap assemblyMap, bool platformChanged);
+ InstructionHandleResult Handle(IModMetadata mod, ModuleDefinition module, ILProcessor cil, Instruction instruction, PlatformAssemblyMap assemblyMap, bool platformChanged);
}
}