コード例 #1
0
ファイル: InstanceDesign.cs プロジェクト: mpostol/ASMD
        /// <summary>
        /// Adds to address space.
        /// </summary>
        /// <param name="children">The children.</param>
        /// <returns></returns>
        protected void InstanceDeclarations(IInstanceNodesCollection children, IInstanceNodeContext thisInstance)
        {
            //Methods do not have equivalent of type definition reference.
            if (this.NodeClass == NodeClassesEnum.Method)
            {
                return;
            }
            ITypeDesign type = SolutionTreeNode.SolutionRoot.FindType(thisInstance.TypeDefinition);

            if (type == null)
            {
                thisInstance.Assert(false, "Cannot find TypeDefinition for the instance.");
                return;
            }
            type.InstanceDeclarations(children, thisInstance);
        }
コード例 #2
0
ファイル: TypeDesign.cs プロジェクト: lwh125630hui/ASMD
 /// <summary>
 /// Instances the declarations.
 /// </summary>
 /// <param name="childrenCollection">The children collection.</param>
 /// <param name="parent">The parent.</param>
 void ITypeDesign.InstanceDeclarations(IInstanceNodesCollection childrenCollection, IInstanceNodeContext parent)
 {
     m_InheritanceDepth++;
     try
     {
         if (m_InheritanceDepth > m_MaxInheritanceDepth)
         {
             parent.Assert(false, String.Format("The depth of instance declaration is greater than the maximum {0}", m_MaxInheritanceDepth));
             return;
         }
         foreach (IInstanceNode _childItem in this.Children)
         {
             if (!_childItem.IsMandatory)
             {
                 continue;
             }
             childrenCollection.Add(_childItem, parent, parent.NodeID);
         }
         foreach (Reference item in References)
         {
             parent.AddReference(item, this, parent.NodeID);
         }
         XmlQualifiedName myType = this.Wrapper.BaseType.ValueOrDefault;
         ITypeDesign      type   = SolutionTreeNode.SolutionRoot.FindType(myType);
         if (this.Wrapper.IsItRootType)
         {
             return;
         }
         if (type == null)
         {
             parent.Assert(false, "Broken inheritance chain of the base type for this node.");
             return;
         }
         type.InstanceDeclarations(childrenCollection, parent);
     }
     finally
     {
         m_InheritanceDepth--;
     }
 }