diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-08-04 16:32:46 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-08-04 16:32:46 -0400 |
commit | a0f7a244740de91fc5104f9f33b844493cd4a3a8 (patch) | |
tree | 1cb59acd8433d4c8537787d0c623854d081d5194 /src/SMAPI | |
parent | 433261e7d57096bec41ae6eea16f5f18b8045be8 (diff) | |
download | SMAPI-a0f7a244740de91fc5104f9f33b844493cd4a3a8.tar.gz SMAPI-a0f7a244740de91fc5104f9f33b844493cd4a3a8.tar.bz2 SMAPI-a0f7a244740de91fc5104f9f33b844493cd4a3a8.zip |
fixed false compat error when constructing multidimensional arrays
Diffstat (limited to 'src/SMAPI')
-rw-r--r-- | src/SMAPI/Framework/ModLoading/Finders/ReferenceToMemberWithUnexpectedTypeFinder.cs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/SMAPI/Framework/ModLoading/Finders/ReferenceToMemberWithUnexpectedTypeFinder.cs b/src/SMAPI/Framework/ModLoading/Finders/ReferenceToMemberWithUnexpectedTypeFinder.cs index cf5a3175..3a26660f 100644 --- a/src/SMAPI/Framework/ModLoading/Finders/ReferenceToMemberWithUnexpectedTypeFinder.cs +++ b/src/SMAPI/Framework/ModLoading/Finders/ReferenceToMemberWithUnexpectedTypeFinder.cs @@ -70,7 +70,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders // method reference MethodReference methodReference = RewriteHelper.AsMethodReference(instruction); - if (methodReference != null && this.ShouldValidate(methodReference.DeclaringType)) + if (methodReference != null && !this.IsUnsupported(methodReference) && this.ShouldValidate(methodReference.DeclaringType)) { // get potential targets MethodDefinition[] candidateMethods = methodReference.DeclaringType.Resolve()?.Methods.Where(found => found.Name == methodReference.Name).ToArray(); @@ -106,6 +106,14 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders return type != null && this.ValidateReferencesToAssemblies.Contains(type.Scope.Name); } + /// <summary>Get whether a method reference is a special case that's not currently supported (e.g. array methods).</summary> + /// <param name="method">The method reference.</param> + private bool IsUnsupported(MethodReference method) + { + return + method.DeclaringType.Name.Contains("["); // array methods + } + /// <summary>Get a shorter type name for display.</summary> /// <param name="type">The type reference.</param> private string GetFriendlyTypeName(TypeReference type) |