From 9a3c85dc835feb56132c0fa346f157a0fa829393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Tue, 30 May 2017 16:20:57 +0200 Subject: [PATCH] Dropping now unused body variable names. --- include/anthem/AST.h | 12 ++++++++---- include/anthem/Body.h | 16 +++------------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/include/anthem/AST.h b/include/anthem/AST.h index ce76ad6..d4e9dc2 100644 --- a/include/anthem/AST.h +++ b/include/anthem/AST.h @@ -290,7 +290,6 @@ struct Variable struct VariableDeclaration { - // TODO: remove enum class Type { UserDefined, @@ -298,9 +297,14 @@ struct VariableDeclaration Body }; + explicit VariableDeclaration(Type type) + : 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 &operator=(VariableDeclaration &&other) = default; - std::string name; Type type; + std::string name; }; //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/include/anthem/Body.h b/include/anthem/Body.h index 710c10c..8c78ef7 100644 --- a/include/anthem/Body.h +++ b/include/anthem/Body.h @@ -40,16 +40,6 @@ ast::Comparison::Operator translate(Clingo::AST::ComparisonOperator comparisonOp //////////////////////////////////////////////////////////////////////////////////////////////////// -std::unique_ptr makeBodyVariableDeclaration(int i) -{ - // TODO: drop name - auto variableName = "#" + std::string(BodyVariablePrefix) + std::to_string(i); - - return std::make_unique(std::move(variableName), ast::VariableDeclaration::Type::Body); -} - -//////////////////////////////////////////////////////////////////////////////////////////////////// - struct BodyTermTranslateVisitor { // TODO: refactor @@ -75,7 +65,7 @@ struct BodyTermTranslateVisitor variableStack.push(¶meters); for (size_t i = 0; i < function.arguments.size(); i++) - parameters.emplace_back(makeBodyVariableDeclaration(i + 1)); + parameters.emplace_back(std::make_unique(ast::VariableDeclaration::Type::Body)); ast::And conjunction; @@ -134,8 +124,8 @@ struct BodyLiteralTranslateVisitor std::vector> parameters; parameters.reserve(2); - parameters.emplace_back(makeBodyVariableDeclaration(1)); - parameters.emplace_back(makeBodyVariableDeclaration(2)); + parameters.emplace_back(std::make_unique(ast::VariableDeclaration::Type::Body)); + parameters.emplace_back(std::make_unique(ast::VariableDeclaration::Type::Body)); ast::And conjunction; conjunction.arguments.reserve(3);