Exemple #1
0
 static GacMethod TryPickFunction(GacUDT udt, GacMethod[] methods, string methodLocalName, string methodParameters)
 {
     var candidates1 = methods.Where(m => m.Name == udt.Name + "::" + methodLocalName).ToArray();
     var candidates2 = methods.Where(m => m.Name == methodLocalName).ToArray();
     var result = TryPickFunction(candidates1.Concat(candidates2).ToArray(), methodParameters);
     return result;
 }
Exemple #2
0
 static GacMethod PickFunction(GacMethod[] funcs, string methodParameters)
 {
     GacMethod method = TryPickFunction(funcs, methodParameters);
     if (method == null)
     {
         throw new ArgumentException();
     }
     return method;
 }
Exemple #3
0
 // methodParameters can be
 // (vl.presentation.TextPos,vl.presentation.TextPos,vl.ObjectString<System.Char>!System.Runtime.CompilerServices.IsConst*!System.Runtime.CompilerServices.IsImplicitlyDereferenced)
 static GacMethod TryPickFunction(GacMethod[] funcs, string methodParameters)
 {
     switch (funcs.Length)
     {
         case 0: return null;
         case 1: return funcs[0];
         default:
             {
                 var parameters =
                     methodParameters == ""
                     ? new string[0]
                     : SplitParameters(methodParameters.Substring(1, methodParameters.Length - 2))
                     ;
                 var selectableFuncs = funcs
                     .Where(f => f.Type.ParameterTypes.Length == parameters.Length)
                     .ToArray();
                 if (selectableFuncs.Length != 1)
                 {
                     selectableFuncs = selectableFuncs
                         .Where(f => f.Type.ParameterTypes.Select((t, i) => t.Name == parameters[i]).All(t => t))
                         .ToArray();
                 }
                 return selectableFuncs.Length == 1 ? selectableFuncs[0] : null;
             }
     }
 }