Constrained the element’s type in set element expressions to primitive terms.
This commit is contained in:
@@ -14,6 +14,12 @@ namespace ast
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Terms are primitive (or arguments) if they are neither operations nor intervals
|
||||
inline bool isPrimitive(const ast::Term &term)
|
||||
{
|
||||
return (!term.is<ast::BinaryOperation>() && !term.is<ast::Interval>());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Primitives
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -112,12 +118,15 @@ struct Function
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// TODO: refactor (limit element type to primitive terms)
|
||||
struct In
|
||||
{
|
||||
In(Term &&element, Term &&set)
|
||||
: element{std::move(element)},
|
||||
set{std::move(set)}
|
||||
{
|
||||
// While the set may be any term, the element must be primitive
|
||||
assert(isPrimitive(element));
|
||||
}
|
||||
|
||||
Term element;
|
||||
|
Reference in New Issue
Block a user