Skip to content

Commit

Permalink
style: fixing typos
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Frowen committed Nov 5, 2023
1 parent 28d0447 commit db790db
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Assets/Mirage/Weaver/SerializeFunctionBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ private static void Log(string msg)
}

protected readonly Dictionary<TypeReference, MethodReference> funcs = new Dictionary<TypeReference, MethodReference>(new TypeReferenceComparer());
protected readonly Dictionary<TypeDefinition, MethodReference> collectionMethod = new Dictionary<TypeDefinition, MethodReference>();
protected readonly Dictionary<TypeDefinition, MethodReference> collectionMethods = new Dictionary<TypeDefinition, MethodReference>();
private readonly IWeaverLogger logger;
protected readonly ModuleDefinition module;

Expand Down Expand Up @@ -59,17 +59,17 @@ public void Register(TypeReference dataType, MethodReference methodReference)

public void RegisterCollectionMethod(TypeDefinition dataType, MethodReference methodReference)
{
if (collectionMethod.ContainsKey(dataType))
if (collectionMethods.ContainsKey(dataType))
{
logger.Warning(
$"Registering a {FunctionTypeLog} for {dataType.FullName} when one already exists\n" +
$" old:{collectionMethod[dataType].FullName}\n" +
$" old:{collectionMethods[dataType].FullName}\n" +
$" new:{methodReference.FullName}",
methodReference.Resolve());
}

Log($"Register Collection Method {FunctionTypeLog} for {dataType.FullName}, method:{methodReference.FullName}");
collectionMethod[dataType] = methodReference;
collectionMethods[dataType] = methodReference;
}

/// <summary>
Expand Down Expand Up @@ -170,13 +170,12 @@ private MethodReference GenerateFunction(TypeReference typeReference)
var typeDefinition = typeReference.Resolve();

// check for collections
var isCollection = collectionMethod.TryGetValue(typeDefinition, out var collectionMethohd);
if (isCollection)
if (collectionMethods.TryGetValue(typeDefinition, out var collectionMethod))
{
var genericInstance = (GenericInstanceType)typeReference;
var elementType = genericInstance.GenericArguments[0];

return GenerateCollectionFunction(typeReference, elementType, collectionMethohd);
return GenerateCollectionFunction(typeReference, elementType, collectionMethod);
}

// check for invalid types
Expand Down

0 comments on commit db790db

Please sign in to comment.