public ManagedGenBaseSupport(TypeDefinition t) { this.t = t; var regatt = t.CustomAttributes.FirstOrDefault(a => a.AttributeType.FullNameCorrected() == "Android.Runtime.RegisterAttribute"); is_acw = regatt != null; string jn = regatt != null ? ((string)regatt.ConstructorArguments [0].Value).Replace('/', '.') : t.FullNameCorrected(); int idx = jn.LastIndexOf('.'); pkg_name = idx < 0 ? String.Empty : jn.Substring(0, idx); java_name = SymbolTable.FilterPrimitiveFullName(t.FullNameCorrected()); if (java_name == null) { java_name = idx < 0 ? jn : jn.Substring(idx + 1); full_name = t.FullNameCorrected(); } else { var sym = SymbolTable.Lookup(java_name); full_name = sym != null ? sym.FullName : t.FullNameCorrected(); } java_name = java_name.Replace('$', '.'); type_parameters = GenericParameterDefinitionList.FromMetadata(t.GenericParameters); var obsolete = t.CustomAttributes.FirstOrDefault(ca => ca.AttributeType.FullName == "System.ObsoleteAttribute"); if (obsolete != null) { deprecated = true; deprecatedComment = obsolete.HasConstructorArguments ? obsolete.ConstructorArguments [0].Value.ToString() : "This class is obsoleted in this android platform"; } }
public static GenBaseSupport CreateGenBaseSupport(TypeDefinition t, CodeGenerationOptions opt) { var obs_attr = GetObsoleteAttribute(t.CustomAttributes); var reg_attr = GetRegisterAttribute(t.CustomAttributes); var jn = reg_attr != null ? ((string)reg_attr.ConstructorArguments [0].Value).Replace('/', '.') : t.FullNameCorrected(); var idx = jn.LastIndexOf('.'); var support = new GenBaseSupport { IsAcw = reg_attr != null, IsDeprecated = obs_attr != null, IsGeneratable = false, IsGeneric = t.HasGenericParameters, IsObfuscated = false, // obfuscated types have no chance to be already bound in managed types. Name = t.Name, Namespace = t.Namespace, PackageName = idx < 0 ? string.Empty : jn.Substring(0, idx), TypeParameters = GenericParameterDefinitionList.FromMetadata(t.GenericParameters), Visibility = t.IsPublic || t.IsNestedPublic ? "public" : "protected internal" }; support.JavaSimpleName = TypeNameUtilities.FilterPrimitiveFullName(t.FullNameCorrected()); if (support.JavaSimpleName == null) { support.JavaSimpleName = idx < 0 ? jn : jn.Substring(idx + 1); support.FullName = t.FullNameCorrected(); } else { var sym = opt.SymbolTable.Lookup(support.JavaSimpleName); support.FullName = sym != null ? sym.FullName : t.FullNameCorrected(); } support.JavaSimpleName = support.JavaSimpleName.Replace('$', '.'); if (support.IsDeprecated) { support.DeprecatedComment = GetObsoleteComment(obs_attr) ?? "This class is obsoleted in this android platform"; } return(support); }
public static GenericParameterDefinitionList GenericArguments(this MethodDefinition m) => m.HasGenericParameters ? GenericParameterDefinitionList.FromMetadata(m.GenericParameters) : null;
public ManagedMethodBaseSupport(MethodDefinition m) { this.m = m; generic_arguments = m.HasGenericParameters ? GenericParameterDefinitionList.FromMetadata(m.GenericParameters) : null; }