コード例 #1
0
        public void VisitModuleSymbol(ModuleSymbol tr)
        {        /*
                  *     if (isVariableInstance) // WHY?
                  *             return;
                  */
            foreach (var i in tr.Definition)
            {
                var di = i as DNode;
                if (di == null)
                {
                    if (i != null)
                    {
                        CompletionDataGenerator.Add(i);
                    }
                    continue;
                }

                if (di.IsPublic && CanItemBeShownGenerally(i) && AbstractVisitor.CanAddMemberOfType(MemberFilter, i))
                {
                    CompletionDataGenerator.Add(i);
                }
            }
        }
コード例 #2
0
        protected override void BuildCompletionDataInternal(IEditorData Editor, char enteredChar)
        {
            var visibleMembers = MemberFilter.All;

            if (!GetVisibleMemberFilter(Editor, enteredChar, ref visibleMembers, ref curStmt))
            {
                return;
            }

            MemberCompletionEnumeration.EnumAllAvailableMembers(
                CompletionDataGenerator,
                curBlock,
                curStmt,
                Editor.CaretLocation,
                Editor.ParseCache,
                visibleMembers,
                new ConditionalCompilationFlags(Editor));

            //TODO: Split the keywords into such that are allowed within block statements and non-block statements
            // Insert typable keywords
            if (visibleMembers.HasFlag(MemberFilter.Keywords))
            {
                foreach (var kv in DTokens.Keywords)
                {
                    CompletionDataGenerator.Add(kv.Key);
                }
            }

            else if (visibleMembers.HasFlag(MemberFilter.StructsAndUnions))
            {
                foreach (var kv in DTokens.BasicTypes_Array)
                {
                    CompletionDataGenerator.Add(kv);
                }
            }
        }
コード例 #3
0
        protected override void BuildCompletionDataInternal(IEditorData Editor, char enteredChar)
        {
            MemberCompletionEnumeration.EnumAllAvailableMembers(
                CompletionDataGenerator,
                curBlock,
                Editor.CaretLocation,
                Editor.ParseCache,
                visibleMembers,
                new ConditionalCompilationFlags(Editor));

            var bits = new BitArray(DTokens.MaxToken, false);

            CompletionDataGenerator.Add(DTokens.__EOF__);

            // Insert typable keywords
            if ((visibleMembers & MemberFilter.BlockKeywords) != 0)
            {
                for (byte tk = DTokens.MaxToken - 1; tk > 0; tk--)
                {
                    if (!bits [tk] && IsBlockKw(tk))
                    {
                        CompletionDataGenerator.Add(tk);
                        bits [tk] = true;
                    }
                }
            }

            if ((visibleMembers & MemberFilter.StatementBlockKeywords) != 0)
            {
                foreach (var kv in statementKeywords)
                {
                    if (!bits [kv])
                    {
                        CompletionDataGenerator.Add(kv);
                        bits [kv] = true;
                    }
                }
            }

            if ((visibleMembers & MemberFilter.ExpressionKeywords) != 0)
            {
                foreach (var kv in expressionKeywords)
                {
                    if (!bits [kv])
                    {
                        CompletionDataGenerator.Add(kv);
                        bits [kv] = true;
                    }
                }
            }

            if ((visibleMembers & MemberFilter.Labels) != 0)
            {
                var  stmt           = DResolver.SearchStatementDeeplyAt(curBlock, Editor.CaretLocation);
                bool addedSwitchKWs = false;
                while (stmt != null && stmt.Parent != null)
                {
                    stmt = stmt.Parent;
                    if (!addedSwitchKWs && stmt is SwitchStatement)
                    {
                        addedSwitchKWs = true;
                        CompletionDataGenerator.Add(DTokens.Case);
                        CompletionDataGenerator.Add(DTokens.Default);
                    }
                }

                if (stmt != null)
                {
                    stmt.Accept(new LabelVisitor(CompletionDataGenerator));
                }
            }

            if ((visibleMembers & MemberFilter.x86Registers) != 0)
            {
                foreach (var kv in AsmRegisterExpression.x86RegisterTable)
                {
                    CompletionDataGenerator.AddTextItem(kv.Key, kv.Value);
                }
            }

            if ((visibleMembers & MemberFilter.x64Registers) != 0)
            {
                foreach (var kv in AsmRegisterExpression.x64RegisterTable)
                {
                    CompletionDataGenerator.AddTextItem(kv.Key, kv.Value);
                }
            }

            if ((visibleMembers & (MemberFilter.x86Registers | MemberFilter.x64Registers)) != 0)
            {
                CompletionDataGenerator.Add(DTokens.__LOCAL_SIZE);

                CompletionDataGenerator.AddTextItem("offsetof", "");
                CompletionDataGenerator.AddTextItem("seg", "The seg means load the segment number that the symbol is in. This is not relevant for flat model code. Instead, do a move from the relevant segment register.");

                // Provide AsmTypePrefixes
                CompletionDataGenerator.AddTextItem("near", "");
                CompletionDataGenerator.AddTextItem("far", "");
                CompletionDataGenerator.AddTextItem("word", "");
                CompletionDataGenerator.AddTextItem("dword", "");
                CompletionDataGenerator.AddTextItem("qword", "");
                CompletionDataGenerator.AddTextItem("ptr", "");
            }

            if ((visibleMembers & MemberFilter.BuiltInPropertyAttributes) != 0)
            {
                foreach (var propAttr in PropertyAttributeCompletionItems)
                {
                    CompletionDataGenerator.AddPropertyAttribute(propAttr);
                }
            }
        }
コード例 #4
0
        void BuildCompletionData(
            AbstractType rr,
            IBlockNode currentlyScopedBlock,
            bool isVariableInstance   = false,
            AbstractType resultParent = null)
        {
            if (rr == null)
            {
                return;
            }

            if (rr.DeclarationOrExpressionBase is ITypeDeclaration)
            {
                isVariableInstance |= (rr.DeclarationOrExpressionBase as ITypeDeclaration).ExpressesVariableAccess;
            }

            if (rr is ArrayAccessSymbol)
            {
                isVariableInstance = true;
                rr = (rr as ArrayAccessSymbol).Base;
            }

            if (rr is MemberSymbol)
            {
                BuildCompletionData((MemberSymbol)rr, currentlyScopedBlock, isVariableInstance);
            }

            // A module path has been typed
            else if (!isVariableInstance && rr is ModuleSymbol)
            {
                BuildCompletionData((ModuleSymbol)rr);
            }

            else if (rr is PackageSymbol)
            {
                BuildCompletionData((PackageSymbol)rr);
            }

            #region A type was referenced directly
            else if (rr is EnumType)
            {
                var en = (EnumType)rr;

                foreach (var e in en.Definition)
                {
                    CompletionDataGenerator.Add(e);
                }
            }

            else if (rr is TemplateIntermediateType)
            {
                var tr = (TemplateIntermediateType)rr;

                if (tr.DeclarationOrExpressionBase is TokenExpression)
                {
                    int token = ((TokenExpression)tr.DeclarationOrExpressionBase).Token;

                    isVariableInstance = token == DTokens.This || token == DTokens.Super;
                }

                // Cases:

                // myVar. (located in basetype definition)		<-- Show everything
                // this.                                        <-- Show everything
                // myVar. (not located in basetype definition)  <-- Show public and public static members
                // super.                                       <-- Show all base type members
                // myClass. (not located in myClass)			<-- Show all static members
                // myClass. (located in myClass)				<-- Show all static members

                BuildCompletionData(tr, isVariableInstance);
            }
            #endregion

            else if (rr is PointerType)
            {
                var pt = (PointerType)rr;
                if (!(pt.Base is PrimitiveType && pt.Base.DeclarationOrExpressionBase is PointerDecl))
                {
                    BuildCompletionData(pt.Base, currentlyScopedBlock, true, pt);
                }
            }

            else
            {
                StaticProperties.ListProperties(CompletionDataGenerator, MemberFilter, rr, isVariableInstance);
            }
        }
コード例 #5
0
        protected override void BuildCompletionDataInternal(IEditorData Editor, char enteredChar)
        {
            MemberCompletionEnumeration.EnumAllAvailableMembers(
                CompletionDataGenerator,
                curBlock,
                curStmt,
                Editor.CaretLocation,
                Editor.ParseCache,
                visibleMembers,
                new ConditionalCompilationFlags(Editor));

            //TODO: Split the keywords into such that are allowed within block statements and non-block statements
            // Insert typable keywords
            if ((visibleMembers & MemberFilter.Keywords) != 0)
            {
                foreach (var kv in DTokens.Keywords)
                {
                    CompletionDataGenerator.Add(kv.Key);
                }
            }
            else if ((visibleMembers & MemberFilter.StructsAndUnions) != 0)
            {
                foreach (var kv in DTokens.BasicTypes_Array)
                {
                    CompletionDataGenerator.Add(kv);
                }
            }

            if ((visibleMembers & MemberFilter.Labels) != 0)
            {
                IStatement stmt = curStmt;
                do
                {
                    stmt = stmt.Parent;
                    if (stmt is SwitchStatement)
                    {
                        CompletionDataGenerator.Add(DTokens.Case);
                        CompletionDataGenerator.Add(DTokens.Default);
                        break;
                    }
                } while(stmt != null && stmt.Parent != null);

                if (stmt != null)
                {
                    stmt.Accept(new LabelVisitor(CompletionDataGenerator));
                }
            }

            if ((visibleMembers & MemberFilter.x86Registers) != 0)
            {
                foreach (var kv in AsmRegisterExpression.x86RegisterTable)
                {
                    CompletionDataGenerator.AddTextItem(kv.Key, kv.Value);
                }
            }

            if ((visibleMembers & MemberFilter.x64Registers) != 0)
            {
                foreach (var kv in AsmRegisterExpression.x64RegisterTable)
                {
                    CompletionDataGenerator.AddTextItem(kv.Key, kv.Value);
                }
            }

            if ((visibleMembers & (MemberFilter.x86Registers | MemberFilter.x64Registers)) != 0)
            {
                CompletionDataGenerator.Add(DTokens.__LOCAL_SIZE);

                CompletionDataGenerator.AddTextItem("offsetof", "");
                CompletionDataGenerator.AddTextItem("seg", "The seg means load the segment number that the symbol is in. This is not relevant for flat model code. Instead, do a move from the relevant segment register.");

                // Provide AsmTypePrefixes
                CompletionDataGenerator.AddTextItem("near", "");
                CompletionDataGenerator.AddTextItem("far", "");
                CompletionDataGenerator.AddTextItem("word", "");
                CompletionDataGenerator.AddTextItem("dword", "");
                CompletionDataGenerator.AddTextItem("qword", "");
                CompletionDataGenerator.AddTextItem("ptr", "");
            }

            if ((visibleMembers & MemberFilter.BuiltInPropertyAttributes) != 0)
            {
                foreach (var propAttr in PropertyAttributeCompletionItems)
                {
                    CompletionDataGenerator.AddPropertyAttribute(propAttr);
                }
            }
        }
コード例 #6
0
        protected override void BuildCompletionDataInternal(IEditorData Editor, string EnteredText)
        {
            IEnumerable <INode> listedItems = null;
            var visibleMembers = MemberFilter.All;

            IStatement curStmt = null;

            if (curBlock == null)
            {
                curBlock = D_Parser.Resolver.TypeResolution.DResolver.SearchBlockAt(Editor.SyntaxTree, Editor.CaretLocation, out curStmt);
            }

            if (curBlock == null)
            {
                return;
            }

            // 1) Get current context the caret is at
            if (parsedBlock == null)
            {
                parsedBlock = FindCurrentCaretContext(
                    Editor.ModuleCode,
                    curBlock,
                    Editor.CaretOffset,
                    Editor.CaretLocation,
                    out trackVars);
            }

            // 2) If in declaration and if node identifier is expected, do not show any data
            if (trackVars == null)
            {
                // --> Happens if no actual declaration syntax given --> Show types/imports/keywords anyway
                visibleMembers = MemberFilter.Imports | MemberFilter.Types | MemberFilter.Keywords;

                listedItems = ItemEnumeration.EnumAllAvailableMembers(curBlock, null, Editor.CaretLocation, Editor.ParseCache, visibleMembers);
            }
            else
            {
                var n  = trackVars.LastParsedObject as INode;
                var dv = n as DVariable;
                if (dv != null && dv.IsAlias && dv.Type == null && trackVars.ExpectingIdentifier)
                {
                    // Show completion because no aliased type has been entered yet
                }
                else if (n != null && string.IsNullOrEmpty(n.Name) && trackVars.ExpectingIdentifier)
                {
                    return;
                }

                else if (trackVars.LastParsedObject is TokenExpression &&
                         DTokens.BasicTypes[(trackVars.LastParsedObject as TokenExpression).Token] &&
                         !string.IsNullOrEmpty(EnteredText) &&
                         IsIdentifierChar(EnteredText[0]))
                {
                    return;
                }

                if (trackVars.LastParsedObject is DAttribute)
                {
                    var attr = trackVars.LastParsedObject as DAttribute;

                    if (attr.IsStorageClass && attr.Token != DTokens.Abstract)
                    {
                        return;
                    }
                }

                if (trackVars.LastParsedObject is ImportStatement)
                {
                    visibleMembers = MemberFilter.Imports;
                }
                else if ((trackVars.LastParsedObject is NewExpression && trackVars.IsParsingInitializer) ||
                         trackVars.LastParsedObject is TemplateInstanceExpression && ((TemplateInstanceExpression)trackVars.LastParsedObject).Arguments == null)
                {
                    visibleMembers = MemberFilter.Imports | MemberFilter.Types;
                }
                else if (EnteredText == " ")
                {
                    return;
                }
                // In class bodies, do not show variables
                else if (!(parsedBlock is BlockStatement || trackVars.IsParsingInitializer))
                {
                    visibleMembers = MemberFilter.Imports | MemberFilter.Types | MemberFilter.Keywords;
                }

                /*
                 * Handle module-scoped things:
                 * When typing a dot without anything following, trigger completion and show types, methods and vars that are located in the module & import scope
                 */
                else if (trackVars.LastParsedObject is TokenExpression &&
                         ((TokenExpression)trackVars.LastParsedObject).Token == DTokens.Dot)
                {
                    visibleMembers = MemberFilter.Methods | MemberFilter.Types | MemberFilter.Variables;
                    curBlock       = Editor.SyntaxTree;
                    curStmt        = null;
                }

                // In a method, parse from the method's start until the actual caret position to get an updated insight
                if (visibleMembers.HasFlag(MemberFilter.Variables) &&
                    curBlock is DMethod &&
                    parsedBlock is BlockStatement)
                {
                    var bs = parsedBlock as BlockStatement;

                    // Insert the updated locals insight.
                    // Do not take the caret location anymore because of the limited parsing of our code.
                    curStmt = bs.SearchStatementDeeply(bs.EndLocation);
                }
                else
                {
                    curStmt = null;
                }



                if (visibleMembers != MemberFilter.Imports)                 // Do not pass the curStmt because we already inserted all updated locals a few lines before!
                {
                    listedItems = ItemEnumeration.EnumAllAvailableMembers(curBlock, curStmt, Editor.CaretLocation, Editor.ParseCache, visibleMembers);
                }
            }

            // Add all found items to the referenced list
            if (listedItems != null)
            {
                foreach (var i in listedItems)
                {
                    if (i is IAbstractSyntaxTree)                     // Modules and stuff will be added later on
                    {
                        continue;
                    }

                    if (CanItemBeShownGenerally(i))
                    {
                        CompletionDataGenerator.Add(i);
                    }
                }
            }

            //TODO: Split the keywords into such that are allowed within block statements and non-block statements
            // Insert typable keywords
            if (visibleMembers.HasFlag(MemberFilter.Keywords))
            {
                foreach (var kv in DTokens.Keywords)
                {
                    CompletionDataGenerator.Add(kv.Key);
                }
            }

            else if (visibleMembers.HasFlag(MemberFilter.Types))
            {
                foreach (var kv in DTokens.BasicTypes_Array)
                {
                    CompletionDataGenerator.Add(kv);
                }
            }

            #region Add module name stubs of importable modules
            if (visibleMembers.HasFlag(MemberFilter.Imports))
            {
                var nameStubs    = new Dictionary <string, string>();
                var availModules = new List <IAbstractSyntaxTree>();

                foreach (var sstmt in Editor.SyntaxTree.StaticStatements)
                {
                    if (sstmt is ImportStatement)
                    {
                        var impStmt = (ImportStatement)sstmt;

                        foreach (var imp in impStmt.Imports)
                        {
                            if (string.IsNullOrEmpty(imp.ModuleAlias))
                            {
                                var id = imp.ModuleIdentifier.ToString();

                                IAbstractSyntaxTree mod = null;
                                foreach (var m in Editor.ParseCache.LookupModuleName(id))
                                {
                                    mod = m;
                                    break;
                                }

                                if (mod == null || string.IsNullOrEmpty(mod.ModuleName))
                                {
                                    continue;
                                }

                                var stub = imp.ModuleIdentifier.InnerMost.ToString();

                                if (!nameStubs.ContainsKey(stub) && !availModules.Contains(mod))
                                {
                                    if (stub == mod.ModuleName)
                                    {
                                        availModules.Add(mod);
                                    }
                                    else
                                    {
                                        nameStubs.Add(stub, GetModulePath(mod.FileName, id.Split('.').Length, 1));
                                    }
                                }
                            }
                        }
                    }
                }

                foreach (var kv in nameStubs)
                {
                    CompletionDataGenerator.Add(kv.Key, null, kv.Value);
                }

                foreach (var mod in availModules)
                {
                    CompletionDataGenerator.Add(mod.ModuleName, mod);
                }
            }
            #endregion
        }
コード例 #7
0
        void BuildCompletionData(
            AbstractType rr,
            IBlockNode currentlyScopedBlock,
            bool isVariableInstance   = false,
            AbstractType resultParent = null)
        {
            if (rr == null)
            {
                return;
            }

            if (rr.DeclarationOrExpressionBase is ITypeDeclaration)
            {
                isVariableInstance |= (rr.DeclarationOrExpressionBase as ITypeDeclaration).ExpressesVariableAccess;
            }

            if (rr is MemberSymbol)
            {
                BuildCompletionData((MemberSymbol)rr, currentlyScopedBlock, isVariableInstance);
            }

            // A module path has been typed
            else if (!isVariableInstance && rr is ModuleSymbol)
            {
                BuildCompletionData((ModuleSymbol)rr);
            }

            else if (rr is PackageSymbol)
            {
                BuildCompletionData((PackageSymbol)rr);
            }

            #region A type was referenced directly
            else if (rr is EnumType)
            {
                var en = (EnumType)rr;

                foreach (var e in en.Definition)
                {
                    CompletionDataGenerator.Add(e);
                }
            }

            else if (rr is TemplateIntermediateType)
            {
                var tr  = (TemplateIntermediateType)rr;
                var vis = ItemVisibility.All;

                bool HasSameAncestor = HaveSameAncestors(currentlyScopedBlock, tr.Definition);
                bool IsThis = false, IsSuper = false;

                if (tr.DeclarationOrExpressionBase is TokenExpression)
                {
                    int token = ((TokenExpression)tr.DeclarationOrExpressionBase).Token;
                    IsThis  = token == DTokens.This;
                    IsSuper = token == DTokens.Super;
                }

                // Cases:

                // myVar. (located in basetype definition)		<-- Show everything
                // this.                                        <-- Show everything
                if (IsThis || (isVariableInstance && HasSameAncestor))
                {
                    vis = ItemVisibility.All;
                }

                // myVar. (not located in basetype definition)  <-- Show public and public static members
                else if (isVariableInstance && !HasSameAncestor)
                {
                    vis = ItemVisibility.PublicMembers | ItemVisibility.PublicStaticMembers;
                }

                // super.                                       <-- Show protected|public or protected|public static base type members
                else if (IsSuper)
                {
                    vis = ItemVisibility.ProtectedMembers | ItemVisibility.PublicMembers | ItemVisibility.PublicStaticMembers;
                }

                // myClass. (not located in myClass)			<-- Show public static members
                else if (!isVariableInstance && !HasSameAncestor)
                {
                    vis = ItemVisibility.PublicStaticMembers;
                }

                // myClass. (located in myClass)				<-- Show all static members
                else if (!isVariableInstance && HasSameAncestor)
                {
                    vis = ItemVisibility.StaticMembers;
                }

                BuildCompletionData(tr, vis);

                if (resultParent == null)
                {
                    StaticTypePropertyProvider.AddGenericProperties(rr, CompletionDataGenerator, tr.Definition);
                }

                StaticTypePropertyProvider.AddClassTypeProperties(CompletionDataGenerator, tr.Definition);
            }
            #endregion

            #region Things like int. or char.
            else if (rr is PrimitiveType)
            {
                var primType = (PrimitiveType)rr;

                if (resultParent == null)
                {
                    StaticTypePropertyProvider.AddGenericProperties(rr, CompletionDataGenerator, null);
                }

                if (primType.TypeToken > 0)
                {
                    // Determine whether float by the var's base type
                    bool isFloat = DTokens.BasicTypes_FloatingPoint[primType.TypeToken];

                    // Float implies integral props
                    if (DTokens.BasicTypes_Integral[primType.TypeToken] || isFloat)
                    {
                        StaticTypePropertyProvider.AddIntegralTypeProperties(primType.TypeToken, rr, CompletionDataGenerator, null, isFloat);
                    }

                    if (isFloat)
                    {
                        StaticTypePropertyProvider.AddFloatingTypeProperties(primType.TypeToken, rr, CompletionDataGenerator, null);
                    }
                }
            }
            #endregion

            else if (rr is PointerType)
            {
                var pt = (PointerType)rr;
                if (!(pt.Base is PrimitiveType && pt.Base.DeclarationOrExpressionBase is PointerDecl))
                {
                    BuildCompletionData(pt.Base, currentlyScopedBlock, true, pt);
                }
            }

            else if (rr is AssocArrayType)
            {
                var ar = (AssocArrayType)rr;

                if (ar is ArrayType)
                {
                    StaticTypePropertyProvider.AddArrayProperties(rr, CompletionDataGenerator, ar.DeclarationOrExpressionBase as ArrayDecl);
                }
                else
                {
                    StaticTypePropertyProvider.AddAssocArrayProperties(rr, CompletionDataGenerator, ar.DeclarationOrExpressionBase as ArrayDecl);
                }
            }
        }
コード例 #8
0
        void BuildCompletionData(UserDefinedType tr, ItemVisibility visMod)
        {
            var n = tr.Definition;

            if (n is DClassLike)             // Add public static members of the class and including all base classes
            {
                var propertyMethodsToIgnore = new List <string>();

                var curlevel = tr;
                var tvisMod  = visMod;
                while (curlevel != null)
                {
                    foreach (var i in curlevel.Definition as DBlockNode)
                    {
                        var dn = i as DNode;

                        if (i != null && dn == null)
                        {
                            CompletionDataGenerator.Add(i);
                            continue;
                        }

                        bool add = false;

                        if (tvisMod.HasFlag(ItemVisibility.All))
                        {
                            add = true;
                        }
                        else
                        {
                            if (tvisMod.HasFlag(ItemVisibility.ProtectedMembers))
                            {
                                add |= dn.ContainsAttribute(DTokens.Protected);
                            }
                            if (tvisMod.HasFlag(ItemVisibility.ProtectedStaticMembers))
                            {
                                add |= dn.ContainsAttribute(DTokens.Protected) && (dn.IsStatic || IsTypeNode(i));
                            }
                            if (tvisMod.HasFlag(ItemVisibility.PublicMembers))
                            {
                                add |= dn.IsPublic;
                            }
                            if (tvisMod.HasFlag(ItemVisibility.PublicStaticMembers))
                            {
                                add |= dn.IsPublic && (dn.IsStatic || IsTypeNode(i));
                            }
                            if (tvisMod.HasFlag(ItemVisibility.StaticMembers))
                            {
                                add |= dn.IsStatic || IsTypeNode(i);
                            }
                        }

                        if (add)
                        {
                            if (CanItemBeShownGenerally(dn))
                            {
                                // Convert @property getters&setters to one unique property
                                if (dn is DMethod && dn.ContainsPropertyAttribute())
                                {
                                    if (!propertyMethodsToIgnore.Contains(dn.Name))
                                    {
                                        var  dm       = dn as DMethod;
                                        bool isGetter = dm.Parameters.Count < 1;

                                        var virtPropNode = new DVariable();

                                        virtPropNode.AssignFrom(dn);

                                        if (!isGetter)
                                        {
                                            virtPropNode.Type = dm.Parameters[0].Type;
                                        }

                                        CompletionDataGenerator.Add(virtPropNode);

                                        propertyMethodsToIgnore.Add(dn.Name);
                                    }
                                }
                                else
                                {
                                    CompletionDataGenerator.Add(dn);
                                }
                            }

                            // Add members of anonymous enums
                            else if (dn is DEnum && string.IsNullOrEmpty(dn.Name))
                            {
                                foreach (var k in dn as DEnum)
                                {
                                    CompletionDataGenerator.Add(k);
                                }
                            }
                        }
                    }
                    curlevel = curlevel.Base as UserDefinedType;

                    // After having shown all items on the current node level,
                    // allow showing public (static) and/or protected items in the more basic levels then
                    if (tvisMod.HasFlag(ItemVisibility.All))
                    {
                        if ((n as DClassLike).ContainsAttribute(DTokens.Static))
                        {
                            tvisMod = ItemVisibility.ProtectedStaticMembers | ItemVisibility.PublicStaticMembers;
                        }
                        else
                        {
                            tvisMod = ItemVisibility.ProtectedMembers | ItemVisibility.PublicMembers;
                        }
                    }
                }
            }
            else if (n is DEnum)
            {
                var de = n as DEnum;

                foreach (var i in de)
                {
                    if (i is DEnumValue)
                    {
                        CompletionDataGenerator.Add(i);
                    }
                }
            }
        }