From c2d31347ea06c768045e7c503ef0188e0e5356de Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 28 May 2020 14:01:51 -0400 Subject: 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. --- source/slang/slang-check-stmt.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source/slang/slang-check-stmt.cpp') 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 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()); stmt->varDecl->setCheckState(DeclCheckState::Checked); RefPtr rangeBeginVal; @@ -166,7 +166,7 @@ namespace Slang } else { - RefPtr rangeBeginConst = new ConstantIntVal(); + RefPtr rangeBeginConst = m_astBuilder->create(); 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) { -- cgit v1.2.3