Reordered constructor parameters of VariableDeclaration.

This commit is contained in:
Patrick Lühne 2017-05-30 16:27:45 +02:00
parent 9a3c85dc83
commit f78c0e4da5
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
4 changed files with 5 additions and 5 deletions

View File

@ -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)}
{

View File

@ -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<ast::VariableDeclaration>(std::move(variableName), ast::VariableDeclaration::Type::Head);
auto variableDeclaration = std::make_unique<ast::VariableDeclaration>(ast::VariableDeclaration::Type::Head, std::move(variableName));
ruleContext.freeVariables.emplace_back(std::move(variableDeclaration));
}

View File

@ -93,7 +93,7 @@ struct TermTranslateVisitor
if (!isUndeclared)
return ast::Term::make<ast::Variable>(*matchingVariableDeclaration);
auto variableDeclaration = std::make_unique<ast::VariableDeclaration>(std::string(variable.name), ast::VariableDeclaration::Type::UserDefined);
auto variableDeclaration = std::make_unique<ast::VariableDeclaration>(ast::VariableDeclaration::Type::UserDefined, std::string(variable.name));
ruleContext.freeVariables.emplace_back(std::move(variableDeclaration));
return ast::Term::make<ast::Variable>(ruleContext.freeVariables.back().get());

View File

@ -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<VariableDeclaration>(std::string(variable.declaration->name), variable.declaration->type);
auto newVariableDeclaration = std::make_unique<VariableDeclaration>(variable.declaration->type, std::string(variable.declaration->name));
scopedFormula.freeVariables.emplace_back(std::move(newVariableDeclaration));
replacements[variable.declaration] = scopedFormula.freeVariables.back().get();