Dropping now unused body variable names.
This commit is contained in:
parent
1917f18b6a
commit
9a3c85dc83
@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -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(¶meters);
|
variableStack.push(¶meters);
|
||||||
|
|
||||||
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user