diff --git a/src/liballocator/mem-heap.c b/src/liballocator/mem-heap.c index 23504b796..6870f43f0 100644 --- a/src/liballocator/mem-heap.c +++ b/src/liballocator/mem-heap.c @@ -165,7 +165,8 @@ mem_get_block_chunks_count (const mem_block_header_t *block_header_p) /**< block if (next_block_p == NULL) { dist_till_block_end = (size_t) (mem_heap.heap_start + mem_heap.heap_size - (uint8_t*) block_header_p); - } else + } + else { dist_till_block_end = (size_t) ((uint8_t*) next_block_p - (uint8_t*) block_header_p); } @@ -263,7 +264,8 @@ mem_init_block_header (uint8_t *first_chunk_p, /**< address of the first block_header_p->magic_num = MEM_MAGIC_NUM_OF_FREE_BLOCK; JERRY_ASSERT(allocated_bytes == 0); - } else + } + else { block_header_p->magic_num = MEM_MAGIC_NUM_OF_ALLOCATED_BLOCK; } @@ -303,7 +305,8 @@ mem_heap_alloc_block (size_t size_in_bytes, /**< size of region to all { block_p = mem_heap.first_block_p; direction = MEM_DIRECTION_NEXT; - } else + } + else { block_p = mem_heap.last_block_p; direction = MEM_DIRECTION_PREV; @@ -320,7 +323,8 @@ mem_heap_alloc_block (size_t size_in_bytes, /**< size of region to all { break; } - } else + } + else { JERRY_ASSERT(block_p->magic_num == MEM_MAGIC_NUM_OF_ALLOCATED_BLOCK); } @@ -630,7 +634,8 @@ mem_check_heap (void) is_last_block_was_met = true; JERRY_ASSERT(next_block_p == NULL); - } else + } + else { JERRY_ASSERT(next_block_p != NULL); } @@ -661,7 +666,8 @@ mem_check_heap (void) is_first_block_was_met = true; JERRY_ASSERT(prev_block_p == NULL); - } else + } + else { JERRY_ASSERT(prev_block_p != NULL); } diff --git a/src/liballocator/mem-poolman.c b/src/liballocator/mem-poolman.c index f3c21d2d6..ffd1be688 100644 --- a/src/liballocator/mem-poolman.c +++ b/src/liballocator/mem-poolman.c @@ -193,7 +193,8 @@ mem_pools_free (uint8_t *chunk_p) /**< pointer to the chunk */ if (prev_pool_state != NULL) { prev_pool_state->next_pool_cp = pool_state->next_pool_cp; - } else + } + else { if (pool_state->next_pool_cp == MEM_COMPRESSED_POINTER_NULL) { diff --git a/src/libecmaobjects/ecma-helpers.c b/src/libecmaobjects/ecma-helpers.c index c8575926f..a99516401 100644 --- a/src/libecmaobjects/ecma-helpers.c +++ b/src/libecmaobjects/ecma-helpers.c @@ -287,10 +287,12 @@ ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in if (property_p->type == ECMA_PROPERTY_NAMEDDATA) { property_name_p = ECMA_GET_POINTER(property_p->u.named_data_property.name_p); - } else if (property_p->type == ECMA_PROPERTY_NAMEDACCESSOR) + } + else if (property_p->type == ECMA_PROPERTY_NAMEDACCESSOR) { property_name_p = ECMA_GET_POINTER(property_p->u.named_accessor_property.name_p); - } else + } + else { continue; } @@ -468,7 +470,8 @@ ecma_delete_property (ecma_object_t *obj_p, /**< object */ if (prev_prop_p == NULL) { ECMA_SET_POINTER(obj_p->properties_p, next_prop_p); - } else + } + else { ECMA_SET_POINTER(prev_prop_p->next_property_p, next_prop_p); } diff --git a/src/libecmaoperations/ecma-comparison.c b/src/libecmaoperations/ecma-comparison.c index c32da69b5..007725058 100644 --- a/src/libecmaoperations/ecma-comparison.c +++ b/src/libecmaoperations/ecma-comparison.c @@ -68,7 +68,8 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */ { // a., b. return true; - } else if (is_x_number) + } + else if (is_x_number) { // c. ecma_number_t x_num = *(ecma_number_t*)(ECMA_GET_POINTER(x.value)); ecma_number_t y_num = *(ecma_number_t*)(ECMA_GET_POINTER(y.value)); @@ -76,26 +77,31 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */ TODO(Implement according to ECMA); return (x_num == y_num); - } else if (is_x_string) + } + else if (is_x_string) { // d. ecma_array_first_chunk_t* x_str = (ecma_array_first_chunk_t*)(ECMA_GET_POINTER(x.value)); ecma_array_first_chunk_t* y_str = (ecma_array_first_chunk_t*)(ECMA_GET_POINTER(y.value)); return ecma_compare_ecma_string_to_ecma_string (x_str, y_str); - } else if (is_x_boolean) + } + else if (is_x_boolean) { // e. return (x.value == y.value); - } else + } + else { // f. JERRY_ASSERT(is_x_object); return (x.value == y.value); } - } else if ((is_x_null && is_y_undefined) + } + else if ((is_x_null && is_y_undefined) || (is_x_undefined && is_y_null)) { // 2., 3. return true; - } else + } + else { JERRY_UNIMPLEMENTED(); } diff --git a/src/libecmaoperations/ecma-conversion.c b/src/libecmaoperations/ecma-conversion.c index f857463b2..e37d5db4f 100644 --- a/src/libecmaoperations/ecma-conversion.c +++ b/src/libecmaoperations/ecma-conversion.c @@ -218,11 +218,13 @@ ecma_op_to_boolean (ecma_value_t value) /**< ecma-value */ if (ecma_is_value_boolean (value)) { return ecma_make_simple_completion_value (value.value); - } else if (ecma_is_value_undefined (value) + } + else if (ecma_is_value_undefined (value) || ecma_is_value_null (value)) { return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_FALSE); - } else + } + else { JERRY_UNREACHABLE(); } diff --git a/src/libecmaoperations/ecma-get-put-value.c b/src/libecmaoperations/ecma-get-put-value.c index e45dd573d..0edc8598d 100644 --- a/src/libecmaoperations/ecma-get-put-value.c +++ b/src/libecmaoperations/ecma-get-put-value.c @@ -69,7 +69,8 @@ ecma_op_get_value (ecma_reference_t ref) /**< ECMA-reference */ // GetValue_4.b case 1 /* return [[Get]](base as this, ref.referenced_name_p) */ JERRY_UNIMPLEMENTED(); - } else + } + else { // GetValue_4.b case 2 /* ecma_object_t *obj_p = ecma_ToObject (base); @@ -80,7 +81,8 @@ ecma_op_get_value (ecma_reference_t ref) /**< ECMA-reference */ return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL, ecma_copy_value (property->u.named_data_property.value), ECMA_TARGET_ID_RESERVED); - } else + } + else { JERRY_ASSERT(property->Type == ECMA_PROPERTY_NAMEDACCESSOR); @@ -91,7 +93,8 @@ ecma_op_get_value (ecma_reference_t ref) /**< ECMA-reference */ return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL, ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED), ECMA_TARGET_ID_RESERVED); - } else + } + else { return [[Call]](getter, base as this); } @@ -99,7 +102,8 @@ ecma_op_get_value (ecma_reference_t ref) /**< ECMA-reference */ */ JERRY_UNIMPLEMENTED(); } - } else + } + else { // GetValue_5 ecma_object_t *lex_env_p = ECMA_GET_POINTER(base.value); @@ -136,7 +140,8 @@ ecma_op_put_value (ecma_reference_t ref, /**< ECMA-reference */ if (ref.is_strict) // PutValue_3.a { return ecma_make_throw_value (ecma_new_standard_error (ECMA_ERROR_REFERENCE)); - } else // PutValue_3.b + } + else // PutValue_3.b { ecma_object_t *global_object_p = ecma_get_global_object (); @@ -152,7 +157,8 @@ ecma_op_put_value (ecma_reference_t ref, /**< ECMA-reference */ return ecma_make_empty_completion_value (); } - } else if (is_property_reference) // PutValue_4 + } + else if (is_property_reference) // PutValue_4 { if (!has_primitive_base) // PutValue_4.a { @@ -160,7 +166,8 @@ ecma_op_put_value (ecma_reference_t ref, /**< ECMA-reference */ /* return [[Put]](base as this, ref.referenced_name_p, value, ref.is_strict); */ JERRY_UNIMPLEMENTED(); - } else + } + else { // PutValue_4.b case 2 @@ -176,7 +183,8 @@ ecma_op_put_value (ecma_reference_t ref, /**< ECMA-reference */ if (ref.is_strict) { return ecma_make_throw_value (ecma_new_standard_error (ECMA_ERROR_TYPE)); - } else + } + else { // PutValue_sub_2.b return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL, ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY), @@ -194,7 +202,8 @@ ecma_op_put_value (ecma_reference_t ref, /**< ECMA-reference */ if (ref.is_strict) { return ecma_make_throw_value (ecma_new_standard_error (ECMA_ERROR_TYPE)); - } else + } + else { // PutValue_sub_4.b return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL, ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY), @@ -214,7 +223,8 @@ ecma_op_put_value (ecma_reference_t ref, /**< ECMA-reference */ // PutValue_sub_6.b return [[Call]](setter, base as this, value); - } else // PutValue_sub_7 + } + else // PutValue_sub_7 { // PutValue_sub_7.a if (ref.is_strict) @@ -231,7 +241,8 @@ ecma_op_put_value (ecma_reference_t ref, /**< ECMA-reference */ JERRY_UNIMPLEMENTED(); } - } else + } + else { // PutValue_7 ecma_object_t *lex_env_p = ECMA_GET_POINTER(base.value); diff --git a/src/libecmaoperations/ecma-lex-env.c b/src/libecmaoperations/ecma-lex-env.c index 6e2ca64d1..f74e63927 100644 --- a/src/libecmaoperations/ecma-lex-env.c +++ b/src/libecmaoperations/ecma-lex-env.c @@ -264,13 +264,15 @@ ecma_op_get_binding_value (ecma_object_t *lex_env_p, /**< lexical environment */ return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL, ecma_copy_value (prop_value, true), ECMA_TARGET_ID_RESERVED); - } else if (ecma_is_value_empty (prop_value)) + } + else if (ecma_is_value_empty (prop_value)) { /* unitialized immutable binding */ if (is_strict) { return ecma_make_throw_value (ecma_new_standard_error (ECMA_ERROR_REFERENCE)); - } else + } + else { return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_UNDEFINED); } @@ -329,14 +331,16 @@ ecma_op_delete_binding (ecma_object_t *lex_env_p, /**< lexical environment */ if (prop_p == NULL) { ret_val = ECMA_SIMPLE_VALUE_TRUE; - } else + } + else { JERRY_ASSERT(prop_p->type == ECMA_PROPERTY_NAMEDDATA); if (prop_p->u.named_data_property.configurable == ECMA_PROPERTY_NOT_CONFIGURABLE) { ret_val = ECMA_SIMPLE_VALUE_FALSE; - } else + } + else { ecma_delete_property (lex_env_p, prop_p); diff --git a/src/libecmaoperations/ecma-reference.c b/src/libecmaoperations/ecma-reference.c index 795165b65..bbf69372d 100644 --- a/src/libecmaoperations/ecma-reference.c +++ b/src/libecmaoperations/ecma-reference.c @@ -58,7 +58,8 @@ ecma_op_get_identifier_reference (ecma_object_t *lex_env_p, /**< lexical environ return ecma_make_reference (ecma_make_object_value (lex_env_iter_p), name_p, is_strict); - } else + } + else { JERRY_ASSERT(ecma_is_completion_value_normal_false (completion_value)); }