/// <summary> /// Processes an attribute element. /// </summary> /// <param name="element">Attribute code element.</param> public override void VisitAttributeElement(AttributeElement element) { this.WriteComments(element.HeaderComments); bool nested = element.Parent is AttributeElement; if (!nested) { WriteIndented(CSharpSymbol.BeginAttribute.ToString()); if (!string.IsNullOrEmpty(element.Target)) { Writer.Write(element.Target); Writer.Write(CSharpSymbol.TypeImplements); Writer.Write(' '); } } Writer.Write(element.Name); if (!string.IsNullOrEmpty(element.BodyText)) { Writer.Write(CSharpSymbol.BeginParameterList); Writer.Write(element.BodyText); Writer.Write(CSharpSymbol.EndParameterList); } // // Nested list of attributes? // foreach (ICodeElement childElement in element.Children) { AttributeElement childAttribute = childElement as AttributeElement; if (childAttribute != null) { Writer.Write(','); Writer.WriteLine(); WriteIndented(string.Empty); childAttribute.Accept(this); } } if (!nested) { Writer.Write(CSharpSymbol.EndAttribute); } if (!nested && element.Parent != null) { Writer.WriteLine(); } }
/// <summary> /// Processes an attribute element. /// </summary> /// <param name="element">Attribute code element.</param> public override void VisitAttributeElement(AttributeElement element) { this.WriteComments(element.HeaderComments); // HACK: Create an explicit element type for Option (or compiler directive) if (element[VBExtendedProperties.Option] is bool && (bool)element[VBExtendedProperties.Option]) { WriteIndented(element.BodyText); } else { bool nested = element.Parent is AttributeElement; if (!nested) { WriteIndented(VBSymbol.BeginAttribute.ToString()); } if (!string.IsNullOrEmpty(element.Target)) { Writer.Write(element.Target); Writer.Write(VBSymbol.LineDelimiter); Writer.Write(' '); } Writer.Write(element.Name); if (!string.IsNullOrEmpty(element.BodyText)) { Writer.Write(VBSymbol.BeginParameterList); Writer.Write(element.BodyText); Writer.Write(VBSymbol.EndParameterList); } // // Nested list of attributes? // foreach (ICodeElement childElement in element.Children) { AttributeElement childAttribute = childElement as AttributeElement; if (childAttribute != null) { Writer.Write(", _"); Writer.WriteLine(); WriteIndented(string.Empty); childAttribute.Accept(this); } } if (!nested) { Writer.Write(VBSymbol.EndAttribute); if (element.Parent is TextCodeElement) { Writer.Write(" _"); } } if (!nested && element.Parent != null) { Writer.WriteLine(); } } }