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 }
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 }
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 }