コード例 #1
0
		public static TypeReferencesResult Scan(DModule ast, ResolutionContext ctxt)
		{
			if (ast == null)
				return new TypeReferencesResult();

			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.result;
		}
コード例 #2
0
ファイル: TypeReferenceFinder.cs プロジェクト: windygu/DSharp
        public static TypeReferencesResult Scan(DModule ast, ResolutionContext ctxt)
        {
            if (ast == null)
            {
                return(new TypeReferencesResult());
            }

            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.result);
        }