summaryrefslogtreecommitdiffstats
path: root/source/slang/reflection.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2018-01-21 07:09:55 -0500
committerYong He <yonghe@outlook.com>2018-01-21 07:09:55 -0500
commitce879112cb16e3def1b8673104e7123b8b17ee2a (patch)
tree9b2a63c4c2c6256d33cb32b925ed9820cf13071d /source/slang/reflection.cpp
parent913f4d09b91e3fd7449468b135881c940cacb3c0 (diff)
Improvements and bug fixes for global type parameters
1. allow spReflection_FindTypeByName to accept arbitrary type expression string 2. allow const int generic value to be used as expression value, and as array size 3. various bug fixes in witness table specialization / function cloning during specializeIRForEntryPoint to avoid creating duplicate global values, not copying the right definition of a function from the other module, not cloning witness tables that are required by specializeGenerics etc.
Diffstat (limited to 'source/slang/reflection.cpp')
-rw-r--r--source/slang/reflection.cpp16
1 files changed, 2 insertions, 14 deletions
diff --git a/source/slang/reflection.cpp b/source/slang/reflection.cpp
index c9de75d6e..b0be58274 100644
--- a/source/slang/reflection.cpp
+++ b/source/slang/reflection.cpp
@@ -433,20 +433,8 @@ SLANG_API SlangReflectionType * spReflection_FindTypeByName(SlangReflection * re
auto context = convert(reflection);
auto compileRequest = context->targetRequest->compileRequest;
- RefPtr<Type> result;
- if (compileRequest->types.TryGetValue(name, result))
- return (SlangReflectionType*)result.Ptr();
-
- auto nameObj = compileRequest->getNamePool()->getName(name);
- Decl* resultDecl = compileRequest->lookupGlobalDecl(nameObj);
- if (resultDecl)
- {
- RefPtr<DeclRefType> declRefType = new DeclRefType();
- declRefType->declRef.decl = resultDecl;
- compileRequest->types[name] = declRefType;
- return (SlangReflectionType*)declRefType.Ptr();
- }
- return nullptr;
+ RefPtr<Type> result = compileRequest->getTypeFromString(name);
+ return (SlangReflectionType*)result.Ptr();
}
SLANG_API SlangReflectionTypeLayout* spReflection_GetTypeLayout(