Esempio n. 1
0
        public static Dictionary<int, Dictionary<ISyntaxRegion, byte>> Scan(DModule ast, ResolutionContext ctxt)
        {
            if (ast == null)
                return new Dictionary<int, Dictionary<ISyntaxRegion,byte>>();

            var typeRefFinder = new TypeReferenceFinder(ctxt);

            ContextFrame backupFrame = null;

            if(ctxt.ScopedBlock == ast)
                backupFrame = ctxt.Pop ();
            /*
            if (ctxt.CurrentContext == null)
            {
                ctxt.Push(backupFrame);
                backupFrame = null;
            }*/

            //typeRefFinder.ast = ast;
            // Enum all identifiers
            ast.Accept (typeRefFinder);

            if (backupFrame != null)
                ctxt.Push (backupFrame);

            // Crawl through all remaining expressions by evaluating their types and check if they're actual type references.
            /*typeRefFinder.queueCount = typeRefFinder.q.Count;
            typeRefFinder.ResolveAllIdentifiers();
            */
            return typeRefFinder.Matches;
        }
Esempio n. 2
0
        public static TypeReferencesResult Scan(IAbstractSyntaxTree ast, ParseCacheList pcl)
        {
            var typeRefFinder = new TypeReferenceFinder(pcl);

            typeRefFinder.ast = ast;
            // Enum all identifiers
            typeRefFinder.S(ast);

            // Crawl through all remaining expressions by evaluating their types and check if they're actual type references.
            typeRefFinder.queueCount = typeRefFinder.q.Count;
            typeRefFinder.ResolveAllIdentifiers();

            return typeRefFinder.result;
        }
Esempio n. 3
0
        public static TypeReferencesResult Scan(IAbstractSyntaxTree ast, ParseCacheList pcl)
        {
            var typeRefFinder = new TypeReferenceFinder(pcl);

            typeRefFinder.ast = ast;
            // Enum all identifiers
            typeRefFinder.S(ast);

            // Crawl through all remaining expressions by evaluating their types and check if they're actual type references.
            typeRefFinder.queueCount = typeRefFinder.q.Count;
            typeRefFinder.ResolveAllIdentifiers();

            return(typeRefFinder.result);
        }
Esempio n. 4
0
        public static Dictionary <int, Dictionary <ISyntaxRegion, byte> > Scan(IEditorData ed, List <ISyntaxRegion> invalidConditionalCodeRegions = null, int timeout = int.MinValue)
        {
            if (ed == null || ed.SyntaxTree == null)
            {
                return(new Dictionary <int, Dictionary <ISyntaxRegion, byte> >());
            }

            var ctxt = ResolutionContext.Create(ed, false);

            // Since it's just about enumerating, not checking types, ignore any conditions
            ctxt.ContextIndependentOptions |= ResolutionOptions.IgnoreDeclarationConditions;

            var typeRefFinder = new TypeReferenceFinder(ctxt, invalidConditionalCodeRegions);

            CodeCompletion.DoTimeoutableCompletionTask(null, ctxt, () => ed.SyntaxTree.Accept(typeRefFinder), timeout);

            return(typeRefFinder.Matches);
        }
Esempio n. 5
0
        public static Dictionary <int, Dictionary <ISyntaxRegion, byte> > Scan(DModule ast, ResolutionContext ctxt)
        {
            if (ast == null)
            {
                return(new Dictionary <int, Dictionary <ISyntaxRegion, byte> >());
            }

            var typeRefFinder = new TypeReferenceFinder(ctxt);

            ContextFrame backupFrame = null;

            if (ctxt.ScopedBlock == ast)
            {
                backupFrame = ctxt.Pop();
            }

            /*
             * if (ctxt.CurrentContext == null)
             * {
             *      ctxt.Push(backupFrame);
             *      backupFrame = null;
             * }*/

            //typeRefFinder.ast = ast;
            // Enum all identifiers
            ast.Accept(typeRefFinder);

            if (backupFrame != null)
            {
                ctxt.Push(backupFrame);
            }

            // Crawl through all remaining expressions by evaluating their types and check if they're actual type references.

            /*typeRefFinder.queueCount = typeRefFinder.q.Count;
             * typeRefFinder.ResolveAllIdentifiers();
             */
            return(typeRefFinder.Matches);
        }