mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Warn on YUL switch statement with only default statement
This commit is contained in:
parent
ecaedebe53
commit
73e634924e
@ -359,6 +359,13 @@ void AsmAnalyzer::operator()(Switch const& _switch)
|
|||||||
{
|
{
|
||||||
yulAssert(_switch.expression, "");
|
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);
|
YulString valueType = expectExpression(*_switch.expression);
|
||||||
|
|
||||||
set<u256> cases;
|
set<u256> cases;
|
||||||
|
@ -29,3 +29,4 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning: (141-190): "switch" statement with only a default case.
|
||||||
|
@ -23,3 +23,4 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning: (142-191): "switch" statement with only a default case.
|
||||||
|
Loading…
Reference in New Issue
Block a user