From f78c0e4da564fc7441d3b46b24232468abc8a730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Tue, 30 May 2017 16:27:45 +0200 Subject: [PATCH] Reordered constructor parameters of VariableDeclaration. --- include/anthem/AST.h | 2 +- include/anthem/StatementVisitor.h | 2 +- include/anthem/Term.h | 2 +- src/anthem/ASTCopy.cpp | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/anthem/AST.h b/include/anthem/AST.h index d4e9dc2..7a23101 100644 --- a/include/anthem/AST.h +++ b/include/anthem/AST.h @@ -302,7 +302,7 @@ struct VariableDeclaration { } - explicit VariableDeclaration(std::string &&name, Type type) + explicit VariableDeclaration(Type type, std::string &&name) : type{type}, name{std::move(name)} { diff --git a/include/anthem/StatementVisitor.h b/include/anthem/StatementVisitor.h index 226e4f9..744ac7e 100644 --- a/include/anthem/StatementVisitor.h +++ b/include/anthem/StatementVisitor.h @@ -63,7 +63,7 @@ struct StatementVisitor { // TODO: drop name auto variableName = "#" + std::string(HeadVariablePrefix) + std::to_string(ruleContext.freeVariables.size() + 1); - auto variableDeclaration = std::make_unique(std::move(variableName), ast::VariableDeclaration::Type::Head); + auto variableDeclaration = std::make_unique(ast::VariableDeclaration::Type::Head, std::move(variableName)); ruleContext.freeVariables.emplace_back(std::move(variableDeclaration)); } diff --git a/include/anthem/Term.h b/include/anthem/Term.h index 3b10fac..c220cf3 100644 --- a/include/anthem/Term.h +++ b/include/anthem/Term.h @@ -93,7 +93,7 @@ struct TermTranslateVisitor if (!isUndeclared) return ast::Term::make(*matchingVariableDeclaration); - auto variableDeclaration = std::make_unique(std::string(variable.name), ast::VariableDeclaration::Type::UserDefined); + auto variableDeclaration = std::make_unique(ast::VariableDeclaration::Type::UserDefined, std::string(variable.name)); ruleContext.freeVariables.emplace_back(std::move(variableDeclaration)); return ast::Term::make(ruleContext.freeVariables.back().get()); diff --git a/src/anthem/ASTCopy.cpp b/src/anthem/ASTCopy.cpp index 8f6bc59..79dcff5 100644 --- a/src/anthem/ASTCopy.cpp +++ b/src/anthem/ASTCopy.cpp @@ -218,7 +218,7 @@ Variable prepareCopy(const Variable &other) VariableDeclaration prepareCopy(const VariableDeclaration &other) { - return VariableDeclaration(std::string(other.name), other.type); + return VariableDeclaration(other.type, std::string(other.name)); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -389,7 +389,7 @@ struct FixDanglingVariablesInTermVisitor return; // If the variable is dangling, declare it correctly and flag it for future replacement - auto newVariableDeclaration = std::make_unique(std::string(variable.declaration->name), variable.declaration->type); + auto newVariableDeclaration = std::make_unique(variable.declaration->type, std::string(variable.declaration->name)); scopedFormula.freeVariables.emplace_back(std::move(newVariableDeclaration)); replacements[variable.declaration] = scopedFormula.freeVariables.back().get();