Ancestry.Daisy.Statements.StaticAnalysis.ExtractProceedFunctionType C# (CSharp) Method

ExtractProceedFunctionType() public static method

public static ExtractProceedFunctionType ( Type func ) : Type
func System.Type
return System.Type
        public static Type ExtractProceedFunctionType(Type func)
        {
            if (func.BaseType != typeof(MulticastDelegate)) return null;
            if (!func.IsGenericType) return null;
            var gs = func.GenericTypeArguments;
            if (gs.Length != 2) return null;
            if (gs[1] != typeof(bool)) return null;
            return gs[0];
        }

Usage Example

Beispiel #1
0
 private void IsolateParameters(MethodInfo methodInfo)
 {
     Parameters = methodInfo.GetParameters()
                  .Select(p => {
         var proceedFunctionType = StaticAnalysis.ExtractProceedFunctionType(p.ParameterType);
         if (proceedFunctionType != null)
         {
             TransformsScopeTo = proceedFunctionType;
             return(new ProceedParameter()
             {
                 Name = p.Name,
                 Type = p.ParameterType,
                 TransformsTo = proceedFunctionType
             });
         }
         else
         {
             return(new StatementParameter()
             {
                 Name = p.Name, Type = p.ParameterType
             });
         }
     })
                  .ToList();
 }