aboutsummaryrefslogtreecommitdiff
path: root/jerry-core/ecma/builtin-objects/typedarray
diff options
context:
space:
mode:
authorAkos Kiss <akiss@inf.u-szeged.hu>2018-05-25 07:27:30 +0200
committerGitHub <noreply@github.com>2018-05-25 07:27:30 +0200
commit47794512846d74a1255016ea087ab2003d1f1d6b (patch)
tree810f358e59bc308655d5954d0c5c4177a38a6d8a /jerry-core/ecma/builtin-objects/typedarray
parentacb3e71436fab7ed129747e8c825763703f6e07b (diff)
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
Diffstat (limited to 'jerry-core/ecma/builtin-objects/typedarray')
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.c
index 617005ce..8aff794f 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.c
@@ -90,8 +90,7 @@ ecma_typedarray_helper_get_shift_size (uint8_t builtin_id) /**< the builtin id o
#endif /* CONFIG_ECMA_NUMBER_TYPE == CONFIG_ECMA_NUMBER_FLOAT64 */
default:
{
- JERRY_ASSERT (false);
- return ECMA_BUILTIN_ID__COUNT;
+ JERRY_UNREACHABLE ();
}
}
} /* ecma_typedarray_helper_get_shift_size */
@@ -125,8 +124,7 @@ ecma_typedarray_helper_get_magic_string (uint8_t builtin_id) /**< the builtin id
#endif /* CONFIG_ECMA_NUMBER_TYPE == CONFIG_ECMA_NUMBER_FLOAT64 */
default:
{
- JERRY_ASSERT (false);
- return LIT_MAGIC_STRING__COUNT;
+ JERRY_UNREACHABLE ();
}
}
#undef TYPEDARRAY_ID_CASE
@@ -161,8 +159,7 @@ ecma_typedarray_helper_get_prototype_id (uint8_t builtin_id) /**< the builtin id
#endif /* CONFIG_ECMA_NUMBER_TYPE == CONFIG_ECMA_NUMBER_FLOAT64 */
default:
{
- JERRY_ASSERT (false);
- return ECMA_BUILTIN_ID__COUNT;
+ JERRY_UNREACHABLE ();
}
}
#undef TYPEDARRAY_ID_CASE