예제 #1
0
        public override InheritanceChain GetInheritanceChain(PathInfo typePath)
        {
            //informace o dědičnosti poskytujeme pouze
            //pro náš definovaný typ
            if (typePath.Signature == _declaringType.TypeName)
            {
                //definovaný typ je potomkem typu object
                InheritanceChain baseType = TypeServices.GetChain(TypeDescriptor.ObjectInfo);
                return(TypeServices.CreateChain(_declaringType, new[] { baseType }));
            }

            //dotaz se týkal typu, který nedefinujeme
            return(null);
        }
예제 #2
0
        /// <summary>
        /// Gets inheritance chain for type described by given path.
        /// </summary>
        /// <param name="typePath">The type path.</param>
        /// <returns>InheritanceChain.</returns>
        public override InheritanceChain GetInheritanceChain(PathInfo typePath)
        {
            requireBuilded();

            var descriptor = TypeDescriptor.Create(typePath.Name);

            if (!_knownInheritance.ContainsKey(descriptor))
            {
                //we handle only contained types
                return(null);
            }

            //inheritance according to known definitions
            return(TypeServices.CreateChain(descriptor, new[] { TypeServices.GetChain(_knownInheritance[descriptor]) }));
        }
예제 #3
0
        /// <summary>
        /// Create <see cref="InheritanceChain" /> from given typeNode.
        /// </summary>
        /// <param name="typeNode">Type node which inheritance chain will be created.</param>
        /// <returns>Created <see cref="InheritanceChain" />.</returns>
        private InheritanceChain createInheritanceChain(CodeType typeNode)
        {
            var subChains = new List <InheritanceChain>();

            var baseChains = createInheritanceChains(typeNode.Bases);

            subChains.AddRange(baseChains);

            var classNode = typeNode as CodeClass;

            if (classNode != null)
            {
                var interfaceChains = createInheritanceChains(classNode.ImplementedInterfaces);
                subChains.AddRange(interfaceChains);
            }

            var typeDescriptor = InfoBuilder.CreateDescriptor(typeNode);

            return(TypeServices.CreateChain(typeDescriptor, subChains));
        }