public TypeInformation(Mono.Cecil.IMemberDefinition field, Mono.Cecil.TypeReference fieldType, GhostFieldAttribute ghostField, TypeAttribute inheritedAttribute, TypeAttribute.AttributeFlags inheritedAttributeMask, string parent = null) { Type = fieldType; FieldName = field.Name; DeclaringType = field.DeclaringType; Fields = new List <TypeInformation>(); Attribute = inheritedAttribute; AttributeMask = inheritedAttributeMask; //Always reset the subtype. It cannot be inherithed like this Attribute.subtype = 0; //Reset flags based on inheritance mask Attribute.composite &= (AttributeMask & TypeAttribute.AttributeFlags.Composite) != 0; Attribute.smoothing &= inheritedAttribute.smoothing; if ((AttributeMask & TypeAttribute.AttributeFlags.Quantized) == 0) { Attribute.quantization = -1; } ParseAttribute(ghostField); Parent = string.IsNullOrEmpty(parent) ? "" : parent; }
static private TypeInformation ParseTypeField(Mono.Cecil.IMemberDefinition fieldInfo, Mono.Cecil.TypeReference fieldType, GhostFieldAttribute ghostField, TypeAttribute inheritedAttribute, TypeAttribute.AttributeFlags inheriteAttributedMask, string parent = "") { var information = new TypeInformation(fieldInfo, fieldType, ghostField, inheritedAttribute, inheriteAttributedMask, parent); //blittable also contains bool, but does not contains enums if (fieldType.IsBlittable()) { return(information); } var fieldDef = fieldType.Resolve(); if (fieldDef.IsEnum) { return(information); } if (!fieldDef.IsStruct()) { return(default);
public void UpdateMemberSection(MemberInfo member, RegisterAttribute tregister, XElement dest, string prefix, bool firstPass) { //XElement jdSummaryDiv = section.SummaryDiv; string anchor = Anchor; var mdRemarks = dest.XPathSelectElement("Docs/remarks"); if (firstPass) { mdRemarks.Value = ""; } if (prefix != null) { Application.AddAndroidDocUrlWithOptionalContent(mdRemarks, tregister, anchor, prefix + " method documentation", Mdoc.FromHtml(GetSummaryNodes())); } else { mdRemarks.Add(Mdoc.FromHtml(GetSummaryNodes())); Application.AddAndroidDocUrlWithOptionalContent(mdRemarks, tregister, anchor); } Application.FixupMdoc(mdRemarks); if (firstPass) { UpdateSince(mdRemarks); Application.SetSummaryFromRemarks(dest.Element("Docs"), prefix, firstPass); } // if method.IsSpecialName is true, then it's probably a property, in // which case the parameter names will NOT match. var method = member as MethodInfo; if (method != null && !method.IsSpecialName) { UpdateMemberParameters(dest); } UpdateMemberExceptions(dest, firstPass); UpdateMemberReturns(dest, firstPass); UpdateMemberSeeAlso(dest, firstPass); }
public static GhostFieldAttribute GetGhostFieldAttribute(Mono.Cecil.TypeReference parentType, Mono.Cecil.IMemberDefinition componentField) { if (parentType != null && GhostAuthoringModifiers.GhostDefaultOverrides.TryGetValue(parentType.FullName.Replace('/', '+'), out var newComponent)) { foreach (var field in newComponent.fields) { if (field.name == componentField.Name) { return(field.attribute); } } return(default(GhostFieldAttribute)); } var attribute = componentField.GetAttribute <GhostFieldAttribute>(); if (attribute != null) { var fieldAttribute = new GhostFieldAttribute(); if (attribute.HasProperties) { foreach (var a in attribute.Properties) { typeof(GhostFieldAttribute).GetProperty(a.Name)?.SetValue(fieldAttribute, a.Argument.Value); } } return(fieldAttribute); } return(default(GhostFieldAttribute)); }
public static bool HasGhostFieldAttribute(Mono.Cecil.TypeReference parentType, Mono.Cecil.IMemberDefinition componentField) { if (!GhostAuthoringModifiers.GhostDefaultOverrides.TryGetValue(parentType.FullName.Replace('/', '+'), out var newComponent)) { return(componentField.HasAttribute <GhostFieldAttribute>()); } else { return(newComponent.fields.Any(f => f.name == componentField.Name)); } }
public static void LoadMetadataToken(Mono.Cecil.IMemberDefinition member) { CurrentEmitContext.Emit(CreateInstruction.LoadMetadataToken(member)); }