mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
Writers: remove static Log references
This commit is contained in:
parent
20405c76f9
commit
7320cd8a2f
@ -21,7 +21,7 @@ public static bool Process(AssemblyDefinition CurrentAssembly, WeaverTypes weave
|
||||
// otherwise we would get
|
||||
// "System.ArgumentException: Member ... is declared in another module and needs to be imported"
|
||||
// errors when still using the previous module's reader/writer funcs.
|
||||
writers = new Writers(CurrentAssembly, weaverTypes);
|
||||
writers = new Writers(CurrentAssembly, weaverTypes, Log);
|
||||
readers = new Readers(CurrentAssembly, weaverTypes, Log);
|
||||
|
||||
foreach (Assembly unityAsm in CompilationPipeline.GetAssemblies())
|
||||
|
@ -13,16 +13,17 @@ public class Writers
|
||||
// can't be used from another assembly, otherwise we will get:
|
||||
// "System.ArgumentException: Member ... is declared in another module and needs to be imported"
|
||||
AssemblyDefinition assembly;
|
||||
|
||||
WeaverTypes weaverTypes;
|
||||
Logger Log;
|
||||
|
||||
Dictionary<TypeReference, MethodReference> writeFuncs =
|
||||
new Dictionary<TypeReference, MethodReference>(new TypeReferenceComparer());
|
||||
|
||||
public Writers(AssemblyDefinition assembly, WeaverTypes weaverTypes)
|
||||
public Writers(AssemblyDefinition assembly, WeaverTypes weaverTypes, Logger Log)
|
||||
{
|
||||
this.assembly = assembly;
|
||||
this.weaverTypes = weaverTypes;
|
||||
this.Log = Log;
|
||||
}
|
||||
|
||||
public void Register(TypeReference dataType, MethodReference methodReference)
|
||||
@ -64,7 +65,7 @@ public MethodReference GetWriteFunc(TypeReference variable)
|
||||
}
|
||||
catch (GenerateWriterException e)
|
||||
{
|
||||
Weaver.Log.Error(e.Message, e.MemberReference);
|
||||
Log.Error(e.Message, e.MemberReference);
|
||||
Weaver.WeavingFailed = true;
|
||||
return null;
|
||||
}
|
||||
@ -279,7 +280,7 @@ MethodDefinition GenerateCollectionWriter(TypeReference variable, TypeReference
|
||||
// need this null check till later PR when GetWriteFunc throws exception instead
|
||||
if (elementWriteFunc == null)
|
||||
{
|
||||
Weaver.Log.Error($"Cannot generate writer for {variable}. Use a supported type or provide a custom writer", variable);
|
||||
Log.Error($"Cannot generate writer for {variable}. Use a supported type or provide a custom writer", variable);
|
||||
Weaver.WeavingFailed = true;
|
||||
return writerFunc;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user