public XmlCtor(GenBase declaringType, XElement elem) : base(declaringType) { this.elem = elem; GenericArguments = elem.GenericArguments(); name = elem.XGetAttribute("name"); int idx = name.LastIndexOf('.'); if (idx > 0) { name = name.Substring(idx + 1); } // If 'elem' is a constructor for a non-static nested type, then // the type of the containing class must be inserted as the first // argument nonStaticNestedType = idx > 0 && elem.Parent.Attribute("static").Value == "false"; if (nonStaticNestedType) { string declName = elem.Parent.XGetAttribute("name"); string expectedEnclosingName = declName.Substring(0, idx); XElement enclosingType = GetPreviousClass(elem.Parent.PreviousNode, expectedEnclosingName); if (enclosingType == null) { missing_enclosing_class = true; Report.Warning(0, Report.WarningCtor + 0, "For {0}, could not find enclosing type '{1}'.", name, expectedEnclosingName); } else { Parameters.AddFirst(Parameter.FromClassElement(enclosingType)); } } foreach (var child in elem.Elements()) { if (child.Name == "parameter") { Parameters.Add(Parameter.FromElement(child)); } } if (elem.Attribute("customAttributes") != null) { custom_attributes = elem.XGetAttribute("customAttributes"); } }
ManagedCtor(GenBase declaringType, MethodDefinition m, ManagedMethodBaseSupport support) : base(declaringType, support) { this.m = m; name = m.Name; // If 'elem' is a constructor for a non-static nested type, then // the type of the containing class must be inserted as the first // argument if (IsNonStaticNestedType) { Parameters.AddFirst(Parameter.FromManagedType(m.DeclaringType.DeclaringType, DeclaringType.JavaName)); } var regatt = m.CustomAttributes.FirstOrDefault(a => a.AttributeType.FullName == "Android.Runtime.RegisterAttribute"); is_acw = regatt != null; foreach (var p in support.GetParameters(regatt)) { Parameters.Add(p); } }