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

◆ AssignAssociates() [1/2]

static RuntimeMethodInfo System.Reflection.Associates.AssignAssociates ( int tkMethod,
RuntimeType declaredType,
RuntimeType reflectedType )
inlinestaticprivate

Definition at line 35 of file Associates.cs.

36 {
37 if (MetadataToken.IsNullToken(tkMethod))
38 {
39 return null;
40 }
41 bool flag = declaredType != reflectedType;
42 IntPtr[] array = null;
43 int typeInstCount = 0;
44 RuntimeType[] instantiationInternal = declaredType.GetTypeHandleInternal().GetInstantiationInternal();
45 if (instantiationInternal != null)
46 {
49 for (int i = 0; i < instantiationInternal.Length; i++)
50 {
51 array[i] = instantiationInternal[i].GetTypeHandleInternal().Value;
52 }
53 }
54 RuntimeMethodHandleInternal runtimeMethodHandleInternal = ModuleHandle.ResolveMethodHandleInternal(RuntimeTypeHandle.GetModule(declaredType), tkMethod, array, typeInstCount, null, 0);
55 if (flag)
56 {
57 MethodAttributes attributes = RuntimeMethodHandle.GetAttributes(runtimeMethodHandleInternal);
58 if ((attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Private)
59 {
60 return null;
61 }
62 if ((attributes & MethodAttributes.Virtual) != 0 && (RuntimeTypeHandle.GetAttributes(declaredType) & TypeAttributes.ClassSemanticsMask) == 0)
63 {
64 int slot = RuntimeMethodHandle.GetSlot(runtimeMethodHandleInternal);
65 runtimeMethodHandleInternal = RuntimeTypeHandle.GetMethodAt(reflectedType, slot);
66 }
67 }
68 RuntimeMethodInfo runtimeMethodInfo = RuntimeType.GetMethodBase(reflectedType, runtimeMethodHandleInternal) as RuntimeMethodInfo;
69 return runtimeMethodInfo ?? (reflectedType.Module.ResolveMethod(tkMethod, null, null) as RuntimeMethodInfo);
70 }

References System.array, System.RuntimeMethodHandle.GetAttributes(), System.RuntimeTypeHandle.GetAttributes(), System.RuntimeTypeHandle.GetMethodAt(), System.RuntimeType.GetMethodBase(), System.RuntimeTypeHandle.GetModule(), System.RuntimeMethodHandle.GetSlot(), System.Reflection.MetadataToken.IsNullToken(), and System.ModuleHandle.ResolveMethodHandleInternal().

Referenced by System.Reflection.RuntimeEventInfo.RuntimeEventInfo(), System.Reflection.RuntimePropertyInfo.RuntimePropertyInfo(), and System.Reflection.Associates.AssignAssociates().