public static ParseCacheView CreateCache(params string[] moduleCodes)
        {
            var r = new MutableRootPackage(objMod);

            foreach (var code in moduleCodes)
                r.AddModule(DParser.ParseString(code));

            return new ParseCacheView(new[] { r });
        }
Beispiel #2
0
        public static ParseCacheView CreateCache(params string[] moduleCodes)
        {
            var r = new MutableRootPackage(objMod);

            foreach (var code in moduleCodes)
            {
                r.AddModule(DParser.ParseString(code));
            }

            return(new ParseCacheView(new[] { r }));
        }
Beispiel #3
0
        public static ParseCacheView CreateCache(params string[] moduleCodes)
        {
            var r = new MutableRootPackage (objMod);

            foreach (var code in moduleCodes)
                r.AddModule(DParser.ParseString(code));

            UFCSCache.SingleThreaded = true;
            var pcl = new ParseCacheView (new [] { r });
            r.UfcsCache.BeginUpdate (pcl);

            return pcl;
        }
Beispiel #4
0
        /// <summary>
        /// Updates the project's parse cache and reparses all of its D sources
        /// </summary>
        public void UpdateParseCache()
        {
            analysisFinished_LocalCache = analysisFinished_FileLinks = false;

            var hasFileLinks = new List <ProjectFile>();

            foreach (var f in Files)
            {
                if ((f.IsLink || f.IsExternalToProject) && File.Exists(f.ToString()))
                {
                    hasFileLinks.Add(f);
                }
            }

            // To prevent race condition bugs, test if links exist _before_ the actual local file parse procedure starts.
            if (hasFileLinks.Count == 0)
            {
                analysisFinished_FileLinks = true;
            }

            DCompilerConfiguration.UpdateParseCacheAsync(GetSourcePaths(), true, LocalFileCache_FinishedParsing);

            //EDIT: What if those file links refer to other project's files? Or what if more than one project reference the same files?
            //Furthermore, what if those files become edited and reparsed? Will their reference in the projects be updated either?
            // -> make a root for every file link in the global parse cache and build up a virtual root containing all file links right before a cache view is requested?

            /*
             * Since we don't want to include all link files' directories for performance reasons,
             * parse them separately and let the entire reparsing procedure wait for them to be successfully parsed.
             * Ufcs completion preparation will be done afterwards in the TryBuildUfcsCache() method.
             */
            if (hasFileLinks.Count != 0)
            {
                new System.Threading.Thread(() =>
                {
                    var r = new MutableRootPackage();
                    foreach (var f in hasFileLinks)
                    {
                        r.AddModule(DParser.ParseFile(f.FilePath) as DModule);
                    }
                    fileLinkModulesRoot = r;

                    analysisFinished_FileLinks = true;
                    TryBuildUfcsCache();
                })
                {
                    IsBackground = true
                }
            }
Beispiel #5
0
        /// <summary>
        /// Updates the project's parse cache and reparses all of its D sources
        /// </summary>
        public void UpdateParseCache()
        {
            var hasFileLinks = new List<ProjectFile>();
            foreach (var f in Files)
                if ((f.IsLink || f.IsExternalToProject) && File.Exists(f.ToString()))
                    hasFileLinks.Add(f);

            DCompilerConfiguration.UpdateParseCacheAsync (GetSourcePaths(), true);

            //EDIT: What if those file links refer to other project's files? Or what if more than one project reference the same files?
            //Furthermore, what if those files become edited and reparsed? Will their reference in the projects be updated either?
            // -> make a root for every file link in the global parse cache and build up a virtual root containing all file links right before a cache view is requested?

            /*
             * Since we don't want to include all link files' directories for performance reasons,
             * parse them separately and let the entire reparsing procedure wait for them to be successfully parsed.
             * Ufcs completion preparation will be done afterwards in the TryBuildUfcsCache() method.
             */
            if (hasFileLinks.Count != 0)
                new System.Threading.Thread(() =>
                {
                    var r = new MutableRootPackage();
                    foreach (var f in hasFileLinks)
                        r.AddModule (DParser.ParseFile (f.FilePath));
                    fileLinkModulesRoot = r;
                }) { IsBackground = true }.Start();
        }