コード例 #1
0
        private static void AddParameterAnnotations(ClassFileWriter writer, FieldOrMethod target, MethodBase source)
        {
#if !FIRST_PASS && !STUB_GENERATOR
#if !WINRT
            if (source != null)
            {
                RuntimeVisibleParameterAnnotationsAttribute attr = null;
                ParameterInfo[] parameters = source.GetParameters();
                for (int i = 0; i < parameters.Length; i++)
                {
                    RuntimeVisibleAnnotationsAttribute param = null;
                    foreach (CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(parameters[i]))
                    {
                        object[] ann = GetAnnotation(cad);
                        if (ann != null)
                        {
                            if (param == null)
                            {
                                if (attr == null)
                                {
                                    attr = new RuntimeVisibleParameterAnnotationsAttribute(writer);
                                    for (int j = 0; j < i; j++)
                                    {
                                        attr.Add(new RuntimeVisibleAnnotationsAttribute(writer));
                                    }
                                }
                                param = new RuntimeVisibleAnnotationsAttribute(writer);
                            }
                            param.Add(ann);
                        }
                    }
                    if (attr != null)
                    {
                        attr.Add(param ?? new RuntimeVisibleAnnotationsAttribute(writer));
                    }
                }
                if (attr != null)
                {
                    target.AddAttribute(attr);
                }
            }
#else
            throw new NotImplementedException();
#endif
#endif
        }
コード例 #2
0
        private static void AddParameterAnnotations(ClassFileWriter writer, FieldOrMethod target, MethodBase source)
        {
#if !FIRST_PASS && !STUB_GENERATOR
            if (source != null)
            {
                RuntimeVisibleParameterAnnotationsAttribute attr = null;
                ParameterInfo[] parameters = source.GetParameters();
                for (int i = 0; i < parameters.Length; i++)
                {
                    RuntimeVisibleAnnotationsAttribute param = null;
                    foreach (CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(parameters[i]))
                    {
                        object[] ann = GetAnnotation(cad);
                        if (ann != null)
                        {
                            if (param == null)
                            {
                                if (attr == null)
                                {
                                    attr = new RuntimeVisibleParameterAnnotationsAttribute(writer);
                                    for (int j = 0; j < i; j++)
                                    {
                                        attr.Add(new RuntimeVisibleAnnotationsAttribute(writer));
                                    }
                                }
                                param = new RuntimeVisibleAnnotationsAttribute(writer);
                            }
                            param.Add(UnpackArray((IList <CustomAttributeTypedArgument>)cad.ConstructorArguments[0].Value));
                        }
                    }
                    if (attr != null)
                    {
                        attr.Add(param ?? new RuntimeVisibleAnnotationsAttribute(writer));
                    }
                }
                if (attr != null)
                {
                    target.AddAttribute(attr);
                }
            }
#endif
        }
コード例 #3
0
ファイル: StubGenerator.cs プロジェクト: T0pp3r/ikvm-fork
 private static void AddParameterAnnotations(ClassFileWriter writer, FieldOrMethod target, MethodBase source)
 {
     #if !FIRST_PASS && !STUB_GENERATOR
     if (source != null)
     {
         RuntimeVisibleParameterAnnotationsAttribute attr = null;
         ParameterInfo[] parameters = source.GetParameters();
         for (int i = 0; i < parameters.Length; i++)
         {
             RuntimeVisibleAnnotationsAttribute param = null;
             foreach (CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(parameters[i]))
             {
                 object[] ann = GetAnnotation(cad);
                 if (ann != null)
                 {
                     if (param == null)
                     {
                         if (attr == null)
                         {
                             attr = new RuntimeVisibleParameterAnnotationsAttribute(writer);
                             for (int j = 0; j < i; j++)
                             {
                                 attr.Add(new RuntimeVisibleAnnotationsAttribute(writer));
                             }
                         }
                         param = new RuntimeVisibleAnnotationsAttribute(writer);
                     }
                     param.Add(ann);
                 }
             }
             if (attr != null)
             {
                 attr.Add(param ?? new RuntimeVisibleAnnotationsAttribute(writer));
             }
         }
         if (attr != null)
         {
             target.AddAttribute(attr);
         }
     }
     #endif
 }