rename new heuristic rewriters for clarity

This commit is contained in:
Jesse Plamondon-Willard 2020-08-26 22:14:25 -04:00
parent 16161a214f
commit d3c5fe0764
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
3 changed files with 9 additions and 9 deletions

View File

@ -6,8 +6,8 @@ using StardewModdingAPI.Framework.ModLoading.Framework;
namespace StardewModdingAPI.Framework.ModLoading.Rewriters namespace StardewModdingAPI.Framework.ModLoading.Rewriters
{ {
/// <summary>Rewrites references to fields which no longer exist, but which have an equivalent property with the exact same name.</summary> /// <summary>Automatically fix references to fields that have been replaced by a property.</summary>
internal class FieldToPropertyRewriter : BaseInstructionHandler internal class HeuristicFieldRewriter : BaseInstructionHandler
{ {
/********* /*********
** Fields ** Fields
@ -21,7 +21,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
*********/ *********/
/// <summary>Construct an instance.</summary> /// <summary>Construct an instance.</summary>
/// <param name="rewriteReferencesToAssemblies">The assembly names to which to rewrite broken references.</param> /// <param name="rewriteReferencesToAssemblies">The assembly names to which to rewrite broken references.</param>
public FieldToPropertyRewriter(string[] rewriteReferencesToAssemblies) public HeuristicFieldRewriter(string[] rewriteReferencesToAssemblies)
: base(defaultPhrase: "field changed to property") // ignored since we specify phrases : base(defaultPhrase: "field changed to property") // ignored since we specify phrases
{ {
this.RewriteReferencesToAssemblies = new HashSet<string>(rewriteReferencesToAssemblies); this.RewriteReferencesToAssemblies = new HashSet<string>(rewriteReferencesToAssemblies);

View File

@ -6,8 +6,8 @@ using StardewModdingAPI.Framework.ModLoading.Framework;
namespace StardewModdingAPI.Framework.ModLoading.Rewriters namespace StardewModdingAPI.Framework.ModLoading.Rewriters
{ {
/// <summary>Rewrites references to methods which only broke because the definition has new optional parameters.</summary> /// <summary>Automatically fix references to methods that had extra optional parameters added.</summary>
internal class MethodWithMissingOptionalParameterRewriter : BaseInstructionHandler internal class HeuristicMethodRewriter : BaseInstructionHandler
{ {
/********* /*********
** Fields ** Fields
@ -21,7 +21,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
*********/ *********/
/// <summary>Construct an instance.</summary> /// <summary>Construct an instance.</summary>
/// <param name="rewriteReferencesToAssemblies">The assembly names to which to rewrite broken references.</param> /// <param name="rewriteReferencesToAssemblies">The assembly names to which to rewrite broken references.</param>
public MethodWithMissingOptionalParameterRewriter(string[] rewriteReferencesToAssemblies) public HeuristicMethodRewriter(string[] rewriteReferencesToAssemblies)
: base(defaultPhrase: "methods with missing parameters") // ignored since we specify phrases : base(defaultPhrase: "methods with missing parameters") // ignored since we specify phrases
{ {
this.RewriteReferencesToAssemblies = new HashSet<string>(rewriteReferencesToAssemblies); this.RewriteReferencesToAssemblies = new HashSet<string>(rewriteReferencesToAssemblies);

View File

@ -38,9 +38,9 @@ namespace StardewModdingAPI.Metadata
// rewrite for Stardew Valley 1.3 // rewrite for Stardew Valley 1.3
yield return new StaticFieldToConstantRewriter<int>(typeof(Game1), "tileSize", Game1.tileSize); yield return new StaticFieldToConstantRewriter<int>(typeof(Game1), "tileSize", Game1.tileSize);
// generic rewrites // heuristic rewrites
yield return new FieldToPropertyRewriter(this.ValidateReferencesToAssemblies); yield return new HeuristicFieldRewriter(this.ValidateReferencesToAssemblies);
yield return new MethodWithMissingOptionalParameterRewriter(this.ValidateReferencesToAssemblies); yield return new HeuristicMethodRewriter(this.ValidateReferencesToAssemblies);
#if HARMONY_2 #if HARMONY_2
// rewrite for SMAPI 3.6 (Harmony 1.x => 2.0 update) // rewrite for SMAPI 3.6 (Harmony 1.x => 2.0 update)