Ejemplo n.º 1
0
        public override void Visit(DTokenDeclaration td)
        {
            if (td.Token == DTokens.Incomplete)
            {
                if (handlesBaseClasses)
                {
                    MemberFilter vis;
                    if (handledClass.ClassType == DTokens.Interface)
                    {
                        vis = MemberFilter.Interfaces | MemberFilter.Templates;
                    }
                    else
                    {
                        vis = MemberFilter.Classes | MemberFilter.Interfaces | MemberFilter.Templates;
                    }

                    prv = new CtrlSpaceCompletionProvider(cdgen, handledClass, vis | MemberFilter.BlockKeywords);
                }
                else if (td.InnerDeclaration != null)
                {
                    prv = new MemberCompletionProvider(cdgen, td.InnerDeclaration, scopedBlock);
                }
                else
                {
                    prv = new CtrlSpaceCompletionProvider(cdgen, scopedBlock, ShownKeywords);
                }

                halt = true;
            }
            else
            {
                base.Visit(td);
            }
        }
Ejemplo n.º 2
0
 public override void Visit(DebugSpecification s)
 {
     if (s.SpecifiedId == DTokens.IncompleteId)
     {
         prv  = new DebugSpecificationCompletionProvider(cdgen);
         halt = true;
     }
 }
Ejemplo n.º 3
0
 public override void Visit(TraitsExpression x)
 {
     if (x.Keyword == DTokens.IncompleteId)
     {
         prv  = new TraitsExpressionCompletionProvider(cdgen);
         halt = true;
     }
     else
     {
         base.Visit(x);
     }
 }
Ejemplo n.º 4
0
 public override void Visit(NewExpression x)
 {
     if (IsIncompleteDeclaration(x.Type))
     {
         halt = true;
         prv  = new CtrlSpaceCompletionProvider(cdgen, scopedBlock, MemberFilter.Types | MemberFilter.TypeParameters);
     }
     else
     {
         base.Visit(x);
     }
 }
Ejemplo n.º 5
0
 public override void Visit(ScopeGuardStatement s)
 {
     if (s.GuardedScope == DTokens.IncompleteId)
     {
         prv  = new ScopeAttributeCompletionProvider(cdgen);
         halt = true;
     }
     else
     {
         base.Visit(s);
     }
 }
Ejemplo n.º 6
0
 public override void VisitAttribute(DebugCondition c)
 {
     if (c.DebugIdHash == DTokens.IncompleteIdHash)
     {
         halt = true;
         prv  = new DebugSpecificationCompletionProvider(cdgen);
     }
     else
     {
         base.VisitAttribute(c);
     }
 }
Ejemplo n.º 7
0
 public override void Visit(ModuleStatement s)
 {
     if (IsIncompleteDeclaration(s.ModuleName))
     {
         prv  = new ModuleStatementCompletionProvider(cdgen);
         halt = true;
     }
     else
     {
         base.Visit(s);
     }
 }
Ejemplo n.º 8
0
 public override void VisitAttribute(VersionCondition vis)
 {
     if (vis.VersionIdHash == DTokens.IncompleteIdHash)
     {
         halt = true;
         prv  = new VersionSpecificationCompletionProvider(cdgen);
     }
     else
     {
         base.VisitAttribute(vis);
     }
 }
Ejemplo n.º 9
0
        public override void Visit(ContinueStatement s)
        {
            if (s.IdentifierHash == DTokens.IncompleteIdHash)
            {
                prv = new CtrlSpaceCompletionProvider(cdgen, scopedBlock, MemberFilter.Labels);

                halt = true;
            }
            else
            {
                base.Visit(s);
            }
        }
Ejemplo n.º 10
0
 public override void VisitImport(ImportStatement.Import i)
 {
     if (IsIncompleteDeclaration(i.ModuleIdentifier))
     {
         prv  = new ImportStatementCompletionProvider(cdgen, i);
         halt = true;
     }
     else
     {
         curImport = i;
         base.VisitImport(i);
     }
 }
Ejemplo n.º 11
0
 public override void Visit(AsmStatement.InstructionStatement s)
 {
     if (s.Operation == AsmStatement.InstructionStatement.OpCode.__UNKNOWN__)
     {
         prv             = new InlineAsmCompletionProvider(s, cdgen);
         scopedStatement = s;
         halt            = true;
     }
     else
     {
         base.Visit(s);
     }
 }
Ejemplo n.º 12
0
 public override void VisitAttribute(PragmaAttribute a)
 {
     if (a.Arguments != null &&
         a.Arguments.Length > 0 &&
         IsIncompleteExpression(a.Arguments[a.Arguments.Length - 1]))
     {
         prv  = new PragmaCompletionProvider(a, cdgen);
         halt = true;
     }
     else
     {
         base.VisitAttribute(a);
     }
 }
Ejemplo n.º 13
0
        public override void VisitAttribute(Modifier a)
        {
            string c;

            if (a.ContentHash == DTokens.IncompleteIdHash || ((c = a.LiteralContent as string) != null && c.EndsWith(DTokens.IncompleteId)))
            {
                prv  = new AttributeCompletionProvider(a, cdgen);
                halt = true;
            }
            else
            {
                base.VisitAttribute(a);
            }
        }
Ejemplo n.º 14
0
 public override void VisitImport(ImportStatement.ImportBinding i)
 {
     if (!halt)
     {
         if (IsIncompleteDeclaration(i.Symbol))
         {
             prv  = new SelectiveImportCompletionProvider(cdgen, curImport);
             halt = true;
         }
         else
         {
             base.VisitImport(i);
         }
     }
 }
Ejemplo n.º 15
0
        public override void Visit(GotoStatement s)
        {
            if (s.StmtType == GotoStatement.GotoStmtType.Identifier &&
                s.LabelIdentifierHash == DTokens.IncompleteIdHash)
            {
                prv = new CtrlSpaceCompletionProvider(cdgen, scopedBlock, s, MemberFilter.Labels);

                scopedStatement = s;
                halt            = true;
            }
            else
            {
                base.Visit(s);
            }
        }
Ejemplo n.º 16
0
 public override void VisitAttribute(UserDeclarationAttribute a)
 {
     if (a.AttributeExpression != null &&
         a.AttributeExpression.Length > 0 &&
         IsIncompleteExpression(a.AttributeExpression[0]))
     {
         prv = new CtrlSpaceCompletionProvider(cdgen, scopedBlock,
                                               MemberFilter.BuiltInPropertyAttributes | MemberFilter.Methods | MemberFilter.Variables | MemberFilter.Types);
         halt = true;
     }
     else
     {
         base.VisitAttribute(a);
     }
 }
Ejemplo n.º 17
0
 public override void Visit(IdentifierDeclaration td)
 {
     if (td.IdHash == DTokens.IncompleteIdHash)
     {
         halt = true;
         if (td.InnerDeclaration != null)
         {
             prv = new MemberCompletionProvider(cdgen, td.InnerDeclaration, scopedBlock);
         }
     }
     else
     {
         base.Visit(td);
     }
 }
Ejemplo n.º 18
0
        public override void Visit(StructInitializer init)
        {
            if (initializedNode != null && init.MemberInitializers != null && init.MemberInitializers.Length != 0)
            {
                var lastMemberInit = init.MemberInitializers[init.MemberInitializers.Length - 1];
                if (lastMemberInit.MemberNameHash == DTokens.IncompleteIdHash)
                {
                    prv  = new StructInitializerCompletion(cdgen, initializedNode, init);
                    halt = true;
                    return;
                }
            }

            base.Visit(init);
        }
Ejemplo n.º 19
0
 public override void VisitDNode(DNode n)
 {
     if (n.NameHash == DTokens.IncompleteIdHash)
     {
         if (n.ContainsAttribute(DTokens.Override))
         {
             prv = new MethodOverrideCompletionProvider(n, cdgen);
         }
         else
         {
             explicitlyNoCompletion = true;
         }
         halt = true;
     }
     else
     {
         base.VisitDNode(n);
     }
 }
Ejemplo n.º 20
0
        public override void Visit(DVariable n)
        {
            if (n.NameHash == 0 && n.ContainsAttribute(DTokens.Override))
            {
                prv  = new MethodOverrideCompletionProvider(n, cdgen);
                halt = true;
                return;
            }

            if (n.IsAlias)
            {
                // alias |
                // alias id = |
                // NOT alias Type |
                if (IsIncompleteDeclaration(n.Type))
                {
                    prv  = new CtrlSpaceCompletionProvider(cdgen, scopedBlock, MemberFilter.All | MemberFilter.BlockKeywords);
                    halt = true;
                    return;
                }
            }
            else if (n.Initializer != null)
            {
                initializedNode    = n;
                handlesInitializer = true;
                n.Initializer.Accept(this);
                handlesInitializer = false;
            }

            if (!halt)
            {
                VisitDNode(n);
            }

            // auto |
            if (!halt && n.NameHash == 0 &&
                (n.ContainsAttribute(DTokens.Auto) || DParser.ContainsStorageClass(n.Attributes) != Modifier.Empty))
            {
                halt = true;
                explicitlyNoCompletion = true;
            }
        }
Ejemplo n.º 21
0
 public override void Visit(IsExpression x)
 {
     // is(Type |
     if (x.TypeAliasIdentifierHash == DTokens.IncompleteIdHash &&
         x.TestedType != null &&
         !IsIncompleteDeclaration(x.TestedType))
     {
         halt = true;
         explicitlyNoCompletion = true;
     }
     else if (x.TypeSpecializationToken == DTokens.Incomplete)
     {
         prv  = new CtrlSpaceCompletionProvider(cdgen, scopedBlock, MemberFilter.Types | MemberFilter.ExpressionKeywords | MemberFilter.StatementBlockKeywords);
         halt = true;
     }
     else
     {
         base.Visit(x);
     }
 }
Ejemplo n.º 22
0
 public override void Visit(TokenExpression e)
 {
     if (e.Token == DTokens.Incomplete)
     {
         halt = true;
         const MemberFilter BaseAsmFlags = MemberFilter.Classes | MemberFilter.StructsAndUnions | MemberFilter.Enums | MemberFilter.Methods | MemberFilter.TypeParameters | MemberFilter.Types | MemberFilter.Variables;
         if (scopedStatement is AsmStatement || scopedStatement is AsmStatement.InstructionStatement)
         {
             prv = new CtrlSpaceCompletionProvider(cdgen, scopedBlock, BaseAsmFlags | MemberFilter.x86Registers | MemberFilter.x64Registers | MemberFilter.Labels);
         }
         else if (scopedStatement is AsmStatement.RawDataStatement)
         {
             prv = new CtrlSpaceCompletionProvider(cdgen, scopedBlock, BaseAsmFlags | MemberFilter.Labels);
         }
         else /*if (handlesInitializer)*/                 // Why only in initializers?
         {
             prv = new CtrlSpaceCompletionProvider(cdgen, scopedBlock, shownKeywords.Count == 0 ? MemberFilter.All | MemberFilter.ExpressionKeywords : shownKeywords.Peek());
         }
     }
 }
Ejemplo n.º 23
0
 public override void Visit(PostfixExpression_Access x)
 {
     if (IsIncompleteExpression(x.AccessExpression))
     {
         halt = true;
         if (x.PostfixForeExpression is TokenExpression && (x.PostfixForeExpression as TokenExpression).Token == DTokens.Dot)
         {
             // 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
             prv = new CtrlSpaceCompletionProvider(cdgen, scopedBlock, MemberFilter.Methods | MemberFilter.Types | MemberFilter.Variables | MemberFilter.TypeParameters);
         }
         else
         {
             prv = new MemberCompletionProvider(cdgen, x.PostfixForeExpression, scopedBlock);
         }
     }
     else
     {
         base.Visit(x);
     }
 }
Ejemplo n.º 24
0
        public override void Visit(DVariable n)
        {
            if (n.NameHash == 0 && n.ContainsAttribute(DTokens.Override))
            {
                prv  = new MethodOverrideCompletionProvider(n, cdgen);
                halt = true;
                return;
            }

            if (n.IsAlias)
            {
                // alias |
                // alias id = |
                // NOT alias Type |
                if (IsIncompleteDeclaration(n.Type))
                {
                    prv  = new CtrlSpaceCompletionProvider(cdgen, scopedBlock, scopedStatement);
                    halt = true;
                }
            }
            else if (n.Initializer != null)
            {
                handlesInitializer = true;
                n.Initializer.Accept(this);
                handlesInitializer = false;
            }

            if (!halt)
            {
                VisitDNode(n);
            }

            // auto |
            if (!halt && n.NameHash == 0 && n.ContainsAttribute(DTokens.Auto))
            {
                halt = true;
                explicitlyNoCompletion = true;
            }
        }