summaryrefslogtreecommitdiffstats
path: root/source/slang/slang.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2018-01-19 18:20:23 -0500
committerYong He <yonghe@outlook.com>2018-01-19 22:21:29 -0500
commit9d515dd257498cba9144dd31f2f3219e997e03d0 (patch)
tree131571608747f80354236ba62ca946c7fc703db7 /source/slang/slang.cpp
parent2079b941bc5849b6ab33774fb90cefe9c2d624cb (diff)
Allow arbitrary type string as type argument in spAddEntryPointEx.
Diffstat (limited to 'source/slang/slang.cpp')
-rw-r--r--source/slang/slang.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 2ebf024e3..d907e7614 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -125,6 +125,21 @@ CompileRequest::CompileRequest(Session* session)
CompileRequest::~CompileRequest()
{}
+
+RefPtr<Expr> CompileRequest::parseTypeString(TranslationUnitRequest * translationUnit, String typeStr, RefPtr<Scope> scope)
+{
+ Slang::SourceFile srcFile;
+ srcFile.content = typeStr;
+ DiagnosticSink sink;
+ auto tokens = preprocessSource(
+ &srcFile,
+ &sink,
+ nullptr,
+ Dictionary<String,String>(),
+ translationUnit);
+ return parseTypeFromSourceFile(translationUnit, tokens, &sink, scope);
+}
+
void CompileRequest::parseTranslationUnit(
TranslationUnitRequest* translationUnit)
{
@@ -429,7 +444,7 @@ int CompileRequest::addEntryPoint(
entryPoint->profile = entryPointProfile;
entryPoint->translationUnitIndex = translationUnitIndex;
for (auto typeName : genericTypeNames)
- entryPoint->genericParameterTypeNames.Add(getNamePool()->getName(typeName));
+ entryPoint->genericParameterTypeNames.Add(typeName);
auto translationUnit = translationUnits[translationUnitIndex].Ptr();
translationUnit->entryPoints.Add(entryPoint);