Exemplo n.º 1
0
 public static bool FieldIsElementsPeer(Field f)
 {
     if (f == null) return false;
     return f.GetAttribute(SystemTypes.ElementsPeerAttribute) != null;
 }
Exemplo n.º 2
0
 public static bool FieldIsAdditive(Field field) {
   if (field == null) return false;
   AttributeNode attr = field.GetAttribute(SystemTypes.AdditiveAttribute);
   if (attr == null) return false;
   ExpressionList exprs = attr.Expressions;
   if (exprs == null || exprs.Count != 1) return true;
   Literal lit = exprs[0] as Literal;
   if (lit != null && (lit.Value is bool)) return (bool)lit.Value;
   else return false;
 }
Exemplo n.º 3
0
    public override Field VisitField(Field field) {
      Field retVal = base.VisitField(field);
      AttributeNode attrNode = field.GetAttribute(SystemTypes.AdditiveAttribute);
      bool isAdditive = IsAdditive(attrNode);
      if (isAdditive && attrNode != null) {
        if (field.IsPrivate) {
          this.HandleError(attrNode, Error.AttributeNotAllowedOnPrivateMember, this.GetTypeName(attrNode.Type));
        }
      }
      #region Can't have both [Rep] and [Additive] (or Rep's owned synonyms)
      if (MemberIsRep(field) && isAdditive) {
        this.HandleError(field, Error.ConflictingAttributes, this.GetTypeName(SystemTypes.RepAttribute),
          this.GetTypeName(SystemTypes.AdditiveAttribute));
      }
      #endregion

      return retVal;
    }