diff --git a/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.cs b/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.cs index 03ff44017..4acafd1e5 100644 --- a/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.cs +++ b/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.cs @@ -12,6 +12,7 @@ namespace UniJSON public static partial class GenericExpressionCallFactory { #if UNITY_EDITOR && VRM_DEVELOP + const int NET35MAX = 4; const int ARGS = 6; const string GENERATE_PATH = "Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.g.cs"; @@ -42,26 +43,18 @@ namespace UniJSON { "); // Create - for (int i = 1; i <= ARGS; ++i) + for (int i = 1; i <= ARGS && i(MethodInfo m) -#else - public static Action Create(MethodInfo m) -#endif { 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 -#if UNITY_5 -#else - (Action) -#endif Expression.Lambda(call, new[] { self }.Concat(args).ToArray()).Compile(); } ".Replace("$0", g).Replace("$1", a); @@ -70,16 +63,12 @@ namespace UniJSON } // CreateWithThis - for (int i = 1; i <= ARGS; ++i) + for (int i = 1; i <= ARGS && i<=NET35MAX; ++i) { var g = String.Join(", ", GetArgs("A", i).ToArray()); var source = @" -#if UNITY_5 public static Delegate CreateWithThis(MethodInfo m, S instance) -#else - public static Action<$0> CreateWithThis(MethodInfo m, S instance) -#endif { if (m.IsStatic) { @@ -108,10 +97,6 @@ namespace UniJSON call = Expression.Call(self, m, args); } return -#if UNITY_5 -#else - (Action<$0>) -#endif 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 30f647b0d..8dae56f0e 100644 --- a/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.g.cs +++ b/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.g.cs @@ -11,119 +11,37 @@ namespace UniJSON { -#if UNITY_5 public static Delegate Create(MethodInfo m) -#else - public static Action Create(MethodInfo m) -#endif { 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 -#if UNITY_5 -#else - (Action) -#endif Expression.Lambda(call, new[] { self }.Concat(args).ToArray()).Compile(); } -#if UNITY_5 public static Delegate Create(MethodInfo m) -#else - public static Action Create(MethodInfo m) -#endif { 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 -#if UNITY_5 -#else - (Action) -#endif Expression.Lambda(call, new[] { self }.Concat(args).ToArray()).Compile(); } -#if UNITY_5 public static Delegate Create(MethodInfo m) -#else - public static Action Create(MethodInfo m) -#endif { 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 -#if UNITY_5 -#else - (Action) -#endif Expression.Lambda(call, new[] { self }.Concat(args).ToArray()).Compile(); } -#if UNITY_5 - public static Delegate Create(MethodInfo m) -#else - public static Action Create(MethodInfo m) -#endif - { - 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 -#if UNITY_5 -#else - (Action) -#endif - Expression.Lambda(call, new[] { self }.Concat(args).ToArray()).Compile(); - } - - -#if UNITY_5 - public static Delegate Create(MethodInfo m) -#else - public static Action Create(MethodInfo m) -#endif - { - 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 -#if UNITY_5 -#else - (Action) -#endif - Expression.Lambda(call, new[] { self }.Concat(args).ToArray()).Compile(); - } - - -#if UNITY_5 - public static Delegate Create(MethodInfo m) -#else - public static Action Create(MethodInfo m) -#endif - { - 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 -#if UNITY_5 -#else - (Action) -#endif - Expression.Lambda(call, new[] { self }.Concat(args).ToArray()).Compile(); - } - - -#if UNITY_5 public static Delegate CreateWithThis(MethodInfo m, S instance) -#else - public static Action CreateWithThis(MethodInfo m, S instance) -#endif { if (m.IsStatic) { @@ -152,19 +70,11 @@ namespace UniJSON call = Expression.Call(self, m, args); } return -#if UNITY_5 -#else - (Action) -#endif Expression.Lambda(call, args).Compile(); } -#if UNITY_5 public static Delegate CreateWithThis(MethodInfo m, S instance) -#else - public static Action CreateWithThis(MethodInfo m, S instance) -#endif { if (m.IsStatic) { @@ -193,19 +103,11 @@ namespace UniJSON call = Expression.Call(self, m, args); } return -#if UNITY_5 -#else - (Action) -#endif Expression.Lambda(call, args).Compile(); } -#if UNITY_5 public static Delegate CreateWithThis(MethodInfo m, S instance) -#else - public static Action CreateWithThis(MethodInfo m, S instance) -#endif { if (m.IsStatic) { @@ -234,19 +136,11 @@ namespace UniJSON call = Expression.Call(self, m, args); } return -#if UNITY_5 -#else - (Action) -#endif Expression.Lambda(call, args).Compile(); } -#if UNITY_5 public static Delegate CreateWithThis(MethodInfo m, S instance) -#else - public static Action CreateWithThis(MethodInfo m, S instance) -#endif { if (m.IsStatic) { @@ -275,92 +169,6 @@ namespace UniJSON call = Expression.Call(self, m, args); } return -#if UNITY_5 -#else - (Action) -#endif - Expression.Lambda(call, args).Compile(); - } - - -#if UNITY_5 - public static Delegate CreateWithThis(MethodInfo m, S instance) -#else - public static Action CreateWithThis(MethodInfo m, S instance) -#endif - { - if (m.IsStatic) - { - if (instance != null) - { - throw new ArgumentException(); - } - } - else - { - if (instance == null) - { - throw new ArgumentNullException(); - } - } - - var self = Expression.Constant(instance, typeof(S)); // thisを定数化 - var args = m.GetParameters().Select(x => Expression.Parameter(x.ParameterType, x.Name)).ToArray(); - MethodCallExpression call; - if (m.IsStatic) - { - call = Expression.Call(m, args); - } - else - { - call = Expression.Call(self, m, args); - } - return -#if UNITY_5 -#else - (Action) -#endif - Expression.Lambda(call, args).Compile(); - } - - -#if UNITY_5 - public static Delegate CreateWithThis(MethodInfo m, S instance) -#else - public static Action CreateWithThis(MethodInfo m, S instance) -#endif - { - if (m.IsStatic) - { - if (instance != null) - { - throw new ArgumentException(); - } - } - else - { - if (instance == null) - { - throw new ArgumentNullException(); - } - } - - var self = Expression.Constant(instance, typeof(S)); // thisを定数化 - var args = m.GetParameters().Select(x => Expression.Parameter(x.ParameterType, x.Name)).ToArray(); - MethodCallExpression call; - if (m.IsStatic) - { - call = Expression.Call(m, args); - } - else - { - call = Expression.Call(self, m, args); - } - return -#if UNITY_5 -#else - (Action) -#endif Expression.Lambda(call, args).Compile(); } diff --git a/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.cs b/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.cs index 2a34544c6..497cbbad6 100644 --- a/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.cs +++ b/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.cs @@ -13,6 +13,7 @@ namespace UniJSON public static partial class GenericInvokeCallFactory { #if UNITY_EDITOR && VRM_DEVELOP + const int NET35MAX = 4; const int ARGS = 6; const string GENERATE_PATH = "Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.g.cs"; @@ -45,23 +46,15 @@ namespace UniJSON w.WriteLine("//////////// Create"); // Create - for (int i = 1; i <= ARGS; ++i) + for (int i = 1; i <= ARGS && i< NET35MAX; ++i) { var g = String.Join(", ", GetArgs("A", i).ToArray()); var a = String.Join(", ", GetArgs("a", i).ToArray()); - if (i >= 4) w.WriteLine(@" -#if UNITY_5 -#else -"); var source = @" -#if UNITY_5 public static Delegate Create(MethodInfo m) -#else - public static Action Create(MethodInfo m) -#endif { Action callback= (s, $1) => @@ -74,30 +67,18 @@ namespace UniJSON w.WriteLine(source); - if (i >= 4) w.WriteLine(@" -#endif -"); } // CreateWithThis w.WriteLine("//////////// CreateWithThis"); - for (int i = 1; i <= ARGS; ++i) + for (int i = 1; i <= ARGS && i<= NET35MAX; ++i) { var g = String.Join(", ", GetArgs("A", i).ToArray()); var a = String.Join(", ", GetArgs("a", i).ToArray()); - if (i > 4) w.WriteLine(@" -#if UNITY_5 -#else -"); - var source = @" -#if UNITY_5 public static Delegate CreateWithThis(MethodInfo m, S instance) -#else - public static Action<$0> CreateWithThis(MethodInfo m, S instance) -#endif { if (m.IsStatic) { @@ -124,10 +105,6 @@ namespace UniJSON ".Replace("$0", g).Replace("$1", a); w.WriteLine(source); - - if (i > 4) w.WriteLine(@" -#endif -"); } diff --git a/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.g.cs b/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.g.cs index 2c55e18ae..7a63001fc 100644 --- a/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.g.cs +++ b/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.g.cs @@ -10,11 +10,7 @@ namespace UniJSON //////////// Create -#if UNITY_5 public static Delegate Create(MethodInfo m) -#else - public static Action Create(MethodInfo m) -#endif { Action callback= (s, a0) => @@ -25,11 +21,7 @@ namespace UniJSON } -#if UNITY_5 public static Delegate Create(MethodInfo m) -#else - public static Action Create(MethodInfo m) -#endif { Action callback= (s, a0, a1) => @@ -40,11 +32,7 @@ namespace UniJSON } -#if UNITY_5 public static Delegate Create(MethodInfo m) -#else - public static Action Create(MethodInfo m) -#endif { Action callback= (s, a0, a1, a2) => @@ -54,79 +42,9 @@ namespace UniJSON return callback; } - -#if UNITY_5 -#else - - -#if UNITY_5 - public static Delegate Create(MethodInfo m) -#else - public static Action Create(MethodInfo m) -#endif - { - Action callback= - (s, a0, a1, a2, a3) => - { - m.Invoke(s, new object[] { a0, a1, a2, a3 }); - }; - return callback; - } - - -#endif - - -#if UNITY_5 -#else - - -#if UNITY_5 - public static Delegate Create(MethodInfo m) -#else - public static Action Create(MethodInfo m) -#endif - { - Action callback= - (s, a0, a1, a2, a3, a4) => - { - m.Invoke(s, new object[] { a0, a1, a2, a3, a4 }); - }; - return callback; - } - - -#endif - - -#if UNITY_5 -#else - - -#if UNITY_5 - public static Delegate Create(MethodInfo m) -#else - public static Action Create(MethodInfo m) -#endif - { - Action callback= - (s, a0, a1, a2, a3, a4, a5) => - { - m.Invoke(s, new object[] { a0, a1, a2, a3, a4, a5 }); - }; - return callback; - } - - -#endif - //////////// CreateWithThis -#if UNITY_5 public static Delegate CreateWithThis(MethodInfo m, S instance) -#else - public static Action CreateWithThis(MethodInfo m, S instance) -#endif { if (m.IsStatic) { @@ -152,11 +70,7 @@ namespace UniJSON } -#if UNITY_5 public static Delegate CreateWithThis(MethodInfo m, S instance) -#else - public static Action CreateWithThis(MethodInfo m, S instance) -#endif { if (m.IsStatic) { @@ -182,11 +96,7 @@ namespace UniJSON } -#if UNITY_5 public static Delegate CreateWithThis(MethodInfo m, S instance) -#else - public static Action CreateWithThis(MethodInfo m, S instance) -#endif { if (m.IsStatic) { @@ -212,11 +122,7 @@ namespace UniJSON } -#if UNITY_5 public static Delegate CreateWithThis(MethodInfo m, S instance) -#else - public static Action CreateWithThis(MethodInfo m, S instance) -#endif { if (m.IsStatic) { @@ -242,80 +148,6 @@ namespace UniJSON } -#if UNITY_5 -#else - - -#if UNITY_5 - public static Delegate CreateWithThis(MethodInfo m, S instance) -#else - public static Action CreateWithThis(MethodInfo m, S instance) -#endif - { - if (m.IsStatic) - { - if (instance != null) - { - throw new ArgumentException(); - } - } - else - { - if (instance == null) - { - throw new ArgumentNullException(); - } - } - - // ToDo: CreateDelegate - Action callback= - (a0, a1, a2, a3, a4) => { - m.Invoke(instance, new object[]{ a0, a1, a2, a3, a4 }); - }; - return callback; - } - - -#endif - - -#if UNITY_5 -#else - - -#if UNITY_5 - public static Delegate CreateWithThis(MethodInfo m, S instance) -#else - public static Action CreateWithThis(MethodInfo m, S instance) -#endif - { - if (m.IsStatic) - { - if (instance != null) - { - throw new ArgumentException(); - } - } - else - { - if (instance == null) - { - throw new ArgumentNullException(); - } - } - - // ToDo: CreateDelegate - Action callback= - (a0, a1, a2, a3, a4, a5) => { - m.Invoke(instance, new object[]{ a0, a1, a2, a3, a4, a5 }); - }; - return callback; - } - - -#endif - - } }