diff options
| author | Yong He <yongh@outlook.com> | 2018-01-03 17:15:03 -0800 |
|---|---|---|
| committer | Yong He <yongh@outlook.com> | 2018-01-03 17:15:03 -0800 |
| commit | 550405d2de2ca617046e73fe5ec7e5e1765a5c97 (patch) | |
| tree | 89b1e0e3f0e95ea0bf586bd67fa36066f0021ce7 /source/slang/reflection.cpp | |
| parent | 61b206db5fc5a4c9d42fa3fbb4f50624b6c6c6c5 (diff) | |
Fix type lookup of global type arguments
Global type argument lookup should be done in both loaded modules and current trnaslation units. This is the same as the logic of spReflection_FindTypeByName, so it is extracted into `CompileRequest::lookupGlobalDecl(Name*)` method and reused in places.
Diffstat (limited to 'source/slang/reflection.cpp')
| -rw-r--r-- | source/slang/reflection.cpp | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/source/slang/reflection.cpp b/source/slang/reflection.cpp index 59b50891c..c9de75d6e 100644 --- a/source/slang/reflection.cpp +++ b/source/slang/reflection.cpp @@ -437,18 +437,8 @@ SLANG_API SlangReflectionType * spReflection_FindTypeByName(SlangReflection * re if (compileRequest->types.TryGetValue(name, result)) return (SlangReflectionType*)result.Ptr(); - Decl* resultDecl = nullptr; auto nameObj = compileRequest->getNamePool()->getName(name); - for (auto module : compileRequest->loadedModulesList) - { - if (module->moduleDecl->memberDictionary.TryGetValue(nameObj, resultDecl)) - break; - } - for (auto transUnit : compileRequest->translationUnits) - { - if (transUnit->SyntaxNode->memberDictionary.TryGetValue(nameObj, resultDecl)) - break; - } + Decl* resultDecl = compileRequest->lookupGlobalDecl(nameObj); if (resultDecl) { RefPtr<DeclRefType> declRefType = new DeclRefType(); |
