private bool GetValue <T>(MessageContext ctxt, CCI.AttributeList attributes, CCI.TypeNode attrType, IProperty <T> property, ref T value) { var found = 0; foreach (var attribute in attributes) { if (IsAttribute(attribute, attrType)) { var thisValue = default(T); if (GetValue(ctxt, attribute, attrType, property, ref thisValue)) { if (found++ == 0) { value = thisValue; } else { if (!thisValue.Equals(value)) { env.Log(new InvalidInteropMessage (RewriterMsgContext.AttributeProperty(ctxt, attribute, property.Name), "duplicate inconsistent bindings")); throw new DefinitionException(); } } } } } return(found > 0); }
public bool HasAttribute(CCI.AttributeList attributes, CCI.TypeNode attrType) { foreach (var attr in attributes) { if (IsAttribute(attr, attrType)) { return(true); } } return(false); }