Exemplo n.º 1
0
        /// <summary>
        /// Allow user to add an attribute with a name, a type and a visibility
        /// </summary>
        /// <param name="name">Name of the attribute to add</param>
        /// <param name="attrType">Type of the attribute to add</param>
        /// <param name="visibility">Visibility of the attribute (INTERNAL, EXTERNAL)</param>
        public void AddAttribute(string name, DataType attrType, Global.AccessMode visibility)
        {
            if (attrType == this)
            {
                throw new InvalidOperationException("Cannot set an attribute of the same type");
            }

            ObjectType atType = attrType as ObjectType;

            if (atType != null && atType.HasAttributeOfType(this, true))
            {
                throw new InvalidOperationException("Circular reference detected: cannot add an attribute of type " + attrType.Name + " in " + Name);
            }

            attributes.Declare(attrType, name, visibility);
        }
Exemplo n.º 2
0
 ///<see cref="IDeclarator{definitionType}.Declare(definitionType, string, AccessMode)"/>
 public IDefinition Declare(IDefinition entity, string name, AccessMode visibility)
 {
     return(scope.Declare(entity, name, visibility));
 }