Skip to content
Snippets Groups Projects

Fix issue #18

Merged Stéphane Del Pino requested to merge issue/18 into develop
3 files
+ 110
0
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -25,6 +25,19 @@
#include <language/node_processor/WhileProcessor.hpp>
#include <language/utils/ParseError.hpp>
void
ASTNodeExpressionBuilder::_checkIsPureFunction(const ASTNode& node) const
{
if (node.is_type<language::unary_plusplus>() or node.is_type<language::unary_minusminus>() or
node.is_type<language::post_plusplus>() or node.is_type<language::post_minusminus>()) {
throw ParseError("invalid function definition. Function data must be constant!", node.begin());
}
for (auto&& child : node.children) {
this->_checkIsPureFunction(*child);
}
}
void
ASTNodeExpressionBuilder::_buildExpression(ASTNode& n)
{
@@ -42,6 +55,8 @@ ASTNodeExpressionBuilder::_buildExpression(ASTNode& n)
} else if (n.is_type<language::tuple_expression>()) {
n.m_node_processor = std::make_unique<TupleToVectorProcessor<ASTNodeExpressionListProcessor>>(n);
} else if (n.is_type<language::function_definition>()) {
this->_checkIsPureFunction(n);
n.m_node_processor = std::make_unique<FakeProcessor>();
} else if (n.is_type<language::function_evaluation>()) {
Loading