Add domain specifier to variable declarations
With this change, the domain of variable declarations can be specified. While the default is the general domain of all precomputed value, this adds support for integer variables, for which advanced simplification rules apply.
This commit is contained in:
parent
9a59ac17f5
commit
87dcd6ee93
@ -343,13 +343,21 @@ struct VariableDeclaration
|
|||||||
Body
|
Body
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class Domain
|
||||||
|
{
|
||||||
|
General,
|
||||||
|
Integer
|
||||||
|
};
|
||||||
|
|
||||||
explicit VariableDeclaration(Type type)
|
explicit VariableDeclaration(Type type)
|
||||||
: type{type}
|
: type{type},
|
||||||
|
domain{Domain::General}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit VariableDeclaration(Type type, std::string &&name)
|
explicit VariableDeclaration(Type type, std::string &&name)
|
||||||
: type{type},
|
: type{type},
|
||||||
|
domain{Domain::General},
|
||||||
name{std::move(name)}
|
name{std::move(name)}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -360,6 +368,7 @@ struct VariableDeclaration
|
|||||||
VariableDeclaration &operator=(VariableDeclaration &&other) = default;
|
VariableDeclaration &operator=(VariableDeclaration &&other) = default;
|
||||||
|
|
||||||
Type type;
|
Type type;
|
||||||
|
Domain domain;
|
||||||
std::string name;
|
std::string name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ inline output::ColorStream &print(output::ColorStream &stream, const Variable &v
|
|||||||
inline output::ColorStream &print(output::ColorStream &stream, const VariableDeclaration &variableDeclaration, PrintContext &printContext, bool)
|
inline output::ColorStream &print(output::ColorStream &stream, const VariableDeclaration &variableDeclaration, PrintContext &printContext, bool)
|
||||||
{
|
{
|
||||||
const auto printVariableDeclaration =
|
const auto printVariableDeclaration =
|
||||||
[&stream, &variableDeclaration](const auto *prefix, auto &variableIDs) -> output::ColorStream &
|
[&](const auto *prefix, auto &variableIDs) -> output::ColorStream &
|
||||||
{
|
{
|
||||||
auto matchingVariableID = variableIDs.find(&variableDeclaration);
|
auto matchingVariableID = variableIDs.find(&variableDeclaration);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user