summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-check-stmt.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-05-28 14:01:51 -0400
committerGitHub <noreply@github.com>2020-05-28 14:01:51 -0400
commitc2d31347ea06c768045e7c503ef0188e0e5356de (patch)
tree1a4ee67aafca0a709ae691104023431bb6829825 /source/slang/slang-check-stmt.cpp
parente5d0f3360f44a4cdd2390e7817db17bb3cc0dd04 (diff)
WIP: ASTBuilder (#1358)
* Compiles. * Small tidy up around session/ASTBuilder. * Tests are now passing. * Fix Visual Studio project. * Fix using new X to use builder when protectedness of Ctor is not enough. Substitute->substitute * Add some missing ast nodes created outside of ASTBuilder. * Compile time check that ASTBuilder is making an AST type. * Moced findClasInfo and findSyntaxClass (essentially the same thing) to SharedASTBuilder from Session.
Diffstat (limited to 'source/slang/slang-check-stmt.cpp')
-rw-r--r--source/slang/slang-check-stmt.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/slang/slang-check-stmt.cpp b/source/slang/slang-check-stmt.cpp
index fa2eb59a0..71cf97396 100644
--- a/source/slang/slang-check-stmt.cpp
+++ b/source/slang/slang-check-stmt.cpp
@@ -112,7 +112,7 @@ namespace Slang
{
RefPtr<Expr> e = expr;
e = CheckTerm(e);
- e = coerce(getSession()->getBoolType(), e);
+ e = coerce(m_astBuilder->getBoolType(), e);
return e;
}
@@ -153,8 +153,8 @@ namespace Slang
{
WithOuterStmt subContext(this, stmt);
- stmt->varDecl->type.type = getSession()->getIntType();
- addModifier(stmt->varDecl, new ConstModifier());
+ stmt->varDecl->type.type = m_astBuilder->getIntType();
+ addModifier(stmt->varDecl, m_astBuilder->create<ConstModifier>());
stmt->varDecl->setCheckState(DeclCheckState::Checked);
RefPtr<IntVal> rangeBeginVal;
@@ -166,7 +166,7 @@ namespace Slang
}
else
{
- RefPtr<ConstantIntVal> rangeBeginConst = new ConstantIntVal();
+ RefPtr<ConstantIntVal> rangeBeginConst = m_astBuilder->create<ConstantIntVal>();
rangeBeginConst->value = 0;
rangeBeginVal = rangeBeginConst;
}
@@ -250,7 +250,7 @@ namespace Slang
auto function = getParentFunc();
if (!stmt->expression)
{
- if (function && !function->returnType.equals(getSession()->getVoidType()))
+ if (function && !function->returnType.equals(m_astBuilder->getVoidType()))
{
getSink()->diagnose(stmt, Diagnostics::returnNeedsExpression);
}
@@ -258,7 +258,7 @@ namespace Slang
else
{
stmt->expression = CheckTerm(stmt->expression);
- if (!stmt->expression->type->equals(getSession()->getErrorType()))
+ if (!stmt->expression->type->equals(m_astBuilder->getErrorType()))
{
if (function)
{