From c16fc84a0071892ea0f4e3c5c70aa101e6400aec Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Mon, 26 Jun 2017 09:07:07 -0700 Subject: Include imported code when generating reflection data - The basic idea is simple: be sure to enumerate code in `__import`ed modules when generating reflection info - Note that we don't currently allow an entry point to appear in an imported module, so we only consider globlal-scope parameters - Although there isn't currently a real implementation of namespacing, I went ahead and ensured that parameters in imported modules are treated as distinct from parameters in the user's code, even if they have the same name. --- source/slang/slang.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'source/slang/slang.cpp') diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index 37d72cadc..fc18ea1cf 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -419,7 +419,8 @@ RefPtr CompileRequest::loadModule( RefPtr moduleDecl = translationUnit->SyntaxNode; - loadedModules.Add(name, moduleDecl); + loadedModulesMap.Add(name, moduleDecl); + loadedModulesList.Add(moduleDecl); return moduleDecl; @@ -434,7 +435,7 @@ String CompileRequest::autoImportModule( String name = path; // Have we already loaded a module matching this name? - if (loadedModules.TryGetValue(name)) + if (loadedModulesMap.TryGetValue(name)) return name; loadModule(name, path, source, loc); @@ -449,7 +450,7 @@ RefPtr CompileRequest::findOrImportModule( // Have we already loaded a module matching this name? // If so, return it. RefPtr moduleDecl; - if (loadedModules.TryGetValue(name, moduleDecl)) + if (loadedModulesMap.TryGetValue(name, moduleDecl)) return moduleDecl; // Derive a file name for the module, by taking the given @@ -488,7 +489,7 @@ RefPtr CompileRequest::findOrImportModule( { this->mSink.diagnose(loc, Diagnostics::cannotFindFile, fileName); - loadedModules[name] = nullptr; + loadedModulesMap[name] = nullptr; return nullptr; } break; -- cgit v1.2.3