diff options
Diffstat (limited to 'src/MessagePack.GeneratorCore/Generator/ResolverTemplate.tt')
-rw-r--r-- | src/MessagePack.GeneratorCore/Generator/ResolverTemplate.tt | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.tt b/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.tt index e61688a1..1fcd9839 100644 --- a/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.tt +++ b/src/MessagePack.GeneratorCore/Generator/ResolverTemplate.tt @@ -12,16 +12,11 @@ #pragma warning disable 414 #pragma warning disable 168 -#pragma warning disable SA1200 // Using directives should be placed correctly #pragma warning disable SA1312 // Variable names should begin with lower-case letter #pragma warning disable SA1649 // File name should match first type name namespace <#= Namespace #> { - using System; - using System.Buffers; - using MessagePack; - public class <#= ResolverName #> : global::MessagePack.IFormatterResolver { public static readonly global::MessagePack.IFormatterResolver Instance = new <#= ResolverName #>(); @@ -52,11 +47,11 @@ namespace <#= Namespace #> internal static class <#= ResolverName #>GetFormatterHelper { - private static readonly global::System.Collections.Generic.Dictionary<Type, int> lookup; + private static readonly global::System.Collections.Generic.Dictionary<global::System.Type, int> lookup; static <#= ResolverName #>GetFormatterHelper() { - lookup = new global::System.Collections.Generic.Dictionary<Type, int>(<#= RegisterInfos.Length #>) + lookup = new global::System.Collections.Generic.Dictionary<global::System.Type, int>(<#= RegisterInfos.Length #>) { <# for(var i = 0; i < RegisterInfos.Length; i++) { var x = RegisterInfos[i]; #> { typeof(<#= x.FullName #>), <#= i #> }, @@ -64,7 +59,7 @@ namespace <#= Namespace #> }; } - internal static object GetFormatter(Type t) + internal static object GetFormatter(global::System.Type t) { int key; if (!lookup.TryGetValue(t, out key)) @@ -75,7 +70,7 @@ namespace <#= Namespace #> switch (key) { <# for(var i = 0; i < RegisterInfos.Length; i++) { var x = RegisterInfos[i]; #> - case <#= i #>: return new <#= x.FormatterName.StartsWith("global::") ? x.FormatterName: (!string.IsNullOrEmpty(FormatterNamespace) ? FormatterNamespace + "." : FormatterNamespace) + x.FormatterName#>(); + case <#= i #>: return new <#= x.FormatterName.StartsWith("global::") ? x.FormatterName: (!string.IsNullOrEmpty(FormatterNamespace) ? FormatterNamespace + "." : FormatterNamespace) + x.FormatterName #>(); <# } #> default: return null; } @@ -89,5 +84,4 @@ namespace <#= Namespace #> #pragma warning restore 612 #pragma warning restore SA1312 // Variable names should begin with lower-case letter -#pragma warning restore SA1200 // Using directives should be placed correctly #pragma warning restore SA1649 // File name should match first type name |