Ejemplo n.º 1
0
        protected List <string> ExportMethodParameters(IMethod me)
        {
            var list = new List <string>();

            if (!Sk.IgnoreGenericMethodArguments(me) && me.GetGenericArguments().Count() > 0)
            {
                list.AddRange(me.GetGenericArguments().Select(t => t.Name));
            }
            //if (me.Parameters.Where(t => t.IsOut || t.IsRef).FirstOrDefault() != null)
            //{
            //    throw new CompilerException(me, "Out and ref parameters are not supported");
            //}
            list.AddRange(me.Parameters.Select(t => t.Name));
            return(list);
        }
Ejemplo n.º 2
0
 void ProcessGenericMethodArgs()
 {
     GenericArgs = new List <GenericArg>();
     if (Method != null && Method is SpecializedMethod && !Sk.IgnoreGenericMethodArguments(Method))
     {
         if (Method.IsConstructor)
         {
             var ce = Method.DeclaringType as ParameterizedType;
             if (ce != null)
             {
                 GenericArgs.AddRange(ce.TypeArguments.Select(t => new GenericArg {
                     JsExpression = SkJs.EntityTypeRefToMember(t, true), Arg = t
                 }).ToList());
             }
         }
         else
         {
             var sme = (SpecializedMethod)Method;
             var genericMethodArgs = sme.TypeArguments.Select(t => new GenericArg {
                 JsExpression = SkJs.EntityTypeRefToMember(t, true), Arg = t
             }).ToList();
             var i = 0;
             foreach (var z in Method.TypeParameters)
             {
                 if (i >= genericMethodArgs.Count)
                 {
                     continue;
                 }
                 genericMethodArgs[i].TypeParam = z;
                 i++;
             }
             GenericArgs.AddRange(genericMethodArgs);
         }
         var jsArgs = GenericArgs.Select(t => t.JsExpression).ToList();
         if (Node2.Arguments == null)
         {
             Node2.Arguments = new List <JsExpression>(jsArgs);
         }
         else
         {
             Node2.Arguments.InsertRange(0, jsArgs);
         }
     }
 }