Shader/AstCompare: Fix missing ConditionalStatement compare

This commit is contained in:
Jérôme Leclercq 2022-03-06 13:19:19 +01:00
parent 84db6981bc
commit acf1b30355
1 changed files with 15 additions and 4 deletions

View File

@ -15,12 +15,12 @@ namespace Nz::ShaderAst
switch (lhs.GetType())
{
case NodeType::None: break;
case NodeType::None: break;
#define NAZARA_SHADERAST_EXPRESSION(Node) case NodeType::Node: return Compare(static_cast<const Node&>(lhs), static_cast<const Node&>(lhs));
#include <Nazara/Shader/Ast/AstNodeList.hpp>
default: throw std::runtime_error("unexpected node type");
default: throw std::runtime_error("unexpected node type");
}
return true;
@ -33,12 +33,12 @@ namespace Nz::ShaderAst
switch (lhs.GetType())
{
case NodeType::None: break;
case NodeType::None: break;
#define NAZARA_SHADERAST_STATEMENT(Node) case NodeType::Node: return Compare(static_cast<const Node&>(lhs), static_cast<const Node&>(lhs));
#include <Nazara/Shader/Ast/AstNodeList.hpp>
default: throw std::runtime_error("unexpected node type");
default: throw std::runtime_error("unexpected node type");
}
return false;
@ -358,6 +358,17 @@ namespace Nz::ShaderAst
return true;
}
inline bool Compare(const ConditionalStatement& lhs, const ConditionalStatement& rhs)
{
if (!Compare(lhs.condition, rhs.condition))
return false;
if (!Compare(lhs.statement, rhs.statement))
return false;
return true;
}
inline bool Compare(const DeclareConstStatement& lhs, const DeclareConstStatement& rhs)
{
if (!Compare(lhs.name, rhs.name))