Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Create() [2/2]

static CallInstruction System.Linq.Expressions.Interpreter.CallInstruction.Create ( MethodInfo info,
ParameterInfo[] parameters )
inlinestaticinherited

Definition at line 23 of file CallInstruction.cs.

24 {
25 int num = parameters.Length;
26 if (!info.IsStatic)
27 {
28 num++;
29 }
30 if (info.DeclaringType != null && info.DeclaringType.IsArray && (info.Name == "Get" || info.Name == "Set"))
31 {
32 return GetArrayAccessor(info, num);
33 }
34 if (!info.IsStatic && info.DeclaringType.IsValueType)
35 {
36 return new MethodInfoCallInstruction(info, num);
37 }
38 if (num >= 5)
39 {
40 return new MethodInfoCallInstruction(info, num);
41 }
42 foreach (ParameterInfo parameterInfo in parameters)
43 {
44 if (parameterInfo.ParameterType.IsByRef)
45 {
46 return new MethodInfoCallInstruction(info, num);
47 }
48 }
50 if (s_cache.TryGetValue(info, out var value))
51 {
52 return value;
53 }
54 try
55 {
56 value = ((num >= 3) ? SlowCreate(info, parameters) : FastCreate(info, parameters));
57 }
59 {
60 if (!(ex.InnerException is NotSupportedException))
61 {
62 throw;
63 }
64 value = new MethodInfoCallInstruction(info, num);
65 }
66 catch (NotSupportedException)
67 {
68 value = new MethodInfoCallInstruction(info, num);
69 }
72 return value;
73 }
static CallInstruction SlowCreate(MethodInfo info, ParameterInfo[] pis)
static CallInstruction FastCreate(MethodInfo target, ParameterInfo[] pi)
static readonly CacheDict< MethodInfo, CallInstruction > s_cache
static CallInstruction GetArrayAccessor(MethodInfo info, int argumentCount)

References System.Linq.Expressions.Interpreter.CallInstruction.FastCreate(), System.Linq.Expressions.Interpreter.CallInstruction.GetArrayAccessor(), System.info, System.Linq.Expressions.Interpreter.CallInstruction.s_cache, System.Linq.Expressions.Interpreter.CallInstruction.ShouldCache(), System.Linq.Expressions.Interpreter.CallInstruction.SlowCreate(), and System.value.