mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
YulOpt: Extend StructuralSimplifier to work with all types
This commit is contained in:
parent
a52b50d770
commit
f6e09d6368
@ -59,7 +59,7 @@ boost::optional<dev::u256> StructuralSimplifier::hasLiteralValue(Expression cons
|
||||
if (expr && expr->type() == typeid(Literal))
|
||||
{
|
||||
Literal const& literal = boost::get<Literal>(*expr);
|
||||
return valueOfNumberLiteral(literal);
|
||||
return valueOfLiteral(literal);
|
||||
}
|
||||
|
||||
return boost::optional<u256>();
|
||||
@ -114,7 +114,7 @@ void StructuralSimplifier::simplify(std::vector<yul::Statement>& _statements)
|
||||
|
||||
for (auto& _case: _switchStmt.cases)
|
||||
{
|
||||
if (_case.value && valueOfNumberLiteral(*_case.value) == constExprVal)
|
||||
if (_case.value && valueOfLiteral(*_case.value) == constExprVal)
|
||||
{
|
||||
matchingCaseBlock = &_case.body;
|
||||
break;
|
||||
|
@ -0,0 +1,12 @@
|
||||
{
|
||||
// Used to cause assert error
|
||||
let y := 200
|
||||
switch 3
|
||||
case "" { y := 8 }
|
||||
case 1 { y := 9 }
|
||||
}
|
||||
// ----
|
||||
// structuralSimplifier
|
||||
// {
|
||||
// let y := 200
|
||||
// }
|
Loading…
Reference in New Issue
Block a user