summaryrefslogtreecommitdiffstats
path: root/source/slang/slang.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang.cpp')
-rw-r--r--source/slang/slang.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 7602096d4..02b1efedf 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -2611,6 +2611,11 @@ void Linkage::loadParsedModule(
}
}
loadedModulesList.add(loadedModule);
+
+ if (m_moduleCache)
+ {
+ m_moduleCache->storeModule(this, pathInfo.foundPath, loadedModule);
+ }
}
Module* Linkage::loadModule(String const& name)
@@ -2794,6 +2799,19 @@ RefPtr<Module> Linkage::findOrImportModule(
if (mapPathToLoadedModule.TryGetValue(filePathInfo.getMostUniqueIdentity(), loadedModule))
return loadedModule;
+ // Is this module in user provided cache?
+ // (yong): module cache is intended to speed up language server reparsing.
+ // currently it is *not* enabled in language server.
+ if (m_moduleCache)
+ {
+ loadedModule = m_moduleCache->tryLoadModule(this, filePathInfo.foundPath);
+ if (loadedModule)
+ {
+ mapPathToLoadedModule[filePathInfo.getMostUniqueIdentity()] = loadedModule;
+ return loadedModule;
+ }
+ }
+
// Try to load it
ComPtr<ISlangBlob> fileContents;
if(SLANG_FAILED(includeSystem.loadFile(filePathInfo, fileContents)))
@@ -2945,9 +2963,7 @@ static bool _canExportDeclSymbol(ASTNodeType type)
{
switch (type)
{
- case ASTNodeType::ModuleDecl:
case ASTNodeType::EmptyDecl:
- case ASTNodeType::NamespaceDecl:
{
return false;
}