Shader: Add IsExpression/IsStatement
This commit is contained in:
parent
b234134abc
commit
4bca87b1cb
|
|
@ -296,6 +296,8 @@ namespace Nz::ShaderAst
|
|||
};
|
||||
|
||||
inline const ShaderAst::ExpressionType& GetExpressionType(ShaderAst::Expression& expr);
|
||||
inline bool IsExpression(NodeType nodeType);
|
||||
inline bool IsStatement(NodeType nodeType);
|
||||
}
|
||||
|
||||
#include <Nazara/Shader/ShaderNodes.inl>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,30 @@ namespace Nz::ShaderAst
|
|||
assert(expr.cachedExpressionType);
|
||||
return expr.cachedExpressionType.value();
|
||||
}
|
||||
|
||||
inline bool IsExpression(NodeType nodeType)
|
||||
{
|
||||
switch (nodeType)
|
||||
{
|
||||
#define NAZARA_SHADERAST_EXPRESSION(Node) case NodeType::Node: return true;
|
||||
#include <Nazara/Shader/ShaderAstNodes.hpp>
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
inline bool IsStatement(NodeType nodeType)
|
||||
{
|
||||
switch (nodeType)
|
||||
{
|
||||
#define NAZARA_SHADERAST_STATEMENT(Node) case NodeType::Node: return true;
|
||||
#include <Nazara/Shader/ShaderAstNodes.hpp>
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Shader/DebugOff.hpp>
|
||||
|
|
|
|||
Loading…
Reference in New Issue