From 1050e0eb96d6c8e7a6cfb253458155e1014625c3 Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 5 Dec 2023 10:06:19 -0800 Subject: 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 --- source/compiler-core/slang-source-loc.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/compiler-core/slang-source-loc.cpp') 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); -- cgit v1.2.3