summaryrefslogtreecommitdiffstats
path: root/source/slang/parser.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/parser.cpp
parent2079b941bc5849b6ab33774fb90cefe9c2d624cb (diff)
Allow arbitrary type string as type argument in spAddEntryPointEx.
Diffstat (limited to 'source/slang/parser.cpp')
-rw-r--r--source/slang/parser.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/slang/parser.cpp b/source/slang/parser.cpp
index 7e36b0e71..531606f8d 100644
--- a/source/slang/parser.cpp
+++ b/source/slang/parser.cpp
@@ -2704,6 +2704,7 @@ namespace Slang
PushScope(program);
program->loc = tokenReader.PeekLoc();
+ program->scope = currentScope;
ParseDeclBody(this, program, TokenType::EndOfFile);
PopScope();
@@ -3960,6 +3961,17 @@ namespace Slang
return parsePrefixExpr(this);
}
+ RefPtr<Expr> parseTypeFromSourceFile(TranslationUnitRequest* translationUnit,
+ TokenSpan const& tokens,
+ DiagnosticSink* sink,
+ RefPtr<Scope> const& outerScope)
+ {
+ Parser parser(tokens, sink, outerScope);
+ parser.translationUnit = translationUnit;
+ parser.currentScope = outerScope;
+ return parser.ParseType();
+ }
+
// Parse a source file into an existing translation unit
void parseSourceFile(
TranslationUnitRequest* translationUnit,
@@ -3971,6 +3983,7 @@ namespace Slang
parser.translationUnit = translationUnit;
+
return parser.parseSourceFile(translationUnit->SyntaxNode.Ptr());
}