summaryrefslogtreecommitdiffstats
path: root/source/slang/slang.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-06-26 09:07:07 -0700
committerTim Foley <tfoley@nvidia.com>2017-06-26 10:31:43 -0700
commitc16fc84a0071892ea0f4e3c5c70aa101e6400aec (patch)
tree6c5e2363cbf5c460006ea19ae4e0ac2243df291e /source/slang/slang.cpp
parentd506737b8b00bcc89adf937994ceb6df4509c98a (diff)
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.
Diffstat (limited to 'source/slang/slang.cpp')
-rw-r--r--source/slang/slang.cpp9
1 files changed, 5 insertions, 4 deletions
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<ProgramSyntaxNode> CompileRequest::loadModule(
RefPtr<ProgramSyntaxNode> 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<ProgramSyntaxNode> CompileRequest::findOrImportModule(
// Have we already loaded a module matching this name?
// If so, return it.
RefPtr<ProgramSyntaxNode> 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<ProgramSyntaxNode> CompileRequest::findOrImportModule(
{
this->mSink.diagnose(loc, Diagnostics::cannotFindFile, fileName);
- loadedModules[name] = nullptr;
+ loadedModulesMap[name] = nullptr;
return nullptr;
}
break;