mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
weaver: making GenerateWriter return MethodReference (#2479)
This commit is contained in:
parent
968f239345
commit
7d75ad3cf0
@ -27,13 +27,15 @@ public static void Register(TypeReference dataType, MethodReference methodRefere
|
||||
writeFuncs[typeName] = methodReference;
|
||||
}
|
||||
|
||||
static void RegisterWriteFunc(string name, MethodDefinition newWriterFunc)
|
||||
static void RegisterWriteFunc(string name, MethodReference newWriterFunc)
|
||||
{
|
||||
writeFuncs[name] = newWriterFunc;
|
||||
Weaver.WeaveLists.generatedWriteFunctions.Add(newWriterFunc);
|
||||
MethodDefinition resolved = newWriterFunc.Resolve();
|
||||
|
||||
writeFuncs[name] = resolved;
|
||||
Weaver.WeaveLists.generatedWriteFunctions.Add(resolved);
|
||||
|
||||
Weaver.ConfirmGeneratedCodeClass();
|
||||
Weaver.WeaveLists.generateContainerClass.Methods.Add(newWriterFunc);
|
||||
Weaver.WeaveLists.generateContainerClass.Methods.Add(resolved);
|
||||
}
|
||||
|
||||
public static MethodReference GetWriteFunc(TypeReference variable, int recursionCount = 0)
|
||||
@ -49,7 +51,7 @@ public static MethodReference GetWriteFunc(TypeReference variable, int recursion
|
||||
}
|
||||
else
|
||||
{
|
||||
MethodDefinition newWriterFunc = GenerateWriter(variable, recursionCount);
|
||||
MethodReference newWriterFunc = GenerateWriter(variable, recursionCount);
|
||||
if (newWriterFunc != null)
|
||||
{
|
||||
RegisterWriteFunc(variable.FullName, newWriterFunc);
|
||||
@ -58,7 +60,7 @@ public static MethodReference GetWriteFunc(TypeReference variable, int recursion
|
||||
}
|
||||
}
|
||||
|
||||
static MethodDefinition GenerateWriter(TypeReference variableReference, int recursionCount = 0)
|
||||
static MethodReference GenerateWriter(TypeReference variableReference, int recursionCount = 0)
|
||||
{
|
||||
// TODO: do we need this check? do we ever receieve types that are "ByReference"s
|
||||
if (variableReference.IsByReference)
|
||||
|
Loading…
Reference in New Issue
Block a user