Modules are workings \o/

This commit is contained in:
Jérôme Leclercq
2022-03-08 20:26:02 +01:00
parent 83d26e209e
commit be9bdc4705
29 changed files with 742 additions and 256 deletions

View File

@@ -137,20 +137,22 @@ namespace Nz::ShaderAst
return clone;
}
ExpressionPtr IndexRemapperVisitor::Clone(CallFunctionExpression& node)
ExpressionPtr IndexRemapperVisitor::Clone(FunctionExpression& node)
{
CallFunctionExpressionPtr clone = static_unique_pointer_cast<CallFunctionExpression>(AstCloner::Clone(node));
FunctionExpressionPtr clone = static_unique_pointer_cast<FunctionExpression>(AstCloner::Clone(node));
const auto& targetFuncType = GetExpressionType(*node.targetFunction);
if (std::holds_alternative<FunctionType>(targetFuncType))
{
const auto& funcType = std::get<FunctionType>(targetFuncType);
assert(clone->funcId);
clone->funcId = Retrieve(m_context->newFuncIndices, clone->funcId);
FunctionType newFunc;
newFunc.funcIndex = Retrieve(m_context->newFuncIndices, funcType.funcIndex);
clone->cachedExpressionType = ExpressionType{ newFunc }; //< FIXME We should add FunctionExpression like VariableExpression to handle this
}
return clone;
}
ExpressionPtr IndexRemapperVisitor::Clone(StructTypeExpression& node)
{
StructTypeExpressionPtr clone = static_unique_pointer_cast<StructTypeExpression>(AstCloner::Clone(node));
assert(clone->structTypeId);
clone->structTypeId = Retrieve(m_context->newStructIndices, clone->structTypeId);
return clone;
}