Warn on YUL switch statement with only default statement

This commit is contained in:
Harikrishnan Mulackal
2020-06-09 12:32:53 +02:00
committed by chriseth
parent ecaedebe53
commit 73e634924e
3 changed files with 9 additions and 0 deletions
+7
View File
@@ -359,6 +359,13 @@ void AsmAnalyzer::operator()(Switch const& _switch)
{
yulAssert(_switch.expression, "");
if (_switch.cases.size() == 1 && !_switch.cases[0].value)
m_errorReporter.warning(
1878_error,
_switch.location,
"\"switch\" statement with only a default case."
);
YulString valueType = expectExpression(*_switch.expression);
set<u256> cases;