Reset Yul string repository before each compilation.

This commit is contained in:
Bhargava Shastry
2019-05-28 13:12:39 +02:00
committed by chriseth
parent b95eebee1c
commit dbae0fa939
19 changed files with 89 additions and 30 deletions
+4 -5
View File
@@ -29,17 +29,16 @@ void VarDeclInitializer::operator()(Block& _block)
{
ASTModifier::operator()(_block);
static Expression const zero{Literal{{}, LiteralKind::Number, YulString{"0"}, {}}};
using OptionalStatements = boost::optional<vector<Statement>>;
GenericFallbackReturnsVisitor<OptionalStatements, VariableDeclaration> visitor{
[](VariableDeclaration& _varDecl) -> OptionalStatements
{
if (_varDecl.value)
return {};
else if (_varDecl.variables.size() == 1)
Literal zero{{}, LiteralKind::Number, YulString{"0"}, {}};
if (_varDecl.variables.size() == 1)
{
_varDecl.value = make_unique<Expression>(zero);
_varDecl.value = make_unique<Expression>(std::move(zero));
return {};
}
else
@@ -47,7 +46,7 @@ void VarDeclInitializer::operator()(Block& _block)
OptionalStatements ret{vector<Statement>{}};
langutil::SourceLocation loc{std::move(_varDecl.location)};
for (auto& var: _varDecl.variables)
ret->push_back(VariableDeclaration{loc, {std::move(var)}, make_unique<Expression>(zero)});
ret->emplace_back(VariableDeclaration{loc, {std::move(var)}, make_unique<Expression>(zero)});
return ret;
}
}