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:
2018-04-13 15:48:03 +02:00
parent 9a59ac17f5
commit 87dcd6ee93
2 changed files with 11 additions and 2 deletions

View File

@@ -343,13 +343,21 @@ struct VariableDeclaration
Body
};
enum class Domain
{
General,
Integer
};
explicit VariableDeclaration(Type type)
: type{type}
: type{type},
domain{Domain::General}
{
}
explicit VariableDeclaration(Type type, std::string &&name)
: type{type},
domain{Domain::General},
name{std::move(name)}
{
}
@@ -360,6 +368,7 @@ struct VariableDeclaration
VariableDeclaration &operator=(VariableDeclaration &&other) = default;
Type type;
Domain domain;
std::string name;
};

View File

@@ -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)
{
const auto printVariableDeclaration =
[&stream, &variableDeclaration](const auto *prefix, auto &variableIDs) -> output::ColorStream &
[&](const auto *prefix, auto &variableIDs) -> output::ColorStream &
{
auto matchingVariableID = variableIDs.find(&variableDeclaration);