Increase code cost for branching statements.

This commit is contained in:
chriseth
2019-04-25 17:08:11 +02:00
parent 6292adbde6
commit bf104f718f
5 changed files with 107 additions and 27 deletions
+10
View File
@@ -63,6 +63,16 @@ void CodeSize::visit(Statement const& _statement)
{
if (_statement.type() == typeid(FunctionDefinition) && m_ignoreFunctions)
return;
else if (
_statement.type() == typeid(If) ||
_statement.type() == typeid(Break) ||
_statement.type() == typeid(Continue)
)
m_size += 2;
else if (_statement.type() == typeid(ForLoop))
m_size += 3;
else if (_statement.type() == typeid(Switch))
m_size += 1 + 2 * boost::get<Switch>(_statement).cases.size();
else if (!(
_statement.type() == typeid(Block) ||
_statement.type() == typeid(ExpressionStatement) ||