Пример #1
0
        public void ResolveBaseTypes(HierarchyIndex typeIndex)
        {
            if (DoNotAddBaseTypes || baseTypes != null)
            {
                return;
            }

            if (typeIndex == null)
            {
                throw new ArgumentNullException(nameof(typeIndex));
            }

            if (baseTypeNames != null && baseTypeNames.Count > 0)
            {
                string kindHint = HierarchyIndex.TypeToPrefix <HierarchyInterface> ();
                foreach (string typeName in baseTypeNames)
                {
                    HierarchyElement e = typeIndex.Lookup(typeName, kindHint, this);
                }
            }

            AddBaseTypes(typeIndex);

            if (baseTypes == null)
            {
                AddDefaultBaseType(typeIndex);
            }
        }
Пример #2
0
 protected virtual void AddBaseTypes(HierarchyIndex typeIndex)
 {
     if (typeIndex == null)
     {
         throw new ArgumentNullException(nameof(typeIndex));
     }
 }
Пример #3
0
        protected override void AddBaseTypes(HierarchyIndex typeIndex)
        {
            base.AddBaseTypes(typeIndex);

            if (String.IsNullOrEmpty(Extends))
            {
                return;
            }

            AddBaseType(Extends);
        }
Пример #4
0
        void AddDefaultBaseType(HierarchyIndex typeIndex)
        {
            string typeName = null;
            string kindHint = null;

            if (this is HierarchyInterface)
            {
                typeName = Hierarchy.DefaultInterfaceBaseType;
                kindHint = HierarchyIndex.TypeToPrefix <HierarchyInterface> ();
            }
            else if (this is HierarchyClass)
            {
                typeName = Hierarchy.DefaultClassBaseType;
                kindHint = HierarchyIndex.TypeToPrefix <HierarchyClass> ();
            }
            else
            {
                throw new InvalidOperationException($"Unsupported hierarchy type {GetType ()}");
            }

            AddBaseType(typeName);
        }