Fix dependency checker and add unit test

This commit is contained in:
Jérôme Leclercq
2022-02-28 13:28:59 +01:00
parent 1e606f3043
commit 142f15d538
3 changed files with 90 additions and 14 deletions

View File

@@ -32,7 +32,7 @@ namespace Nz::ShaderAst
void DependencyCheckerVisitor::Visit(CallFunctionExpression& node)
{
const auto& targetFuncType = GetExpressionType(node);
const auto& targetFuncType = GetExpressionType(*node.targetFunction);
assert(std::holds_alternative<FunctionType>(targetFuncType));
const auto& funcType = std::get<FunctionType>(targetFuncType);

View File

@@ -527,7 +527,10 @@ namespace Nz
bool first = true;
for (const ShaderAst::StatementPtr& statement : statements)
{
if (!first && statement->GetType() != ShaderAst::NodeType::NoOpStatement)
if (statement->GetType() == ShaderAst::NodeType::NoOpStatement)
continue;
if (!first)
AppendLine();
statement->Visit(*this);