Cleanup code around JERRY_UNREACHABLEs (#2342)
`JERRY_UNREACHABLE`s often signal code structure that could be improved: they can usually either be rewritten to `JERRY_ASSERT`s or eliminated by restructuring loops, `if`s or `#if`s. Roughly, the only valid occurences are in default cases of `switch`es. And even they can often be merged into non-default cases. Moreover, it is dangerous to write meaningful code after `JERRY_UNREACHABLE` because it pretends as if there was a way to recover from an impossible situation. This patch rewrites/eliminates `JERRY_UNREACHABLE`s where possible and removes misleading code from after them. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
@@ -264,13 +264,10 @@ ecma_builtin_global_object_parse_int (ecma_value_t this_arg, /**< this argument
|
||||
{
|
||||
current_number = (ecma_number_t) current_char - LIT_CHAR_UPPERCASE_A + 10;
|
||||
}
|
||||
else if (lit_char_is_decimal_digit (current_char))
|
||||
{
|
||||
current_number = (ecma_number_t) current_char - LIT_CHAR_0;
|
||||
}
|
||||
else
|
||||
{
|
||||
JERRY_UNREACHABLE ();
|
||||
JERRY_ASSERT (lit_char_is_decimal_digit (current_char));
|
||||
current_number = (ecma_number_t) current_char - LIT_CHAR_0;
|
||||
}
|
||||
|
||||
value += current_number * multiplier;
|
||||
|
||||
Reference in New Issue
Block a user