private void GrowAttributesIfNeeded() { if (this.attributes == null) { this.attributes = new AttributeData[4]; } else if (this.attributes.Length == this.attributeCount) { AttributeData[] destinationArray = new AttributeData[this.attributes.Length * 2]; Array.Copy(this.attributes, 0, destinationArray, 0, this.attributes.Length); this.attributes = destinationArray; } }
public void AddAttribute(string prefix, string ns, string name, string value) { this.GrowAttributesIfNeeded(); AttributeData data = this.attributes[this.attributeCount]; if (data == null) { this.attributes[this.attributeCount] = data = new AttributeData(); } data.prefix = prefix; data.ns = ns; data.localName = name; data.value = value; this.attributeCount++; }
void GrowAttributesIfNeeded() { if (attributes == null) attributes = new AttributeData[4]; else if (attributes.Length == attributeCount) { AttributeData[] newAttributes = new AttributeData[attributes.Length * 2]; Array.Copy(attributes, 0, newAttributes, 0, attributes.Length); attributes = newAttributes; } }
public void AddAttribute(string prefix, string ns, string name, string value) { GrowAttributesIfNeeded(); AttributeData attribute = attributes[attributeCount]; if (attribute == null) attributes[attributeCount] = attribute = new AttributeData(); attribute.prefix = prefix; attribute.ns = ns; attribute.localName = name; attribute.value = value; attributeCount++; }
public CodeGeneratorException(AttributeData location, string message) : this(location?.ApplicationSyntaxReference?.GetSyntax()?.GetLocation(), message) { }
public override void ReportMarshalUnmanagedTypeOnlyValidForFields(DiagnosticBag diagnostics, SyntaxNode attributeSyntax, int parameterIndex, string unmanagedTypeName, AttributeData attribute) { var node = (AttributeSyntax)attributeSyntax; CSharpSyntaxNode attributeArgumentSyntax = attribute.GetAttributeArgumentSyntax(parameterIndex, node); diagnostics.Add(ErrorCode.ERR_MarshalUnmanagedTypeOnlyValidForFields, attributeArgumentSyntax.Location, unmanagedTypeName); }
public override void ReportInvalidAttributeArgument(DiagnosticBag diagnostics, SyntaxNode attributeSyntax, int parameterIndex, AttributeData attribute) { var node = (AttributeSyntax)attributeSyntax; CSharpSyntaxNode attributeArgumentSyntax = attribute.GetAttributeArgumentSyntax(parameterIndex, node); diagnostics.Add(ErrorCode.ERR_InvalidAttributeArgument, attributeArgumentSyntax.Location, node.GetErrorDisplayName()); }