This commit is contained in:
Bhargava Shastry 2020-05-01 19:41:59 +02:00
parent f92f2ed78a
commit 00def2f4fa
2 changed files with 12 additions and 3 deletions

View File

@ -168,10 +168,18 @@ string ProtoConverter::visit(Expression const& _expr)
switch (_expr.expr_oneof_case())
{
case Expression::kV:
{
solAssert(varAvailable(), "Sol arith fuzzer: Varref unavaileble");
return visit(_expr.v());
string v = visit(_expr.v());
if (!m_exprSignMap.count(&_expr))
m_exprSignMap.emplace(&_expr, m_varTypeMap[v].first);
}
case Expression::kBop:
return visit(_expr.bop());
{
string b = visit(_expr.bop());
if (!m_exprSignMap.count(&_expr))
m_exprSignMap.emplace(&_expr, m_varTypeMap[v].first);
}
case Expression::EXPR_ONEOF_NOT_SET:
return "v0";
}

View File

@ -108,7 +108,8 @@ private:
unsigned m_varCounter = 0;
std::shared_ptr<SolRandomNumGenerator> m_rand;
std::map<std::string, std::string> m_varTypeMap;
std::map<std::string, std::pair<Sign, std::string>> m_varTypeMap;
std::map<Expression const*, Sign> m_exprSignMap;
std::string m_returnType;
};
}