From b6303ea26b0632063634a4448cdbd88f6f17d072 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 29 Jan 2019 14:48:39 +0900 Subject: [PATCH] Delegate to type specific Action --- .../GenericExpressionCallFactory.cs | 8 +++--- .../GenericExpressionCallFactory.g.cs | 28 +++++++++---------- .../GenericInvokeCallFactory.cs | 4 +-- .../GenericInvokeCallFactory.g.cs | 14 +++++----- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.cs b/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.cs index 4acafd1e5..fa8fd8b1f 100644 --- a/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.cs +++ b/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.cs @@ -49,13 +49,13 @@ namespace UniJSON var a = String.Join(", ", GetArgs("a", i).ToArray()); var source = @" - public static Delegate Create(MethodInfo m) + public static Action Create(MethodInfo m) { var self = Expression.Parameter(m.DeclaringType, m.Name); var args = m.GetParameters().Select(x => Expression.Parameter(x.ParameterType, x.Name)).ToArray(); var call = Expression.Call(self, m, args); return - Expression.Lambda(call, new[] { self }.Concat(args).ToArray()).Compile(); + (Action)Expression.Lambda(call, new[] { self }.Concat(args).ToArray()).Compile(); } ".Replace("$0", g).Replace("$1", a); @@ -68,7 +68,7 @@ namespace UniJSON var g = String.Join(", ", GetArgs("A", i).ToArray()); var source = @" - public static Delegate CreateWithThis(MethodInfo m, S instance) + public static Action<$0> CreateWithThis(MethodInfo m, S instance) { if (m.IsStatic) { @@ -97,7 +97,7 @@ namespace UniJSON call = Expression.Call(self, m, args); } return - Expression.Lambda(call, args).Compile(); + (Action<$0>)Expression.Lambda(call, args).Compile(); } ".Replace("$0", g); diff --git a/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.g.cs b/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.g.cs index 8dae56f0e..5415ced57 100644 --- a/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.g.cs +++ b/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.g.cs @@ -11,37 +11,37 @@ namespace UniJSON { - public static Delegate Create(MethodInfo m) + public static Action Create(MethodInfo m) { var self = Expression.Parameter(m.DeclaringType, m.Name); var args = m.GetParameters().Select(x => Expression.Parameter(x.ParameterType, x.Name)).ToArray(); var call = Expression.Call(self, m, args); return - Expression.Lambda(call, new[] { self }.Concat(args).ToArray()).Compile(); + (Action)Expression.Lambda(call, new[] { self }.Concat(args).ToArray()).Compile(); } - public static Delegate Create(MethodInfo m) + public static Action Create(MethodInfo m) { var self = Expression.Parameter(m.DeclaringType, m.Name); var args = m.GetParameters().Select(x => Expression.Parameter(x.ParameterType, x.Name)).ToArray(); var call = Expression.Call(self, m, args); return - Expression.Lambda(call, new[] { self }.Concat(args).ToArray()).Compile(); + (Action)Expression.Lambda(call, new[] { self }.Concat(args).ToArray()).Compile(); } - public static Delegate Create(MethodInfo m) + public static Action Create(MethodInfo m) { var self = Expression.Parameter(m.DeclaringType, m.Name); var args = m.GetParameters().Select(x => Expression.Parameter(x.ParameterType, x.Name)).ToArray(); var call = Expression.Call(self, m, args); return - Expression.Lambda(call, new[] { self }.Concat(args).ToArray()).Compile(); + (Action)Expression.Lambda(call, new[] { self }.Concat(args).ToArray()).Compile(); } - public static Delegate CreateWithThis(MethodInfo m, S instance) + public static Action CreateWithThis(MethodInfo m, S instance) { if (m.IsStatic) { @@ -70,11 +70,11 @@ namespace UniJSON call = Expression.Call(self, m, args); } return - Expression.Lambda(call, args).Compile(); + (Action)Expression.Lambda(call, args).Compile(); } - public static Delegate CreateWithThis(MethodInfo m, S instance) + public static Action CreateWithThis(MethodInfo m, S instance) { if (m.IsStatic) { @@ -103,11 +103,11 @@ namespace UniJSON call = Expression.Call(self, m, args); } return - Expression.Lambda(call, args).Compile(); + (Action)Expression.Lambda(call, args).Compile(); } - public static Delegate CreateWithThis(MethodInfo m, S instance) + public static Action CreateWithThis(MethodInfo m, S instance) { if (m.IsStatic) { @@ -136,11 +136,11 @@ namespace UniJSON call = Expression.Call(self, m, args); } return - Expression.Lambda(call, args).Compile(); + (Action)Expression.Lambda(call, args).Compile(); } - public static Delegate CreateWithThis(MethodInfo m, S instance) + public static Action CreateWithThis(MethodInfo m, S instance) { if (m.IsStatic) { @@ -169,7 +169,7 @@ namespace UniJSON call = Expression.Call(self, m, args); } return - Expression.Lambda(call, args).Compile(); + (Action)Expression.Lambda(call, args).Compile(); } diff --git a/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.cs b/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.cs index 497cbbad6..cd97aa66a 100644 --- a/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.cs +++ b/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.cs @@ -54,7 +54,7 @@ namespace UniJSON var source = @" - public static Delegate Create(MethodInfo m) + public static Action Create(MethodInfo m) { Action callback= (s, $1) => @@ -78,7 +78,7 @@ namespace UniJSON var a = String.Join(", ", GetArgs("a", i).ToArray()); var source = @" - public static Delegate CreateWithThis(MethodInfo m, S instance) + public static Action<$0> CreateWithThis(MethodInfo m, S instance) { if (m.IsStatic) { diff --git a/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.g.cs b/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.g.cs index 7a63001fc..be4fc27f3 100644 --- a/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.g.cs +++ b/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.g.cs @@ -10,7 +10,7 @@ namespace UniJSON //////////// Create - public static Delegate Create(MethodInfo m) + public static Action Create(MethodInfo m) { Action callback= (s, a0) => @@ -21,7 +21,7 @@ namespace UniJSON } - public static Delegate Create(MethodInfo m) + public static Action Create(MethodInfo m) { Action callback= (s, a0, a1) => @@ -32,7 +32,7 @@ namespace UniJSON } - public static Delegate Create(MethodInfo m) + public static Action Create(MethodInfo m) { Action callback= (s, a0, a1, a2) => @@ -44,7 +44,7 @@ namespace UniJSON //////////// CreateWithThis - public static Delegate CreateWithThis(MethodInfo m, S instance) + public static Action CreateWithThis(MethodInfo m, S instance) { if (m.IsStatic) { @@ -70,7 +70,7 @@ namespace UniJSON } - public static Delegate CreateWithThis(MethodInfo m, S instance) + public static Action CreateWithThis(MethodInfo m, S instance) { if (m.IsStatic) { @@ -96,7 +96,7 @@ namespace UniJSON } - public static Delegate CreateWithThis(MethodInfo m, S instance) + public static Action CreateWithThis(MethodInfo m, S instance) { if (m.IsStatic) { @@ -122,7 +122,7 @@ namespace UniJSON } - public static Delegate CreateWithThis(MethodInfo m, S instance) + public static Action CreateWithThis(MethodInfo m, S instance) { if (m.IsStatic) {