summaryrefslogtreecommitdiff
path: root/source/slang/parser.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2018-01-21 10:48:31 -0800
committerGitHub <noreply@github.com>2018-01-21 10:48:31 -0800
commit4044a1d3a0605198465a7eb6e0e3c1f8b1a3c298 (patch)
tree62927d4d2722b36c8e7eb4060e741b9032686835 /source/slang/parser.cpp
parent2079b941bc5849b6ab33774fb90cefe9c2d624cb (diff)
parentf681a1505c98995683a7fbae7ce208dc5e444b9b (diff)
Merge pull request #372 from csyonghe/master
Allow type expression as type argument, fix global param enum order
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());
}