void ApplyAttributes(IStatement n) { var attributes = new List <DAttribute>(); foreach (var attr in BlockAttributes.ToArray()) { attributes.Add(attr); } while (DeclarationAttributes.Count > 0) { var attr = DeclarationAttributes.Pop(); // If accessor already in attribute array, remove it if (DTokens.VisModifiers[attr.Token]) { DAttribute.CleanupAccessorAttributes(attributes); } if (attr.IsProperty || !DAttribute.ContainsAttribute(attributes, attr.Token)) { attributes.Add(attr); } } n.Attributes = attributes.Count == 0 ? null : attributes.ToArray(); }
void PushAttribute(DAttribute attr, bool BlockAttributes) { var stk = BlockAttributes?this.BlockAttributes:this.DeclarationAttributes; // If attr would change the accessability of an item, remove all previously found (so the most near attribute that's next to the item is significant) if (DTokens.VisModifiers[attr.Token]) { DAttribute.CleanupAccessorAttributes(stk); } stk.Push(attr); }
void ApplyAttributes(DNode n) { foreach (var attr in BlockAttributes.ToArray()) { n.Attributes.Add(attr); } while (DeclarationAttributes.Count > 0) { var attr = DeclarationAttributes.Pop(); // If accessor already in attribute array, remove it if (DTokens.VisModifiers[attr.Token]) { DAttribute.CleanupAccessorAttributes(n.Attributes); } if (attr.IsProperty || !DAttribute.ContainsAttribute(n.Attributes.ToArray(), attr.Token)) { n.Attributes.Add(attr); } } }