Ejemplo n.º 1
0
        /// <summary>
        /// Move an entity from a declarator to another
        /// </summary>
        /// <typeparam name="T">Type of the entity used in declarators</typeparam>
        /// <param name="fromID">Identifier of the declarator that contains the entity</param>
        /// <param name="toID">Identifier of the declarator to which move the entity</param>
        /// <param name="name">Name of the entity to move</param>
        public void Move(UInt32 fromID, UInt32 toID, string name)
        {
            CorePackage.Global.IDeclarator from = GetDeclarator(fromID);
            CorePackage.Global.IDeclarator to   = GetDeclarator(toID);

            CorePackage.Global.AccessMode  visibility = from.GetVisibilityOf(name);
            CorePackage.Global.IDefinition definition = from.Pop(name);
            to.Declare(definition, name, visibility);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Declare an entity into a specific declarator
        /// </summary>
        /// <typeparam name="Entity">Type of the entity to declare</typeparam>
        /// <typeparam name="Declarator">Type used in the declarator</typeparam>
        /// <param name="containerID">Identifier of the declarator in which declare entity</param>
        /// <param name="name">Name of the entity to declare</param>
        /// <param name="visibility">Visibility of the entity to declare</param>
        /// <returns>The identifier of the freshly declared entity</returns>
        public UInt32 Declare <Entity>(UInt32 containerID, string name, CorePackage.Global.AccessMode visibility)
            where Entity : IDefinition
        {
            Entity todecl = Create <Entity>();

            todecl.Name   = name;
            todecl.Parent = GetDeclarator(containerID);
            todecl.Parent.Declare(todecl, name, visibility);
            return(LastID);
        }