コード例 #1
0
 void Build(ILItem parent, Block block)
 {
     parent.AddChild(new BlockItem(block));
     foreach (var it in block.NestedBlocks)
     {
         Build(parent, it);
     }
 }
コード例 #2
0
        void Build(ILItem parent, DataType dt)
        {
            var item = AddType(parent, dt);

            foreach (var it in item.Type.NestedTypes)
            {
                Build(parent, it);
            }
            if (item.Type.Block != null)
            {
                foreach (var it in item.Type.Block.NestedBlocks)
                {
                    Build(parent, it);
                }
            }
        }
コード例 #3
0
        static TypeItem AddType(ILItem root, DataType dt)
        {
            var item = new TypeItem(dt);

            if (dt.IsGenericDefinition && dt.GenericParameterizations.Count > 0)
            {
                var ptItems = new ParameterizationCollection(dt.GenericParameterizations);

                for (int i = 0; i < ptItems.Children.Count; i++)
                {
                    var ptRoot = ptItems.Children[i] as TypeItem;

                    if (ptRoot != null)
                    {
                        var pt = (DataType)ptRoot.Object;

                        if (pt.IsParameterizedDefinition)
                        {
                            ptItems.Children.RemoveAt(i);
                            ptRoot.AddChild(new DefinitionCollection(dt));
                            ptRoot.AddChild(ptItems);
                            item = ptRoot;
                            break;
                        }
                    }
                }
            }

            foreach (var c in root.Children)
            {
                var t = c as TypeItem;
                if (t != null &&
                    t.Type.Parent == item.Type.Parent &&
                    t.Type.Name == item.Type.Name)
                {
                    t.Overloads.AddChild(item);
                    return(item);
                }
            }

            root.AddChild(item);
            return(item);
        }