summaryrefslogtreecommitdiffstats
path: root/source/compiler-core/slang-source-loc.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-12-05 10:06:19 -0800
committerGitHub <noreply@github.com>2023-12-05 10:06:19 -0800
commit1050e0eb96d6c8e7a6cfb253458155e1014625c3 (patch)
treece6c3cbde591759fa2fe2aeb05cb132e50a9a419 /source/compiler-core/slang-source-loc.cpp
parent4fb3b10b81cf8c976ebd1ebb7fcde7708f022957 (diff)
Support `include` for pulling file into the current module. (#3377)
* Support `include` for pulling file into the current module. * Add auto-completion, hover info and goto-def support. * Disable warning for missing `module` declaration for now. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/compiler-core/slang-source-loc.cpp')
-rw-r--r--source/compiler-core/slang-source-loc.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/compiler-core/slang-source-loc.cpp b/source/compiler-core/slang-source-loc.cpp
index 33f93074e..fe08f8dfc 100644
--- a/source/compiler-core/slang-source-loc.cpp
+++ b/source/compiler-core/slang-source-loc.cpp
@@ -919,6 +919,13 @@ void SourceManager::addSourceFile(const String& uniqueIdentity, SourceFile* sour
m_sourceFileMap.add(uniqueIdentity, sourceFile);
}
+void SourceManager::addSourceFileIfNotExist(const String& uniqueIdentity, SourceFile* sourceFile)
+{
+ if (findSourceFileRecursively(uniqueIdentity))
+ return;
+ m_sourceFileMap.addIfNotExists(uniqueIdentity, sourceFile);
+}
+
HumaneSourceLoc SourceManager::getHumaneLoc(SourceLoc loc, SourceLocType type)
{
SourceView* sourceView = findSourceViewRecursively(loc);