use inheritdoc in rewriters

This commit is contained in:
Jesse Plamondon-Willard 2020-08-25 22:59:08 -04:00
parent abfe40bf69
commit ec4b81819a
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
16 changed files with 21 additions and 106 deletions

View File

@ -36,12 +36,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders
this.Result = result;
}
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
/// <param name="module">The assembly module containing the instruction.</param>
/// <param name="cil">The CIL processor.</param>
/// <param name="instruction">The CIL instruction to handle.</param>
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
/// <returns>Returns whether the instruction was changed.</returns>
/// <inheritdoc />
public override bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
{
if (!this.Flags.Contains(this.Result) && this.IsMatch(instruction))

View File

@ -36,12 +36,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders
this.Result = result;
}
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
/// <param name="module">The assembly module containing the instruction.</param>
/// <param name="cil">The CIL processor.</param>
/// <param name="instruction">The CIL instruction to handle.</param>
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
/// <returns>Returns whether the instruction was changed.</returns>
/// <inheritdoc />
public override bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
{
if (!this.Flags.Contains(this.Result) && RewriteHelper.IsFieldReferenceTo(instruction, this.FullTypeName, this.FieldName))

View File

@ -36,12 +36,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders
this.Result = result;
}
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
/// <param name="module">The assembly module containing the instruction.</param>
/// <param name="cil">The CIL processor.</param>
/// <param name="instruction">The CIL instruction to handle.</param>
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
/// <returns>Returns whether the instruction was changed.</returns>
/// <inheritdoc />
public override bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
{
if (!this.Flags.Contains(this.Result) && this.IsMatch(instruction))

View File

@ -36,12 +36,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders
this.Result = result;
}
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
/// <param name="module">The assembly module containing the instruction.</param>
/// <param name="cil">The CIL processor.</param>
/// <param name="instruction">The CIL instruction to handle.</param>
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
/// <returns>Returns whether the instruction was changed.</returns>
/// <inheritdoc />
public override bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
{
if (!this.Flags.Contains(this.Result) && this.IsMatch(instruction))

View File

@ -29,12 +29,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders
this.ValidateReferencesToAssemblies = new HashSet<string>(validateReferencesToAssemblies);
}
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
/// <param name="module">The assembly module containing the instruction.</param>
/// <param name="cil">The CIL processor.</param>
/// <param name="instruction">The CIL instruction to handle.</param>
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
/// <returns>Returns whether the instruction was changed.</returns>
/// <inheritdoc />
public override bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
{
// field reference

View File

@ -29,12 +29,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders
this.ValidateReferencesToAssemblies = new HashSet<string>(validateReferencesToAssemblies);
}
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
/// <param name="module">The assembly module containing the instruction.</param>
/// <param name="cil">The CIL processor.</param>
/// <param name="instruction">The CIL instruction to handle.</param>
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
/// <returns>Returns whether the instruction was changed.</returns>
/// <inheritdoc />
public override bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
{
// field reference

View File

@ -35,11 +35,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders
this.ShouldIgnore = shouldIgnore;
}
/// <summary>Rewrite a type reference if needed.</summary>
/// <param name="module">The assembly module containing the instruction.</param>
/// <param name="type">The type definition to handle.</param>
/// <param name="replaceWith">Replaces the type reference with a new one.</param>
/// <returns>Returns whether the type was changed.</returns>
/// <inheritdoc />
public override bool Handle(ModuleDefinition module, TypeReference type, Action<TypeReference> replaceWith)
{
if (type.Scope.Name == this.AssemblyName && this.ShouldIgnore?.Invoke(type) != true)

View File

@ -35,11 +35,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders
this.ShouldIgnore = shouldIgnore;
}
/// <summary>Rewrite a type reference if needed.</summary>
/// <param name="module">The assembly module containing the instruction.</param>
/// <param name="type">The type definition to handle.</param>
/// <param name="replaceWith">Replaces the type reference with a new one.</param>
/// <returns>Returns whether the type was changed.</returns>
/// <inheritdoc />
public override bool Handle(ModuleDefinition module, TypeReference type, Action<TypeReference> replaceWith)
{
if (type.FullName == this.FullTypeName && this.ShouldIgnore?.Invoke(type) != true)

View File

@ -11,35 +11,26 @@ namespace StardewModdingAPI.Framework.ModLoading.Framework
/*********
** Accessors
*********/
/// <summary>A brief noun phrase indicating what the handler matches, used if <see cref="Phrases"/> is empty.</summary>
/// <inheritdoc />
public string DefaultPhrase { get; }
/// <summary>The rewrite flags raised for the current module.</summary>
/// <inheritdoc />
public ISet<InstructionHandleResult> Flags { get; } = new HashSet<InstructionHandleResult>();
/// <summary>The brief noun phrases indicating what the handler matched for the current module.</summary>
/// <inheritdoc />
public ISet<string> Phrases { get; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
/*********
** Public methods
*********/
/// <summary>Rewrite a type reference if needed.</summary>
/// <param name="module">The assembly module containing the instruction.</param>
/// <param name="type">The type definition to handle.</param>
/// <param name="replaceWith">Replaces the type reference with a new one.</param>
/// <returns>Returns whether the type was changed.</returns>
/// <inheritdoc />
public virtual bool Handle(ModuleDefinition module, TypeReference type, Action<TypeReference> replaceWith)
{
return false;
}
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
/// <param name="module">The assembly module containing the instruction.</param>
/// <param name="cil">The CIL processor.</param>
/// <param name="instruction">The CIL instruction to handle.</param>
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
/// <returns>Returns whether the instruction was changed.</returns>
/// <inheritdoc />
public virtual bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
{
return false;

View File

@ -49,12 +49,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
{
}
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
/// <param name="module">The assembly module containing the instruction.</param>
/// <param name="cil">The CIL processor.</param>
/// <param name="instruction">The CIL instruction to handle.</param>
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
/// <returns>Returns whether the instruction was changed.</returns>
/// <inheritdoc />
public override bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
{
// get field reference

View File

@ -28,12 +28,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
this.RewriteReferencesToAssemblies = new HashSet<string>(rewriteReferencesToAssemblies);
}
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
/// <param name="module">The assembly module containing the instruction.</param>
/// <param name="cil">The CIL processor.</param>
/// <param name="instruction">The CIL instruction to handle.</param>
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
/// <returns>Returns whether the instruction was changed.</returns>
/// <inheritdoc />
public override bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
{
// get field ref

View File

@ -25,11 +25,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
public Harmony1AssemblyRewriter()
: base(defaultPhrase: "Harmony 1.x") { }
/// <summary>Rewrite a type reference if needed.</summary>
/// <param name="module">The assembly module containing the instruction.</param>
/// <param name="type">The type definition to handle.</param>
/// <param name="replaceWith">Replaces the type reference with a new one.</param>
/// <returns>Returns whether the type was changed.</returns>
/// <inheritdoc />
public override bool Handle(ModuleDefinition module, TypeReference type, Action<TypeReference> replaceWith)
{
// rewrite Harmony 1.x type to Harmony 2.0 type
@ -45,12 +41,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
return false;
}
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
/// <param name="module">The assembly module containing the instruction.</param>
/// <param name="cil">The CIL processor.</param>
/// <param name="instruction">The CIL instruction to handle.</param>
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
/// <returns>Returns whether the instruction was changed.</returns>
/// <inheritdoc />
public override bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
{
// rewrite Harmony 1.x methods to Harmony 2.0

View File

@ -40,12 +40,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
public MethodParentRewriter(Type fromType, Type toType, string nounPhrase = null)
: this(fromType.FullName, toType, nounPhrase) { }
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
/// <param name="module">The assembly module containing the instruction.</param>
/// <param name="cil">The CIL processor.</param>
/// <param name="instruction">The CIL instruction to handle.</param>
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
/// <returns>Returns whether the instruction was changed.</returns>
/// <inheritdoc />
public override bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
{
// get method ref

View File

@ -28,12 +28,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
this.RewriteReferencesToAssemblies = new HashSet<string>(rewriteReferencesToAssemblies);
}
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
/// <param name="module">The assembly module containing the instruction.</param>
/// <param name="cil">The CIL processor.</param>
/// <param name="instruction">The CIL instruction to handle.</param>
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
/// <returns>Returns whether the instruction was changed.</returns>
/// <inheritdoc />
public override bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
{
// get method ref

View File

@ -37,12 +37,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
this.Value = value;
}
/// <summary>Rewrite a CIL instruction reference if needed.</summary>
/// <param name="module">The assembly module containing the instruction.</param>
/// <param name="cil">The CIL processor.</param>
/// <param name="instruction">The CIL instruction to handle.</param>
/// <param name="replaceWith">Replaces the CIL instruction with a new one.</param>
/// <returns>Returns whether the instruction was changed.</returns>
/// <inheritdoc />
public override bool Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, Action<Instruction> replaceWith)
{
// get field reference

View File

@ -35,11 +35,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
this.ShouldIgnore = shouldIgnore;
}
/// <summary>Rewrite a type reference if needed.</summary>
/// <param name="module">The assembly module containing the instruction.</param>
/// <param name="type">The type definition to handle.</param>
/// <param name="replaceWith">Replaces the type reference with a new one.</param>
/// <returns>Returns whether the type was changed.</returns>
/// <inheritdoc />
public override bool Handle(ModuleDefinition module, TypeReference type, Action<TypeReference> replaceWith)
{
// check type reference