Dropping now unused body variable names.

This commit is contained in:
Patrick Lühne 2017-05-30 16:20:57 +02:00
parent 1917f18b6a
commit 9a3c85dc83
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
2 changed files with 11 additions and 17 deletions

View File

@ -290,7 +290,6 @@ struct Variable
struct VariableDeclaration struct VariableDeclaration
{ {
// TODO: remove
enum class Type enum class Type
{ {
UserDefined, UserDefined,
@ -298,9 +297,14 @@ struct VariableDeclaration
Body Body
}; };
explicit VariableDeclaration(Type type)
: type{type}
{
}
explicit VariableDeclaration(std::string &&name, Type type) explicit VariableDeclaration(std::string &&name, Type type)
: name{std::move(name)}, : type{type},
type{type} name{std::move(name)}
{ {
} }
@ -309,8 +313,8 @@ struct VariableDeclaration
VariableDeclaration(VariableDeclaration &&other) = default; VariableDeclaration(VariableDeclaration &&other) = default;
VariableDeclaration &operator=(VariableDeclaration &&other) = default; VariableDeclaration &operator=(VariableDeclaration &&other) = default;
std::string name;
Type type; Type type;
std::string name;
}; };
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -40,16 +40,6 @@ ast::Comparison::Operator translate(Clingo::AST::ComparisonOperator comparisonOp
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
std::unique_ptr<ast::VariableDeclaration> makeBodyVariableDeclaration(int i)
{
// TODO: drop name
auto variableName = "#" + std::string(BodyVariablePrefix) + std::to_string(i);
return std::make_unique<ast::VariableDeclaration>(std::move(variableName), ast::VariableDeclaration::Type::Body);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
struct BodyTermTranslateVisitor struct BodyTermTranslateVisitor
{ {
// TODO: refactor // TODO: refactor
@ -75,7 +65,7 @@ struct BodyTermTranslateVisitor
variableStack.push(&parameters); variableStack.push(&parameters);
for (size_t i = 0; i < function.arguments.size(); i++) for (size_t i = 0; i < function.arguments.size(); i++)
parameters.emplace_back(makeBodyVariableDeclaration(i + 1)); parameters.emplace_back(std::make_unique<ast::VariableDeclaration>(ast::VariableDeclaration::Type::Body));
ast::And conjunction; ast::And conjunction;
@ -134,8 +124,8 @@ struct BodyLiteralTranslateVisitor
std::vector<std::unique_ptr<ast::VariableDeclaration>> parameters; std::vector<std::unique_ptr<ast::VariableDeclaration>> parameters;
parameters.reserve(2); parameters.reserve(2);
parameters.emplace_back(makeBodyVariableDeclaration(1)); parameters.emplace_back(std::make_unique<ast::VariableDeclaration>(ast::VariableDeclaration::Type::Body));
parameters.emplace_back(makeBodyVariableDeclaration(2)); parameters.emplace_back(std::make_unique<ast::VariableDeclaration>(ast::VariableDeclaration::Type::Body));
ast::And conjunction; ast::And conjunction;
conjunction.arguments.reserve(3); conjunction.arguments.reserve(3);