Shader: Fill SourceLocation info to AST when parsing

This commit is contained in:
SirLynix
2022-03-28 18:24:51 +02:00
committed by Jérôme Leclercq
parent 8429411755
commit 78f4751967
10 changed files with 339 additions and 173 deletions

View File

@@ -315,6 +315,7 @@ namespace Nz::ShaderBuilder
inline ShaderAst::ExpressionStatementPtr Impl::ExpressionStatement::operator()(ShaderAst::ExpressionPtr expression) const
{
auto expressionStatementNode = std::make_unique<ShaderAst::ExpressionStatement>();
expressionStatementNode->sourceLocation = expression->sourceLocation;
expressionStatementNode->expression = std::move(expression);
return expressionStatementNode;
@@ -421,6 +422,7 @@ namespace Nz::ShaderBuilder
inline ShaderAst::ScopedStatementPtr Impl::Scoped::operator()(ShaderAst::StatementPtr statement) const
{
auto scopedNode = std::make_unique<ShaderAst::ScopedStatement>();
scopedNode->sourceLocation = statement->sourceLocation;
scopedNode->statement = std::move(statement);
return scopedNode;