MCPcopy Create free account
hub / github.com/Tencent/xLua / tryMakeGenericMethod

Method tryMakeGenericMethod

Assets/XLua/Src/MethodWarpsCache.cs:558–581  ·  view source on GitHub ↗
(ref MethodBase method)

Source from the content-addressed store, hash-verified

556 }
557
558 private static bool tryMakeGenericMethod(ref MethodBase method)
559 {
560 try
561 {
562 if (!(method is MethodInfo) || !Utils.IsSupportedMethod(method as MethodInfo) )
563 {
564 return false;
565 }
566 var genericArguments = method.GetGenericArguments();
567 var constraintedArgumentTypes = new Type[genericArguments.Length];
568 for (var i = 0; i < genericArguments.Length; i++)
569 {
570 var argumentType = genericArguments[i];
571 var parameterConstraints = argumentType.GetGenericParameterConstraints();
572 constraintedArgumentTypes[i] = parameterConstraints[0];
573 }
574 method = ((MethodInfo)method).MakeGenericMethod(constraintedArgumentTypes);
575 return true;
576 }
577 catch (Exception)
578 {
579 return false;
580 }
581 }
582 }
583}

Callers

nothing calls this directly

Calls 3

IsSupportedMethodMethod · 0.80
MakeGenericMethodMethod · 0.80

Tested by

no test coverage detected