Update to let inlining

This commit is contained in:
Martin Blicha 2023-08-11 21:39:51 +02:00
parent bbd7ef447f
commit 4101c67cba

View File

@ -484,8 +484,8 @@ namespace
SMTLib2Expression & operator[](std::string const& varName)
{
auto it = bindings.find(varName);
assert(it != bindings.end());
assert(!it->second.empty());
solAssert(it != bindings.end());
solAssert(!it->second.empty());
return it->second.back();
}
@ -529,14 +529,14 @@ namespace
auto const& atom = asAtom(expr);
if (bindings.has(atom))
expr = bindings[atom];
return;
}
else
{
auto& subexprs = asSubExpressions(expr);
assert(!subexprs.empty());
solAssert(!subexprs.empty());
auto const& first = subexprs.at(0);
if (isAtom(first) && asAtom(first) == "let")
{
solAssert(subexprs.size() >= 3);
solAssert(!isAtom(subexprs[1]));
auto& bindingExpressions = asSubExpressions(subexprs[1]);
// process new bindings
@ -551,7 +551,7 @@ namespace
newBindings.emplace_back(asAtom(bindingPair.at(0)), bindingPair.at(1));
}
bindings.pushScope();
for (auto&& [name, expr] : newBindings)
for (auto&& [name, expr]: newBindings)
bindings.addBinding(std::move(name), std::move(expr));
newBindings.clear();
@ -571,7 +571,6 @@ namespace
inlineLetExpressions(subexpr, bindings);
}
}
}
void inlineLetExpressions(SMTLib2Expression& expr)
{