From 0b592470d50ee9b5e97bd863d43af79897bfa79f Mon Sep 17 00:00:00 2001 From: Ruben Ayrapetyan Date: Mon, 11 Aug 2014 19:34:49 +0400 Subject: [PATCH] Style fixes in libecmaoperations: space between function name and opening parenthesis, no space after opening parenthesis/before closing parenthesis. By mistake, the changes weren't commited with 8081e5cdb38ad0f9789a89c92362fc73a716d85c. --- src/libecmaoperations/ecma-comparison.c | 108 ++--- src/libecmaoperations/ecma-comparison.h | 4 +- src/libecmaoperations/ecma-conversion.c | 140 +++---- src/libecmaoperations/ecma-conversion.h | 12 +- src/libecmaoperations/ecma-exceptions.c | 4 +- src/libecmaoperations/ecma-exceptions.h | 2 +- src/libecmaoperations/ecma-finalize.c | 4 +- src/libecmaoperations/ecma-function-object.c | 152 +++---- src/libecmaoperations/ecma-function-object.h | 8 +- src/libecmaoperations/ecma-get-put-value.c | 142 +++---- src/libecmaoperations/ecma-global-object.c | 26 +- src/libecmaoperations/ecma-global-object.h | 6 +- src/libecmaoperations/ecma-lex-env.c | 224 +++++------ src/libecmaoperations/ecma-lex-env.h | 18 +- src/libecmaoperations/ecma-magic-strings.c | 6 +- src/libecmaoperations/ecma-magic-strings.h | 2 +- .../ecma-number-arithmetic.c | 26 +- .../ecma-number-arithmetic.h | 12 +- .../ecma-objects-properties.c | 370 +++++++++--------- .../ecma-objects-properties.h | 18 +- src/libecmaoperations/ecma-operations.h | 8 +- src/libecmaoperations/ecma-reference.c | 26 +- src/libecmaoperations/ecma-reference.h | 6 +- src/libecmaoperations/ecma-try-catch-macro.h | 8 +- 24 files changed, 666 insertions(+), 666 deletions(-) diff --git a/src/libecmaoperations/ecma-comparison.c b/src/libecmaoperations/ecma-comparison.c index 152b60dcd..bd0de1e37 100644 --- a/src/libecmaoperations/ecma-comparison.c +++ b/src/libecmaoperations/ecma-comparison.c @@ -35,64 +35,64 @@ * false - otherwise. */ bool -ecma_op_abstract_equality_compare(ecma_value_t x, /**< first operand */ +ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */ ecma_value_t y) /**< second operand */ { - const bool is_x_undefined = ecma_is_value_undefined( x); - const bool is_x_null = ecma_is_value_null( x); - const bool is_x_boolean = ecma_is_value_boolean( x); - const bool is_x_number = ( x.value_type == ECMA_TYPE_NUMBER ); - const bool is_x_string = ( x.value_type == ECMA_TYPE_STRING ); - const bool is_x_object = ( x.value_type == ECMA_TYPE_OBJECT ); + const bool is_x_undefined = ecma_is_value_undefined (x); + const bool is_x_null = ecma_is_value_null (x); + const bool is_x_boolean = ecma_is_value_boolean (x); + const bool is_x_number = (x.value_type == ECMA_TYPE_NUMBER); + const bool is_x_string = (x.value_type == ECMA_TYPE_STRING); + const bool is_x_object = (x.value_type == ECMA_TYPE_OBJECT); - const bool is_y_undefined = ecma_is_value_undefined( y); - const bool is_y_null = ecma_is_value_null( y); - const bool is_y_boolean = ecma_is_value_boolean( y); - const bool is_y_number = ( y.value_type == ECMA_TYPE_NUMBER ); - const bool is_y_string = ( y.value_type == ECMA_TYPE_STRING ); - const bool is_y_object = ( y.value_type == ECMA_TYPE_OBJECT ); + const bool is_y_undefined = ecma_is_value_undefined (y); + const bool is_y_null = ecma_is_value_null (y); + const bool is_y_boolean = ecma_is_value_boolean (y); + const bool is_y_number = (y.value_type == ECMA_TYPE_NUMBER); + const bool is_y_string = (y.value_type == ECMA_TYPE_STRING); + const bool is_y_object = (y.value_type == ECMA_TYPE_OBJECT); - const bool is_types_equal = ( ( is_x_undefined && is_y_undefined ) - || ( is_x_null && is_y_null ) - || ( is_x_boolean && is_y_boolean ) - || ( is_x_number && is_y_number ) - || ( is_x_string && is_y_string ) - || ( is_x_object && is_y_object ) ); + const bool is_types_equal = ((is_x_undefined && is_y_undefined) + || (is_x_null && is_y_null) + || (is_x_boolean && is_y_boolean) + || (is_x_number && is_y_number) + || (is_x_string && is_y_string) + || (is_x_object && is_y_object)); - if ( is_types_equal ) + if (is_types_equal) { // 1. - if ( is_x_undefined - || is_x_null ) + if (is_x_undefined + || is_x_null) { // 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) ); + 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)); - TODO( Implement according to ECMA ); + 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) ); + 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 ) + return ecma_compare_ecma_string_to_ecma_string (x_str, y_str); + } else if (is_x_boolean) { // e. - return ( x.value == y.value ); + return (x.value == y.value); } else { // f. - JERRY_ASSERT( is_x_object ); + JERRY_ASSERT(is_x_object); - return ( x.value == y.value ); + return (x.value == y.value); } - } else if ( ( is_x_null && is_y_undefined ) - || ( is_x_undefined && is_y_null ) ) + } else if ((is_x_null && is_y_undefined) + || (is_x_undefined && is_y_null)) { // 2., 3. return true; } else @@ -110,7 +110,7 @@ ecma_op_abstract_equality_compare(ecma_value_t x, /**< first operand */ * Returned value must be freed with ecma_free_completion_value */ ecma_completion_value_t -ecma_op_abstract_relational_compare(ecma_value_t x, /**< first operand */ +ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */ ecma_value_t y, /**< second operand */ bool left_first) /**< 'LeftFirst' flag */ { @@ -120,51 +120,51 @@ ecma_op_abstract_relational_compare(ecma_value_t x, /**< first operand */ ecma_value_t second_converted_value = left_first ? y : x; // 1., 2. - ECMA_TRY_CATCH( prim_first_converted_value, ecma_op_to_primitive( first_converted_value, ECMA_PREFERRED_TYPE_NUMBER), ret_value); - ECMA_TRY_CATCH( prim_second_converted_value, ecma_op_to_primitive( second_converted_value, ECMA_PREFERRED_TYPE_NUMBER), ret_value); + ECMA_TRY_CATCH(prim_first_converted_value, ecma_op_to_primitive (first_converted_value, ECMA_PREFERRED_TYPE_NUMBER), ret_value); + ECMA_TRY_CATCH(prim_second_converted_value, ecma_op_to_primitive (second_converted_value, ECMA_PREFERRED_TYPE_NUMBER), ret_value); px = left_first ? prim_first_converted_value : prim_second_converted_value; py = left_first ? prim_second_converted_value : prim_first_converted_value; - const bool is_px_string = ( px.value.value_type == ECMA_TYPE_STRING ); - const bool is_py_string = ( py.value.value_type == ECMA_TYPE_STRING ); + const bool is_px_string = (px.value.value_type == ECMA_TYPE_STRING); + const bool is_py_string = (py.value.value_type == ECMA_TYPE_STRING); - if ( !( is_px_string && is_py_string ) ) + if (!(is_px_string && is_py_string)) { // 3. // a. - ECMA_TRY_CATCH( nx, ecma_op_to_number( px.value), ret_value); + ECMA_TRY_CATCH(nx, ecma_op_to_number (px.value), ret_value); // b. - ECMA_TRY_CATCH( ny, ecma_op_to_number( py.value), ret_value); + ECMA_TRY_CATCH(ny, ecma_op_to_number (py.value), ret_value); - ecma_number_t* num_x_p = (ecma_number_t*)ECMA_GET_POINTER( nx.value.value); - ecma_number_t* num_y_p = (ecma_number_t*)ECMA_GET_POINTER( ny.value.value); + ecma_number_t* num_x_p = (ecma_number_t*)ECMA_GET_POINTER(nx.value.value); + ecma_number_t* num_y_p = (ecma_number_t*)ECMA_GET_POINTER(ny.value.value); - TODO( /* Implement according to ECMA */ ); + TODO(/* Implement according to ECMA */); - if ( *num_x_p >= *num_y_p ) + if (*num_x_p >= *num_y_p) { ret_value = ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL, - ecma_make_simple_value( ECMA_SIMPLE_VALUE_FALSE), + ecma_make_simple_value (ECMA_SIMPLE_VALUE_FALSE), ECMA_TARGET_ID_RESERVED); } else { ret_value = ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL, - ecma_make_simple_value( ECMA_SIMPLE_VALUE_TRUE), + ecma_make_simple_value (ECMA_SIMPLE_VALUE_TRUE), ECMA_TARGET_ID_RESERVED); } - ECMA_FINALIZE( ny); - ECMA_FINALIZE( nx); + ECMA_FINALIZE(ny); + ECMA_FINALIZE(nx); } else { // 4. JERRY_UNIMPLEMENTED(); } - ECMA_FINALIZE( prim_second_converted_value); - ECMA_FINALIZE( prim_first_converted_value); + ECMA_FINALIZE(prim_second_converted_value); + ECMA_FINALIZE(prim_first_converted_value); return ret_value; } /* ecma_op_abstract_relational_compare */ diff --git a/src/libecmaoperations/ecma-comparison.h b/src/libecmaoperations/ecma-comparison.h index 18842330a..52375892d 100644 --- a/src/libecmaoperations/ecma-comparison.h +++ b/src/libecmaoperations/ecma-comparison.h @@ -26,8 +26,8 @@ * @{ */ -extern bool ecma_op_abstract_equality_compare( ecma_value_t x, ecma_value_t y); -extern ecma_completion_value_t ecma_op_abstract_relational_compare(ecma_value_t x, ecma_value_t y, bool left_first); +extern bool ecma_op_abstract_equality_compare (ecma_value_t x, ecma_value_t y); +extern ecma_completion_value_t ecma_op_abstract_relational_compare (ecma_value_t x, ecma_value_t y, bool left_first); /** * @} diff --git a/src/libecmaoperations/ecma-conversion.c b/src/libecmaoperations/ecma-conversion.c index 573a77303..fb00c87a0 100644 --- a/src/libecmaoperations/ecma-conversion.c +++ b/src/libecmaoperations/ecma-conversion.c @@ -38,17 +38,17 @@ * Returned value must be freed with ecma_free_completion_value */ ecma_completion_value_t -ecma_op_check_object_coercible( ecma_value_t value) /**< ecma-value */ +ecma_op_check_object_coercible (ecma_value_t value) /**< ecma-value */ { - switch ( (ecma_type_t)value.value_type ) + switch ((ecma_type_t)value.value_type) { case ECMA_TYPE_SIMPLE: { - if ( ecma_is_value_undefined( value) ) + if (ecma_is_value_undefined (value)) { - return ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_TYPE)); + return ecma_make_throw_value (ecma_new_standard_error (ECMA_ERROR_TYPE)); } - else if ( ecma_is_value_boolean( value) ) + else if (ecma_is_value_boolean (value)) { break; } @@ -71,7 +71,7 @@ ecma_op_check_object_coercible( ecma_value_t value) /**< ecma-value */ } } - return ecma_make_empty_completion_value(); + return ecma_make_empty_completion_value (); } /* ecma_op_check_object_coercible */ /** @@ -84,67 +84,67 @@ ecma_op_check_object_coercible( ecma_value_t value) /**< ecma-value */ * false - otherwise. */ bool -ecma_op_same_value( ecma_value_t x, /**< ecma-value */ +ecma_op_same_value (ecma_value_t x, /**< ecma-value */ ecma_value_t y) /**< ecma-value */ { - const bool is_x_undefined = ecma_is_value_undefined( x); - const bool is_x_null = ecma_is_value_null( x); - const bool is_x_boolean = ecma_is_value_boolean( x); - const bool is_x_number = ( x.value_type == ECMA_TYPE_NUMBER ); - const bool is_x_string = ( x.value_type == ECMA_TYPE_STRING ); - const bool is_x_object = ( x.value_type == ECMA_TYPE_OBJECT ); + const bool is_x_undefined = ecma_is_value_undefined (x); + const bool is_x_null = ecma_is_value_null (x); + const bool is_x_boolean = ecma_is_value_boolean (x); + const bool is_x_number = (x.value_type == ECMA_TYPE_NUMBER); + const bool is_x_string = (x.value_type == ECMA_TYPE_STRING); + const bool is_x_object = (x.value_type == ECMA_TYPE_OBJECT); - const bool is_y_undefined = ecma_is_value_undefined( y); - const bool is_y_null = ecma_is_value_null( y); - const bool is_y_boolean = ecma_is_value_boolean( y); - const bool is_y_number = ( y.value_type == ECMA_TYPE_NUMBER ); - const bool is_y_string = ( y.value_type == ECMA_TYPE_STRING ); - const bool is_y_object = ( y.value_type == ECMA_TYPE_OBJECT ); + const bool is_y_undefined = ecma_is_value_undefined (y); + const bool is_y_null = ecma_is_value_null (y); + const bool is_y_boolean = ecma_is_value_boolean (y); + const bool is_y_number = (y.value_type == ECMA_TYPE_NUMBER); + const bool is_y_string = (y.value_type == ECMA_TYPE_STRING); + const bool is_y_object = (y.value_type == ECMA_TYPE_OBJECT); - const bool is_types_equal = ( ( is_x_undefined && is_y_undefined ) - || ( is_x_null && is_y_null ) - || ( is_x_boolean && is_y_boolean ) - || ( is_x_number && is_y_number ) - || ( is_x_string && is_y_string ) - || ( is_x_object && is_y_object ) ); + const bool is_types_equal = ((is_x_undefined && is_y_undefined) + || (is_x_null && is_y_null) + || (is_x_boolean && is_y_boolean) + || (is_x_number && is_y_number) + || (is_x_string && is_y_string) + || (is_x_object && is_y_object)); - if ( !is_types_equal ) + if (!is_types_equal) { return false; } - if ( is_x_undefined - || is_x_null ) + if (is_x_undefined + || is_x_null) { return true; } - if ( is_x_number ) + if (is_x_number) { - TODO( Implement according to ECMA ); + TODO(Implement according to ECMA); - ecma_number_t *x_num_p = (ecma_number_t*)ECMA_GET_POINTER( x.value); - ecma_number_t *y_num_p = (ecma_number_t*)ECMA_GET_POINTER( y.value); + ecma_number_t *x_num_p = (ecma_number_t*)ECMA_GET_POINTER(x.value); + ecma_number_t *y_num_p = (ecma_number_t*)ECMA_GET_POINTER(y.value); - return ( *x_num_p == *y_num_p ); + return (*x_num_p == *y_num_p); } - if ( is_x_string ) + if (is_x_string) { - ecma_array_first_chunk_t* x_str_p = (ecma_array_first_chunk_t*)( ECMA_GET_POINTER(x.value) ); - ecma_array_first_chunk_t* y_str_p = (ecma_array_first_chunk_t*)( ECMA_GET_POINTER(y.value) ); + ecma_array_first_chunk_t* x_str_p = (ecma_array_first_chunk_t*)(ECMA_GET_POINTER(x.value)); + ecma_array_first_chunk_t* y_str_p = (ecma_array_first_chunk_t*)(ECMA_GET_POINTER(y.value)); - return ecma_compare_ecma_string_to_ecma_string( x_str_p, y_str_p); + return ecma_compare_ecma_string_to_ecma_string (x_str_p, y_str_p); } - if ( is_x_boolean ) + if (is_x_boolean) { - return ( ecma_is_value_true( x) == ecma_is_value_true( y) ); + return (ecma_is_value_true (x) == ecma_is_value_true (y)); } - JERRY_ASSERT( is_x_object ); + JERRY_ASSERT(is_x_object); - return ( ECMA_GET_POINTER( x.value) == ECMA_GET_POINTER( y.value) ); + return (ECMA_GET_POINTER(x.value) == ECMA_GET_POINTER(y.value)); } /* ecma_op_same_value */ /** @@ -157,17 +157,17 @@ ecma_op_same_value( ecma_value_t x, /**< ecma-value */ * Returned value must be freed with ecma_free_completion_value */ ecma_completion_value_t -ecma_op_to_primitive( ecma_value_t value, /**< ecma-value */ +ecma_op_to_primitive (ecma_value_t value, /**< ecma-value */ ecma_preferred_type_hint_t preferred_type) /**< preferred type hint */ { - switch ( (ecma_type_t)value.value_type ) + switch ((ecma_type_t)value.value_type) { case ECMA_TYPE_SIMPLE: case ECMA_TYPE_NUMBER: case ECMA_TYPE_STRING: { - return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL, - ecma_copy_value( value, true), + return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL, + ecma_copy_value (value, true), ECMA_TARGET_ID_RESERVED); } case ECMA_TYPE_OBJECT: @@ -194,30 +194,30 @@ ecma_op_to_primitive( ecma_value_t value, /**< ecma-value */ * However, ecma_free_completion_value may be called for it, but it is a no-op. */ ecma_completion_value_t -ecma_op_to_boolean( ecma_value_t value) /**< ecma-value */ +ecma_op_to_boolean (ecma_value_t value) /**< ecma-value */ { - switch ( (ecma_type_t)value.value_type ) + switch ((ecma_type_t)value.value_type) { case ECMA_TYPE_NUMBER: { - ecma_number_t *num_p = ECMA_GET_POINTER( value.value); + ecma_number_t *num_p = ECMA_GET_POINTER(value.value); - TODO( Implement according to ECMA ); + TODO(Implement according to ECMA); - return ecma_make_simple_completion_value( ( *num_p == 0 ) ? ECMA_SIMPLE_VALUE_FALSE - : ECMA_SIMPLE_VALUE_TRUE ); + return ecma_make_simple_completion_value ((*num_p == 0) ? ECMA_SIMPLE_VALUE_FALSE + : ECMA_SIMPLE_VALUE_TRUE); break; } case ECMA_TYPE_SIMPLE: { - if ( ecma_is_value_boolean (value ) ) + if (ecma_is_value_boolean (value)) { - return ecma_make_simple_completion_value( value.value); - } else if ( ecma_is_value_undefined (value) - || ecma_is_value_null( value) ) + return ecma_make_simple_completion_value (value.value); + } else if (ecma_is_value_undefined (value) + || ecma_is_value_null (value)) { - return ecma_make_simple_completion_value( ECMA_SIMPLE_VALUE_FALSE); + return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_FALSE); } else { JERRY_UNREACHABLE(); @@ -227,16 +227,16 @@ ecma_op_to_boolean( ecma_value_t value) /**< ecma-value */ } case ECMA_TYPE_STRING: { - ecma_array_first_chunk_t *str_p = ECMA_GET_POINTER( value.value); + ecma_array_first_chunk_t *str_p = ECMA_GET_POINTER(value.value); - return ecma_make_simple_completion_value( ( str_p->header.unit_number == 0 ) ? ECMA_SIMPLE_VALUE_FALSE - : ECMA_SIMPLE_VALUE_TRUE ); + return ecma_make_simple_completion_value ((str_p->header.unit_number == 0) ? ECMA_SIMPLE_VALUE_FALSE + : ECMA_SIMPLE_VALUE_TRUE); break; } case ECMA_TYPE_OBJECT: { - return ecma_make_simple_completion_value( ECMA_SIMPLE_VALUE_TRUE); + return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE); break; } @@ -259,14 +259,14 @@ ecma_op_to_boolean( ecma_value_t value) /**< ecma-value */ * Returned value must be freed with ecma_free_completion_value */ ecma_completion_value_t -ecma_op_to_number( ecma_value_t value) /**< ecma-value */ +ecma_op_to_number (ecma_value_t value) /**< ecma-value */ { - switch ( (ecma_type_t)value.value_type ) + switch ((ecma_type_t)value.value_type) { case ECMA_TYPE_NUMBER: { - return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL, - ecma_copy_value( value, true), + return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL, + ecma_copy_value (value, true), ECMA_TARGET_ID_RESERVED); } case ECMA_TYPE_SIMPLE: @@ -276,11 +276,11 @@ ecma_op_to_number( ecma_value_t value) /**< ecma-value */ } case ECMA_TYPE_OBJECT: { - ecma_completion_value_t completion_to_primitive = ecma_op_to_primitive( value, ECMA_PREFERRED_TYPE_NUMBER); - JERRY_ASSERT( ecma_is_completion_value_normal( completion_to_primitive) ); + ecma_completion_value_t completion_to_primitive = ecma_op_to_primitive (value, ECMA_PREFERRED_TYPE_NUMBER); + JERRY_ASSERT(ecma_is_completion_value_normal (completion_to_primitive)); - ecma_completion_value_t completion_to_number = ecma_op_to_number( completion_to_primitive.value); - ecma_free_completion_value( completion_to_primitive); + ecma_completion_value_t completion_to_number = ecma_op_to_number (completion_to_primitive.value); + ecma_free_completion_value (completion_to_primitive); return completion_to_number; } @@ -303,9 +303,9 @@ ecma_op_to_number( ecma_value_t value) /**< ecma-value */ * Returned value must be freed with ecma_free_completion_value */ ecma_completion_value_t -ecma_op_to_object( ecma_value_t value) /**< ecma-value */ +ecma_op_to_object (ecma_value_t value) /**< ecma-value */ { - JERRY_UNIMPLEMENTED_REF_UNUSED_VARS( value); + JERRY_UNIMPLEMENTED_REF_UNUSED_VARS(value); } /* ecma_op_to_object */ /** diff --git a/src/libecmaoperations/ecma-conversion.h b/src/libecmaoperations/ecma-conversion.h index 92f918e1e..be1ef4a86 100644 --- a/src/libecmaoperations/ecma-conversion.h +++ b/src/libecmaoperations/ecma-conversion.h @@ -40,12 +40,12 @@ typedef enum ECMA_PREFERRED_TYPE_STRING /**< String */ } ecma_preferred_type_hint_t; -extern ecma_completion_value_t ecma_op_check_object_coercible( ecma_value_t value); -extern bool ecma_op_same_value( ecma_value_t x, ecma_value_t y); -extern ecma_completion_value_t ecma_op_to_primitive( ecma_value_t value, ecma_preferred_type_hint_t preferred_type); -extern ecma_completion_value_t ecma_op_to_boolean( ecma_value_t value); -extern ecma_completion_value_t ecma_op_to_number( ecma_value_t value); -extern ecma_completion_value_t ecma_op_to_object( ecma_value_t value); +extern ecma_completion_value_t ecma_op_check_object_coercible (ecma_value_t value); +extern bool ecma_op_same_value (ecma_value_t x, ecma_value_t y); +extern ecma_completion_value_t ecma_op_to_primitive (ecma_value_t value, ecma_preferred_type_hint_t preferred_type); +extern ecma_completion_value_t ecma_op_to_boolean (ecma_value_t value); +extern ecma_completion_value_t ecma_op_to_number (ecma_value_t value); +extern ecma_completion_value_t ecma_op_to_object (ecma_value_t value); /** * @} diff --git a/src/libecmaoperations/ecma-exceptions.c b/src/libecmaoperations/ecma-exceptions.c index 8c055d477..2377f945c 100644 --- a/src/libecmaoperations/ecma-exceptions.c +++ b/src/libecmaoperations/ecma-exceptions.c @@ -34,9 +34,9 @@ * with reference counter set to one. */ ecma_object_t* -ecma_new_standard_error( ecma_standard_error_t error_type) /**< native error type */ +ecma_new_standard_error (ecma_standard_error_t error_type) /**< native error type */ { - JERRY_UNIMPLEMENTED_REF_UNUSED_VARS( error_type); + JERRY_UNIMPLEMENTED_REF_UNUSED_VARS(error_type); } /* ecma_new_standard_error */ /** diff --git a/src/libecmaoperations/ecma-exceptions.h b/src/libecmaoperations/ecma-exceptions.h index 93f484e2e..fc4f52df9 100644 --- a/src/libecmaoperations/ecma-exceptions.h +++ b/src/libecmaoperations/ecma-exceptions.h @@ -43,7 +43,7 @@ typedef enum ECMA_ERROR_URI /**< URIError */ } ecma_standard_error_t; -extern ecma_object_t *ecma_new_standard_error( ecma_standard_error_t error_type); +extern ecma_object_t *ecma_new_standard_error (ecma_standard_error_t error_type); /** * @} diff --git a/src/libecmaoperations/ecma-finalize.c b/src/libecmaoperations/ecma-finalize.c index d017bd22f..e8613e44c 100644 --- a/src/libecmaoperations/ecma-finalize.c +++ b/src/libecmaoperations/ecma-finalize.c @@ -22,7 +22,7 @@ * ECMA object model finalization routine */ void -ecma_finalize(void) +ecma_finalize (void) { - ecma_finalize_global_object(); + ecma_finalize_global_object (); } /* ecma_finalize */ diff --git a/src/libecmaoperations/ecma-function-object.c b/src/libecmaoperations/ecma-function-object.c index 5ecb0da35..7491d3c85 100644 --- a/src/libecmaoperations/ecma-function-object.c +++ b/src/libecmaoperations/ecma-function-object.c @@ -36,17 +36,17 @@ * @return packed value */ static uint32_t -ecma_pack_code_internal_property_value( bool is_strict, /**< is code strict? */ +ecma_pack_code_internal_property_value (bool is_strict, /**< is code strict? */ opcode_counter_t opcode_idx) /**< index of first opcode */ { uint32_t value = opcode_idx; - const uint32_t is_strict_bit_offset = sizeof(value) * JERRY_BITSINBYTE - 1; + const uint32_t is_strict_bit_offset = sizeof (value) * JERRY_BITSINBYTE - 1; - JERRY_ASSERT( ( ( value ) & ( 1u << is_strict_bit_offset ) ) == 0 ); + JERRY_ASSERT(((value) & (1u << is_strict_bit_offset)) == 0); - if ( is_strict ) + if (is_strict) { - value |= ( 1u << is_strict_bit_offset ); + value |= (1u << is_strict_bit_offset); } return value; @@ -59,17 +59,17 @@ ecma_pack_code_internal_property_value( bool is_strict, /**< is code strict? */ * @return opcode index */ static opcode_counter_t -ecma_unpack_code_internal_property_value( uint32_t value, /**< packed value */ +ecma_unpack_code_internal_property_value (uint32_t value, /**< packed value */ bool* out_is_strict_p) /**< out: is code strict? */ { - JERRY_ASSERT( out_is_strict_p != NULL ); + JERRY_ASSERT(out_is_strict_p != NULL); - const uint32_t is_strict_bit_offset = sizeof(value) * JERRY_BITSINBYTE - 1; + const uint32_t is_strict_bit_offset = sizeof (value) * JERRY_BITSINBYTE - 1; - bool is_strict = ( ( value & ( 1u << is_strict_bit_offset ) ) != 0 ); + bool is_strict = ((value & (1u << is_strict_bit_offset)) != 0); *out_is_strict_p = is_strict; - opcode_counter_t opcode_idx = (opcode_counter_t) ( value & ~( 1u << is_strict_bit_offset ) ); + opcode_counter_t opcode_idx = (opcode_counter_t) (value & ~(1u << is_strict_bit_offset)); return opcode_idx; } /* ecma_unpack_code_internal_property_value */ @@ -83,20 +83,20 @@ ecma_unpack_code_internal_property_value( uint32_t value, /**< packed value */ * false - otherwise. */ bool -ecma_op_is_callable( ecma_value_t value) /**< ecma-value */ +ecma_op_is_callable (ecma_value_t value) /**< ecma-value */ { - if ( value.value_type != ECMA_TYPE_OBJECT ) + if (value.value_type != ECMA_TYPE_OBJECT) { return false; } - ecma_object_t *obj_p = ECMA_GET_POINTER( value.value); + ecma_object_t *obj_p = ECMA_GET_POINTER(value.value); - JERRY_ASSERT( obj_p != NULL ); - JERRY_ASSERT( !obj_p->is_lexical_environment ); + JERRY_ASSERT(obj_p != NULL); + JERRY_ASSERT(!obj_p->is_lexical_environment); - return ( obj_p->u.object.type == ECMA_OBJECT_TYPE_FUNCTION - || obj_p->u.object.type == ECMA_OBJECT_TYPE_BOUND_FUNCTION ); + return (obj_p->u.object.type == ECMA_OBJECT_TYPE_FUNCTION + || obj_p->u.object.type == ECMA_OBJECT_TYPE_BOUND_FUNCTION); } /* ecma_op_is_callable */ /** @@ -107,16 +107,16 @@ ecma_op_is_callable( ecma_value_t value) /**< ecma-value */ * @return pointer to newly created Function object */ ecma_object_t* -ecma_op_create_function_object( const ecma_char_t* formal_parameter_list_p[], /**< formal parameters list */ +ecma_op_create_function_object (const ecma_char_t* formal_parameter_list_p[], /**< formal parameters list */ size_t formal_parameters_number, /**< formal parameters list's length */ ecma_object_t *scope_p, /**< function's scope */ bool is_strict, /**< 'strict' flag */ opcode_counter_t first_opcode_idx) /**< index of first opcode of function's body */ { // 1., 4., 13. - FIXME( Setup prototype of Function object to built-in Function prototype object (15.3.3.1) ); + FIXME(Setup prototype of Function object to built-in Function prototype object (15.3.3.1)); - ecma_object_t *f = ecma_create_object( NULL, true, ECMA_OBJECT_TYPE_FUNCTION); + ecma_object_t *f = ecma_create_object (NULL, true, ECMA_OBJECT_TYPE_FUNCTION); // 2., 6., 7., 8. /* @@ -126,35 +126,35 @@ ecma_op_create_function_object( const ecma_char_t* formal_parameter_list_p[], /* */ // 3. - ecma_property_t *class_prop_p = ecma_create_internal_property( f, ECMA_INTERNAL_PROPERTY_CLASS); + ecma_property_t *class_prop_p = ecma_create_internal_property (f, ECMA_INTERNAL_PROPERTY_CLASS); class_prop_p->u.internal_property.value = ECMA_OBJECT_CLASS_FUNCTION; // 9. - ecma_property_t *scope_prop_p = ecma_create_internal_property( f, ECMA_INTERNAL_PROPERTY_SCOPE); - ECMA_SET_POINTER( scope_prop_p->u.internal_property.value, scope_p); + ecma_property_t *scope_prop_p = ecma_create_internal_property (f, ECMA_INTERNAL_PROPERTY_SCOPE); + ECMA_SET_POINTER(scope_prop_p->u.internal_property.value, scope_p); - ecma_gc_update_may_ref_younger_object_flag_by_object( f, scope_p); + ecma_gc_update_may_ref_younger_object_flag_by_object (f, scope_p); // 10., 11., 14., 15. - if ( formal_parameters_number != 0 ) + if (formal_parameters_number != 0) { - JERRY_UNIMPLEMENTED_REF_UNUSED_VARS( formal_parameter_list_p); + JERRY_UNIMPLEMENTED_REF_UNUSED_VARS(formal_parameter_list_p); } // 12. - ecma_property_t *code_prop_p = ecma_create_internal_property( f, ECMA_INTERNAL_PROPERTY_CODE); - code_prop_p->u.internal_property.value = ecma_pack_code_internal_property_value( is_strict, + ecma_property_t *code_prop_p = ecma_create_internal_property (f, ECMA_INTERNAL_PROPERTY_CODE); + code_prop_p->u.internal_property.value = ecma_pack_code_internal_property_value (is_strict, first_opcode_idx); // 16. - FIXME( Use 'new Object()' instead ); - ecma_object_t *proto_p = ecma_create_object( NULL, true, ECMA_OBJECT_TYPE_GENERAL); + FIXME(Use 'new Object ()' instead); + ecma_object_t *proto_p = ecma_create_object (NULL, true, ECMA_OBJECT_TYPE_GENERAL); // 17. - ecma_property_descriptor_t prop_desc = ecma_make_empty_property_descriptor(); + ecma_property_descriptor_t prop_desc = ecma_make_empty_property_descriptor (); { prop_desc.is_value_defined = true; - prop_desc.value = ecma_make_object_value( f); + prop_desc.value = ecma_make_object_value (f); prop_desc.is_writable_defined = true; prop_desc.writable = ECMA_PROPERTY_WRITABLE; @@ -166,27 +166,27 @@ ecma_op_create_function_object( const ecma_char_t* formal_parameter_list_p[], /* prop_desc.configurable = ECMA_PROPERTY_CONFIGURABLE; } - ecma_op_object_define_own_property( proto_p, - ecma_get_magic_string( ECMA_MAGIC_STRING_CONSTRUCTOR), + ecma_op_object_define_own_property (proto_p, + ecma_get_magic_string (ECMA_MAGIC_STRING_CONSTRUCTOR), prop_desc, false); // 18. - prop_desc.value = ecma_make_object_value( proto_p); + prop_desc.value = ecma_make_object_value (proto_p); prop_desc.configurable = ECMA_PROPERTY_NOT_CONFIGURABLE; - ecma_op_object_define_own_property( f, - ecma_get_magic_string( ECMA_MAGIC_STRING_PROTOTYPE), + ecma_op_object_define_own_property (f, + ecma_get_magic_string (ECMA_MAGIC_STRING_PROTOTYPE), prop_desc, false); - ecma_deref_object( proto_p); + ecma_deref_object (proto_p); // 19. - if ( is_strict ) + if (is_strict) { - ecma_object_t *thrower_p = ecma_op_get_throw_type_error(); + ecma_object_t *thrower_p = ecma_op_get_throw_type_error (); - prop_desc = ecma_make_empty_property_descriptor(); + prop_desc = ecma_make_empty_property_descriptor (); { prop_desc.is_enumerable_defined = true; prop_desc.enumerable = ECMA_PROPERTY_NOT_ENUMERABLE; @@ -201,17 +201,17 @@ ecma_op_create_function_object( const ecma_char_t* formal_parameter_list_p[], /* prop_desc.set_p = thrower_p; } - ecma_op_object_define_own_property( f, - ecma_get_magic_string( ECMA_MAGIC_STRING_CALLER), + ecma_op_object_define_own_property (f, + ecma_get_magic_string (ECMA_MAGIC_STRING_CALLER), prop_desc, false); - ecma_op_object_define_own_property( f, - ecma_get_magic_string( ECMA_MAGIC_STRING_ARGUMENTS), + ecma_op_object_define_own_property (f, + ecma_get_magic_string (ECMA_MAGIC_STRING_ARGUMENTS), prop_desc, false); - ecma_deref_object( thrower_p); + ecma_deref_object (thrower_p); } return f; @@ -226,88 +226,88 @@ ecma_op_create_function_object( const ecma_char_t* formal_parameter_list_p[], /* * Returned value must be freed with ecma_free_completion_value */ ecma_completion_value_t -ecma_op_function_call( ecma_object_t *func_obj_p, /**< Function object */ +ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */ ecma_value_t this_arg_value, /**< 'this' argument's value */ ecma_value_t* arguments_list_p, /**< arguments list */ size_t arguments_list_len) /**< length of arguments list */ { - JERRY_ASSERT( func_obj_p != NULL && !func_obj_p->is_lexical_environment ); - JERRY_ASSERT( ecma_op_is_callable( ecma_make_object_value( func_obj_p)) ); - JERRY_ASSERT( arguments_list_len == 0 || arguments_list_p != NULL ); + JERRY_ASSERT(func_obj_p != NULL && !func_obj_p->is_lexical_environment); + JERRY_ASSERT(ecma_op_is_callable (ecma_make_object_value (func_obj_p))); + JERRY_ASSERT(arguments_list_len == 0 || arguments_list_p != NULL); - if ( func_obj_p->u.object.type == ECMA_OBJECT_TYPE_FUNCTION ) + if (func_obj_p->u.object.type == ECMA_OBJECT_TYPE_FUNCTION) { ecma_completion_value_t ret_value; /* Entering Function Code (ECMA-262 v5, 10.4.3) */ - ecma_property_t *scope_prop_p = ecma_get_internal_property( func_obj_p, ECMA_INTERNAL_PROPERTY_SCOPE); - ecma_property_t *code_prop_p = ecma_get_internal_property( func_obj_p, ECMA_INTERNAL_PROPERTY_CODE); + ecma_property_t *scope_prop_p = ecma_get_internal_property (func_obj_p, ECMA_INTERNAL_PROPERTY_SCOPE); + ecma_property_t *code_prop_p = ecma_get_internal_property (func_obj_p, ECMA_INTERNAL_PROPERTY_CODE); - ecma_object_t *scope_p = ECMA_GET_POINTER( scope_prop_p->u.internal_property.value); + ecma_object_t *scope_p = ECMA_GET_POINTER(scope_prop_p->u.internal_property.value); uint32_t code_prop_value = code_prop_p->u.internal_property.value; bool is_strict; // 8. - opcode_counter_t code_first_opcode_idx = ecma_unpack_code_internal_property_value( code_prop_value, &is_strict); + opcode_counter_t code_first_opcode_idx = ecma_unpack_code_internal_property_value (code_prop_value, &is_strict); ecma_value_t this_binding; // 1. - if ( is_strict ) + if (is_strict) { - this_binding = ecma_copy_value( this_arg_value, true); + this_binding = ecma_copy_value (this_arg_value, true); } - else if ( ecma_is_value_undefined( this_arg_value) - || ecma_is_value_null( this_arg_value) ) + else if (ecma_is_value_undefined (this_arg_value) + || ecma_is_value_null (this_arg_value)) { // 2. - FIXME( Assign Global object when it will be implemented ); + FIXME(Assign Global object when it will be implemented); - this_binding = ecma_make_simple_value( ECMA_SIMPLE_VALUE_UNDEFINED); + this_binding = ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED); } else { // 3., 4. - ecma_completion_value_t completion = ecma_op_to_object( this_arg_value); - JERRY_ASSERT( ecma_is_completion_value_normal( completion) ); + ecma_completion_value_t completion = ecma_op_to_object (this_arg_value); + JERRY_ASSERT(ecma_is_completion_value_normal (completion)); this_binding = completion.value; } // 5. - ecma_object_t *local_env_p = ecma_create_decl_lex_env( scope_p); + ecma_object_t *local_env_p = ecma_create_decl_lex_env (scope_p); // 9. /* Declaration binding instantiation (ECMA-262 v5, 10.5), block 4 */ - TODO( Perform declaration binding instantion when [[FormalParameters]] list will be supported ); - if ( arguments_list_len != 0 ) + TODO(Perform declaration binding instantion when [[FormalParameters]] list will be supported); + if (arguments_list_len != 0) { - JERRY_UNIMPLEMENTED_REF_UNUSED_VARS( arguments_list_p ); + JERRY_UNIMPLEMENTED_REF_UNUSED_VARS(arguments_list_p); } - ecma_completion_value_t completion = run_int_from_pos( code_first_opcode_idx, + ecma_completion_value_t completion = run_int_from_pos (code_first_opcode_idx, this_binding, local_env_p, is_strict); - if ( ecma_is_completion_value_normal( completion) ) + if (ecma_is_completion_value_normal (completion)) { - JERRY_ASSERT( ecma_is_empty_completion_value( completion) ); + JERRY_ASSERT(ecma_is_empty_completion_value (completion)); - ret_value = ecma_make_simple_completion_value( ECMA_SIMPLE_VALUE_UNDEFINED); + ret_value = ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_UNDEFINED); } else { ret_value = completion; } - ecma_deref_object( local_env_p); - ecma_free_value( this_binding, true); + ecma_deref_object (local_env_p); + ecma_free_value (this_binding, true); return ret_value; } else { - JERRY_ASSERT( func_obj_p->u.object.type == ECMA_OBJECT_TYPE_BOUND_FUNCTION ); + JERRY_ASSERT(func_obj_p->u.object.type == ECMA_OBJECT_TYPE_BOUND_FUNCTION); JERRY_UNIMPLEMENTED(); } @@ -319,9 +319,9 @@ ecma_op_function_call( ecma_object_t *func_obj_p, /**< Function object */ * @return pointer to unique [[ThrowTypeError]] Function Object */ ecma_object_t* -ecma_op_get_throw_type_error( void) +ecma_op_get_throw_type_error (void) { - TODO( Create [[ThrowTypeError]] during engine initialization and return it from here ); + TODO(Create [[ThrowTypeError]] during engine initialization and return it from here); JERRY_UNIMPLEMENTED(); } /* ecma_op_get_throw_type_error */ diff --git a/src/libecmaoperations/ecma-function-object.h b/src/libecmaoperations/ecma-function-object.h index 4db9f0dd5..f6f7eb1e5 100644 --- a/src/libecmaoperations/ecma-function-object.h +++ b/src/libecmaoperations/ecma-function-object.h @@ -26,18 +26,18 @@ * @{ */ -extern bool ecma_op_is_callable( ecma_value_t value); +extern bool ecma_op_is_callable (ecma_value_t value); extern ecma_object_t* -ecma_op_create_function_object( const ecma_char_t* formal_parameter_list_p[], +ecma_op_create_function_object (const ecma_char_t* formal_parameter_list_p[], size_t formal_parameters_number, ecma_object_t *scope_p, bool is_strict, opcode_counter_t first_opcode_idx); -extern ecma_object_t* ecma_op_get_throw_type_error( void); +extern ecma_object_t* ecma_op_get_throw_type_error (void); -extern ecma_completion_value_t ecma_op_function_call( ecma_object_t *func_obj_p, +extern ecma_completion_value_t ecma_op_function_call (ecma_object_t *func_obj_p, ecma_value_t this_arg_value, ecma_value_t* arguments_list_p, size_t arguments_list_len); diff --git a/src/libecmaoperations/ecma-get-put-value.c b/src/libecmaoperations/ecma-get-put-value.c index 29bb930d6..deae12a04 100644 --- a/src/libecmaoperations/ecma-get-put-value.c +++ b/src/libecmaoperations/ecma-get-put-value.c @@ -41,59 +41,59 @@ * Returned value must be freed with ecma_free_completion_value. */ ecma_completion_value_t -ecma_op_get_value( ecma_reference_t ref) /**< ECMA-reference */ +ecma_op_get_value (ecma_reference_t ref) /**< ECMA-reference */ { const ecma_value_t base = ref.base; - const bool is_unresolvable_reference = ecma_is_value_undefined( base); - const bool has_primitive_base = ( ecma_is_value_boolean( base) + const bool is_unresolvable_reference = ecma_is_value_undefined (base); + const bool has_primitive_base = (ecma_is_value_boolean (base) || base.value_type == ECMA_TYPE_NUMBER - || base.value_type == ECMA_TYPE_STRING ); - const bool has_object_base = ( base.value_type == ECMA_TYPE_OBJECT - && !((ecma_object_t*)ECMA_GET_POINTER(base.value))->is_lexical_environment ); + || base.value_type == ECMA_TYPE_STRING); + const bool has_object_base = (base.value_type == ECMA_TYPE_OBJECT + && !((ecma_object_t*)ECMA_GET_POINTER(base.value))->is_lexical_environment); const bool is_property_reference = has_primitive_base || has_object_base; // GetValue_3 - if ( is_unresolvable_reference ) + if (is_unresolvable_reference) { - return ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_REFERENCE)); + return ecma_make_throw_value (ecma_new_standard_error (ECMA_ERROR_REFERENCE)); } // GetValue_4 - if ( is_property_reference ) + if (is_property_reference) { - if ( !has_primitive_base ) // GetValue_4.a + if (!has_primitive_base) // GetValue_4.a { - ecma_object_t *obj_p = ECMA_GET_POINTER( base.value); - JERRY_ASSERT( obj_p != NULL && !obj_p->is_lexical_environment ); + ecma_object_t *obj_p = ECMA_GET_POINTER(base.value); + JERRY_ASSERT(obj_p != NULL && !obj_p->is_lexical_environment); // GetValue_4.b case 1 - /* return [[Get]]( base as this, ref.referenced_name_p) */ + /* return [[Get]](base as this, ref.referenced_name_p) */ JERRY_UNIMPLEMENTED(); } else { // GetValue_4.b case 2 /* - ecma_object_t *obj_p = ecma_ToObject( base); - JERRY_ASSERT( obj_p != NULL && !obj_p->is_lexical_environment ); - ecma_property_t *property = obj_p->[[GetProperty]]( ref.referenced_name_p); - if ( property->Type == ECMA_PROPERTY_NAMEDDATA ) + ecma_object_t *obj_p = ecma_ToObject (base); + JERRY_ASSERT(obj_p != NULL && !obj_p->is_lexical_environment); + ecma_property_t *property = obj_p->[[GetProperty]](ref.referenced_name_p); + if (property->Type == ECMA_PROPERTY_NAMEDDATA) { - return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL, - ecma_copy_value( property->u.named_data_property.value), + return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL, + ecma_copy_value (property->u.named_data_property.value), ECMA_TARGET_ID_RESERVED); } else { - JERRY_ASSERT( property->Type == ECMA_PROPERTY_NAMEDACCESSOR ); + JERRY_ASSERT(property->Type == ECMA_PROPERTY_NAMEDACCESSOR); - ecma_object_t *getter = ECMA_GET_POINTER( property->u.named_accessor_property.get_p); + ecma_object_t *getter = ECMA_GET_POINTER(property->u.named_accessor_property.get_p); - if ( getter == NULL ) + if (getter == NULL) { - return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL, - ecma_make_simple_value( ECMA_SIMPLE_VALUE_UNDEFINED), + return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL, + ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED), ECMA_TARGET_ID_RESERVED); } else { - return [[Call]]( getter, base as this); + return [[Call]](getter, base as this); } } */ @@ -102,11 +102,11 @@ ecma_op_get_value( ecma_reference_t ref) /**< ECMA-reference */ } else { // GetValue_5 - ecma_object_t *lex_env_p = ECMA_GET_POINTER( base.value); + ecma_object_t *lex_env_p = ECMA_GET_POINTER(base.value); - JERRY_ASSERT( lex_env_p != NULL && lex_env_p->is_lexical_environment ); + JERRY_ASSERT(lex_env_p != NULL && lex_env_p->is_lexical_environment); - return ecma_op_get_binding_value( lex_env_p, ref.referenced_name_p, ref.is_strict); + return ecma_op_get_binding_value (lex_env_p, ref.referenced_name_p, ref.is_strict); } } /* ecma_op_get_value */ @@ -119,46 +119,46 @@ ecma_op_get_value( ecma_reference_t ref) /**< ECMA-reference */ * Returned value must be freed with ecma_free_completion_value. */ ecma_completion_value_t -ecma_op_put_value(ecma_reference_t ref, /**< ECMA-reference */ +ecma_op_put_value (ecma_reference_t ref, /**< ECMA-reference */ ecma_value_t value) /**< ECMA-value */ { const ecma_value_t base = ref.base; - const bool is_unresolvable_reference = ecma_is_value_undefined( base); - const bool has_primitive_base = ( ecma_is_value_boolean( base) + const bool is_unresolvable_reference = ecma_is_value_undefined (base); + const bool has_primitive_base = (ecma_is_value_boolean (base) || base.value_type == ECMA_TYPE_NUMBER - || base.value_type == ECMA_TYPE_STRING ); - const bool has_object_base = ( base.value_type == ECMA_TYPE_OBJECT - && !((ecma_object_t*)ECMA_GET_POINTER(base.value))->is_lexical_environment ); + || base.value_type == ECMA_TYPE_STRING); + const bool has_object_base = (base.value_type == ECMA_TYPE_OBJECT + && !((ecma_object_t*)ECMA_GET_POINTER(base.value))->is_lexical_environment); const bool is_property_reference = has_primitive_base || has_object_base; - if ( is_unresolvable_reference ) // PutValue_3 + if (is_unresolvable_reference) // PutValue_3 { - if ( ref.is_strict ) // PutValue_3.a + if (ref.is_strict) // PutValue_3.a { - return ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_REFERENCE)); + return ecma_make_throw_value (ecma_new_standard_error (ECMA_ERROR_REFERENCE)); } else // PutValue_3.b { - ecma_object_t *global_object_p = ecma_get_global_object(); + ecma_object_t *global_object_p = ecma_get_global_object (); - ecma_completion_value_t completion = ecma_op_object_put( global_object_p, + ecma_completion_value_t completion = ecma_op_object_put (global_object_p, ref.referenced_name_p, value, false); - ecma_deref_object( global_object_p); + ecma_deref_object (global_object_p); - JERRY_ASSERT( ecma_is_completion_value_normal_true( completion) - || ecma_is_completion_value_normal_false( completion) ); + JERRY_ASSERT(ecma_is_completion_value_normal_true (completion) + || ecma_is_completion_value_normal_false (completion)); - return ecma_make_empty_completion_value(); + 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 + if (!has_primitive_base) // PutValue_4.a { // PutValue_4.b case 1 - /* return [[Put]]( base as this, ref.referenced_name_p, value, ref.is_strict); */ + /* return [[Put]](base as this, ref.referenced_name_p, value, ref.is_strict); */ JERRY_UNIMPLEMENTED(); } else { @@ -166,66 +166,66 @@ ecma_op_put_value(ecma_reference_t ref, /**< ECMA-reference */ /* // PutValue_sub_1 - ecma_object_t *obj_p = ecma_ToObject( base); - JERRY_ASSERT( obj_p != NULL && !obj_p->is_lexical_environment ); + ecma_object_t *obj_p = ecma_ToObject (base); + JERRY_ASSERT(obj_p != NULL && !obj_p->is_lexical_environment); // PutValue_sub_2 - if ( !obj_p->[[CanPut]]( ref.referenced_name_p) ) + if (!obj_p->[[CanPut]](ref.referenced_name_p)) { // PutValue_sub_2.a - if ( ref.is_strict ) + if (ref.is_strict) { - return ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_TYPE)); + return ecma_make_throw_value (ecma_new_standard_error (ECMA_ERROR_TYPE)); } else { // PutValue_sub_2.b - return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL, - ecma_make_simple_value( ECMA_SIMPLE_VALUE_EMPTY), + return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL, + ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY), ECMA_TARGET_ID_RESERVED); } } // PutValue_sub_3 - ecma_property_t *own_prop = obj_p->[[GetOwnProperty]]( ref.referenced_name_p); + ecma_property_t *own_prop = obj_p->[[GetOwnProperty]](ref.referenced_name_p); // PutValue_sub_4 - if ( ecma_OpIsDataDescriptor( own_prop) ) + if (ecma_OpIsDataDescriptor (own_prop)) { // PutValue_sub_4.a - if ( ref.is_strict ) + if (ref.is_strict) { - return ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_TYPE)); + return ecma_make_throw_value (ecma_new_standard_error (ECMA_ERROR_TYPE)); } else { // PutValue_sub_4.b - return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL, - ecma_make_simple_value( ECMA_SIMPLE_VALUE_EMPTY), + return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL, + ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY), ECMA_TARGET_ID_RESERVED); } } // PutValue_sub_5 - ecma_property_t *prop = obj_p->[[GetProperty]]( ref.referenced_name_p); + ecma_property_t *prop = obj_p->[[GetProperty]](ref.referenced_name_p); // PutValue_sub_6 - if ( ecma_OpIsAccessorDescriptor( prop) ) + if (ecma_OpIsAccessorDescriptor (prop)) { // PutValue_sub_6.a - ecma_object_t *setter = ECMA_GET_POINTER( property->u.named_accessor_property.set_p); - JERRY_ASSERT( setter != NULL ); + ecma_object_t *setter = ECMA_GET_POINTER(property->u.named_accessor_property.set_p); + JERRY_ASSERT(setter != NULL); // PutValue_sub_6.b - return [[Call]]( setter, base as this, value); + return [[Call]](setter, base as this, value); } else // PutValue_sub_7 { // PutValue_sub_7.a - if ( ref.is_strict ) + if (ref.is_strict) { - return ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_TYPE)); + return ecma_make_throw_value (ecma_new_standard_error (ECMA_ERROR_TYPE)); } } // PutValue_sub_8 - return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL, - ecma_make_simple_value( ECMA_SIMPLE_VALUE_EMPTY), + return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL, + ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY), ECMA_TARGET_ID_RESERVED); */ @@ -234,11 +234,11 @@ ecma_op_put_value(ecma_reference_t ref, /**< ECMA-reference */ } else { // PutValue_7 - ecma_object_t *lex_env_p = ECMA_GET_POINTER( base.value); + ecma_object_t *lex_env_p = ECMA_GET_POINTER(base.value); - JERRY_ASSERT( lex_env_p != NULL && lex_env_p->is_lexical_environment ); + JERRY_ASSERT(lex_env_p != NULL && lex_env_p->is_lexical_environment); - return ecma_op_set_mutable_binding( lex_env_p, ref.referenced_name_p, value, ref.is_strict); + return ecma_op_set_mutable_binding (lex_env_p, ref.referenced_name_p, value, ref.is_strict); } } /* ecma_op_put_value */ diff --git a/src/libecmaoperations/ecma-global-object.c b/src/libecmaoperations/ecma-global-object.c index 483990d18..ad80c228b 100644 --- a/src/libecmaoperations/ecma-global-object.c +++ b/src/libecmaoperations/ecma-global-object.c @@ -39,11 +39,11 @@ static ecma_object_t* ecma_global_object_p = NULL; * caller should free the reference by calling ecma_deref_object */ ecma_object_t* -ecma_get_global_object( void) +ecma_get_global_object (void) { - JERRY_ASSERT( ecma_global_object_p != NULL ); + JERRY_ASSERT(ecma_global_object_p != NULL); - ecma_ref_object( ecma_global_object_p); + ecma_ref_object (ecma_global_object_p); return ecma_global_object_p; } /* ecma_get_global_object */ @@ -56,22 +56,22 @@ ecma_get_global_object( void) * @return pointer to the constructed object */ ecma_object_t* -ecma_op_create_global_object( void) +ecma_op_create_global_object (void) { - JERRY_ASSERT( ecma_global_object_p == NULL ); + JERRY_ASSERT(ecma_global_object_p == NULL); - ecma_object_t *glob_obj_p = ecma_create_object( NULL, true, ECMA_OBJECT_TYPE_GENERAL); + ecma_object_t *glob_obj_p = ecma_create_object (NULL, true, ECMA_OBJECT_TYPE_GENERAL); - ecma_property_t *undefined_prop_p = ecma_create_named_data_property( glob_obj_p, - ecma_get_magic_string( ECMA_MAGIC_STRING_UNDEFINED), + ecma_property_t *undefined_prop_p = ecma_create_named_data_property (glob_obj_p, + ecma_get_magic_string (ECMA_MAGIC_STRING_UNDEFINED), ECMA_PROPERTY_NOT_WRITABLE, ECMA_PROPERTY_NOT_ENUMERABLE, ECMA_PROPERTY_NOT_CONFIGURABLE); - JERRY_ASSERT( ecma_is_value_undefined( undefined_prop_p->u.named_data_property.value) ); + JERRY_ASSERT(ecma_is_value_undefined (undefined_prop_p->u.named_data_property.value)); - TODO( /* Define NaN, Infinity, eval, parseInt, parseFloat, isNaN, isFinite properties */ ); + TODO(/* Define NaN, Infinity, eval, parseInt, parseFloat, isNaN, isFinite properties */); - ecma_ref_object( glob_obj_p); + ecma_ref_object (glob_obj_p); ecma_global_object_p = glob_obj_p; return glob_obj_p; @@ -84,9 +84,9 @@ ecma_op_create_global_object( void) * the routine should be called only from ecma_finalize */ void -ecma_finalize_global_object(void) +ecma_finalize_global_object (void) { - ecma_deref_object( ecma_global_object_p); + ecma_deref_object (ecma_global_object_p); ecma_global_object_p = NULL; } /* ecma_free_global_object */ diff --git a/src/libecmaoperations/ecma-global-object.h b/src/libecmaoperations/ecma-global-object.h index 45f9150dd..c662fbcac 100644 --- a/src/libecmaoperations/ecma-global-object.h +++ b/src/libecmaoperations/ecma-global-object.h @@ -25,9 +25,9 @@ * @{ */ -extern ecma_object_t* ecma_get_global_object(void); -extern ecma_object_t* ecma_op_create_global_object( void); -extern void ecma_finalize_global_object( void); +extern ecma_object_t* ecma_get_global_object (void); +extern ecma_object_t* ecma_op_create_global_object (void); +extern void ecma_finalize_global_object (void); /** * @} diff --git a/src/libecmaoperations/ecma-lex-env.c b/src/libecmaoperations/ecma-lex-env.c index d3cb14f06..d32ade03f 100644 --- a/src/libecmaoperations/ecma-lex-env.c +++ b/src/libecmaoperations/ecma-lex-env.c @@ -37,17 +37,17 @@ * @return pointer to binding object */ static ecma_object_t* -ecma_get_lex_env_binding_object( ecma_object_t* obj_lex_env_p) /**< object lexical environment */ +ecma_get_lex_env_binding_object (ecma_object_t* obj_lex_env_p) /**< object lexical environment */ { - JERRY_ASSERT( obj_lex_env_p != NULL + JERRY_ASSERT(obj_lex_env_p != NULL && obj_lex_env_p->is_lexical_environment - && obj_lex_env_p->u.lexical_environment.type == ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND ); + && obj_lex_env_p->u.lexical_environment.type == ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND); - ecma_property_t *binding_obj_prop_p = ECMA_GET_POINTER( obj_lex_env_p->properties_p); - JERRY_ASSERT( binding_obj_prop_p != NULL - && binding_obj_prop_p->u.internal_property.type == ECMA_INTERNAL_PROPERTY_BINDING_OBJECT ); + ecma_property_t *binding_obj_prop_p = ECMA_GET_POINTER(obj_lex_env_p->properties_p); + JERRY_ASSERT(binding_obj_prop_p != NULL + && binding_obj_prop_p->u.internal_property.type == ECMA_INTERNAL_PROPERTY_BINDING_OBJECT); - return ECMA_GET_POINTER( binding_obj_prop_p->u.internal_property.value); + return ECMA_GET_POINTER(binding_obj_prop_p->u.internal_property.value); } /* ecma_get_lex_env_binding_object */ /** @@ -60,37 +60,37 @@ ecma_get_lex_env_binding_object( ecma_object_t* obj_lex_env_p) /**< object lexic * However, ecma_free_completion_value may be called for it, but it is a no-op. */ ecma_completion_value_t -ecma_op_has_binding(ecma_object_t *lex_env_p, /**< lexical environment */ +ecma_op_has_binding (ecma_object_t *lex_env_p, /**< lexical environment */ const ecma_char_t *name_p) /**< argument N */ { - JERRY_ASSERT( lex_env_p != NULL && lex_env_p->is_lexical_environment ); + JERRY_ASSERT(lex_env_p != NULL && lex_env_p->is_lexical_environment); ecma_simple_value_t has_binding = ECMA_SIMPLE_VALUE_UNDEFINED; - switch ( (ecma_lexical_environment_type_t) lex_env_p->u.lexical_environment.type ) + switch ((ecma_lexical_environment_type_t) lex_env_p->u.lexical_environment.type) { case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE: { - ecma_property_t *property_p = ecma_find_named_property( lex_env_p, name_p); + ecma_property_t *property_p = ecma_find_named_property (lex_env_p, name_p); - has_binding = ( property_p != NULL ) ? ECMA_SIMPLE_VALUE_TRUE + has_binding = (property_p != NULL) ? ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE; break; } case ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND: { - ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object( lex_env_p); + ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p); - has_binding = ecma_op_object_has_property( binding_obj_p, name_p) ? ECMA_SIMPLE_VALUE_TRUE + has_binding = ecma_op_object_has_property (binding_obj_p, name_p) ? ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE; break; } } - return ecma_make_completion_value(ECMA_COMPLETION_TYPE_NORMAL, - ecma_make_simple_value( has_binding), + return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL, + ecma_make_simple_value (has_binding), ECMA_TARGET_ID_RESERVED); } /* ecma_op_has_binding */ @@ -103,20 +103,20 @@ ecma_op_has_binding(ecma_object_t *lex_env_p, /**< lexical environment */ * Returned value must be freed with ecma_free_completion_value */ ecma_completion_value_t -ecma_op_create_mutable_binding(ecma_object_t *lex_env_p, /**< lexical environment */ +ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment */ const ecma_char_t *name_p, /**< argument N */ bool is_deletable) /**< argument D */ { - JERRY_ASSERT( lex_env_p != NULL && lex_env_p->is_lexical_environment ); - JERRY_ASSERT( name_p != NULL ); + JERRY_ASSERT(lex_env_p != NULL && lex_env_p->is_lexical_environment); + JERRY_ASSERT(name_p != NULL); - switch ( (ecma_lexical_environment_type_t) lex_env_p->u.lexical_environment.type ) + switch ((ecma_lexical_environment_type_t) lex_env_p->u.lexical_environment.type) { case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE: { - JERRY_ASSERT( ecma_is_completion_value_normal_false( ecma_op_has_binding( lex_env_p, name_p)) ); + JERRY_ASSERT(ecma_is_completion_value_normal_false (ecma_op_has_binding (lex_env_p, name_p))); - ecma_create_named_data_property( lex_env_p, + ecma_create_named_data_property (lex_env_p, name_p, ECMA_PROPERTY_WRITABLE, ECMA_PROPERTY_NOT_ENUMERABLE, @@ -128,14 +128,14 @@ ecma_op_create_mutable_binding(ecma_object_t *lex_env_p, /**< lexical environmen } case ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND: { - ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object( lex_env_p); + ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p); - JERRY_ASSERT( !ecma_op_object_has_property( binding_obj_p, name_p ) ); + JERRY_ASSERT(!ecma_op_object_has_property (binding_obj_p, name_p)); - ecma_property_descriptor_t prop_desc = ecma_make_empty_property_descriptor(); + ecma_property_descriptor_t prop_desc = ecma_make_empty_property_descriptor (); { prop_desc.is_value_defined = true; - prop_desc.value = ecma_make_simple_value( ECMA_SIMPLE_VALUE_UNDEFINED); + prop_desc.value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED); prop_desc.is_writable_defined = true; prop_desc.writable = ECMA_PROPERTY_WRITABLE; @@ -148,22 +148,22 @@ ecma_op_create_mutable_binding(ecma_object_t *lex_env_p, /**< lexical environmen : ECMA_PROPERTY_NOT_CONFIGURABLE; } - ecma_completion_value_t completion = ecma_op_object_define_own_property( binding_obj_p, + ecma_completion_value_t completion = ecma_op_object_define_own_property (binding_obj_p, name_p, prop_desc, true); - if ( !( ecma_is_completion_value_normal_true( completion) - || ecma_is_completion_value_normal_false( completion) ) ) + if (!(ecma_is_completion_value_normal_true (completion) + || ecma_is_completion_value_normal_false (completion))) { - JERRY_ASSERT( ecma_is_completion_value_throw( completion) ); + JERRY_ASSERT(ecma_is_completion_value_throw (completion)); return completion; } } } - return ecma_make_empty_completion_value(); + return ecma_make_empty_completion_value (); } /* ecma_op_create_mutable_binding */ /** @@ -175,48 +175,48 @@ ecma_op_create_mutable_binding(ecma_object_t *lex_env_p, /**< lexical environmen * Returned value must be freed with ecma_free_completion_value. */ ecma_completion_value_t -ecma_op_set_mutable_binding(ecma_object_t *lex_env_p, /**< lexical environment */ +ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment */ const ecma_char_t *name_p, /**< argument N */ ecma_value_t value, /**< argument V */ bool is_strict) /**< argument S */ { - JERRY_ASSERT( lex_env_p != NULL && lex_env_p->is_lexical_environment ); - JERRY_ASSERT( name_p != NULL ); + JERRY_ASSERT(lex_env_p != NULL && lex_env_p->is_lexical_environment); + JERRY_ASSERT(name_p != NULL); - JERRY_ASSERT( ecma_is_completion_value_normal_true( ecma_op_has_binding( lex_env_p, name_p)) ); + JERRY_ASSERT(ecma_is_completion_value_normal_true (ecma_op_has_binding (lex_env_p, name_p))); - switch ( (ecma_lexical_environment_type_t) lex_env_p->u.lexical_environment.type ) + switch ((ecma_lexical_environment_type_t) lex_env_p->u.lexical_environment.type) { case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE: { - ecma_property_t *property_p = ecma_get_named_data_property( lex_env_p, name_p); + ecma_property_t *property_p = ecma_get_named_data_property (lex_env_p, name_p); - if ( property_p->u.named_data_property.writable == ECMA_PROPERTY_WRITABLE ) + if (property_p->u.named_data_property.writable == ECMA_PROPERTY_WRITABLE) { - ecma_free_value( property_p->u.named_data_property.value, false); - property_p->u.named_data_property.value = ecma_copy_value( value, false); + ecma_free_value (property_p->u.named_data_property.value, false); + property_p->u.named_data_property.value = ecma_copy_value (value, false); - ecma_gc_update_may_ref_younger_object_flag_by_value( lex_env_p, value); + ecma_gc_update_may_ref_younger_object_flag_by_value (lex_env_p, value); } - else if ( is_strict ) + else if (is_strict) { - return ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_TYPE)); + return ecma_make_throw_value (ecma_new_standard_error (ECMA_ERROR_TYPE)); } break; } case ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND: { - ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object( lex_env_p); + ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p); - ecma_completion_value_t completion = ecma_op_object_put( binding_obj_p, + ecma_completion_value_t completion = ecma_op_object_put (binding_obj_p, name_p, value, is_strict); - if ( !( ecma_is_completion_value_normal_true( completion) - || ecma_is_completion_value_normal_false( completion) ) ) + if (!(ecma_is_completion_value_normal_true (completion) + || ecma_is_completion_value_normal_false (completion))) { - JERRY_ASSERT( ecma_is_completion_value_throw( completion) ); + JERRY_ASSERT(ecma_is_completion_value_throw (completion)); return completion; } @@ -225,7 +225,7 @@ ecma_op_set_mutable_binding(ecma_object_t *lex_env_p, /**< lexical environment * } } - return ecma_make_empty_completion_value(); + return ecma_make_empty_completion_value (); } /* ecma_op_set_mutable_binding */ /** @@ -237,38 +237,38 @@ ecma_op_set_mutable_binding(ecma_object_t *lex_env_p, /**< lexical environment * * Returned value must be freed with ecma_free_completion_value. */ ecma_completion_value_t -ecma_op_get_binding_value(ecma_object_t *lex_env_p, /**< lexical environment */ +ecma_op_get_binding_value (ecma_object_t *lex_env_p, /**< lexical environment */ const ecma_char_t *name_p, /**< argument N */ bool is_strict) /**< argument S */ { - JERRY_ASSERT( lex_env_p != NULL && lex_env_p->is_lexical_environment ); - JERRY_ASSERT( name_p != NULL ); + JERRY_ASSERT(lex_env_p != NULL && lex_env_p->is_lexical_environment); + JERRY_ASSERT(name_p != NULL); - JERRY_ASSERT( ecma_is_completion_value_normal_true( ecma_op_has_binding( lex_env_p, name_p)) ); + JERRY_ASSERT(ecma_is_completion_value_normal_true (ecma_op_has_binding (lex_env_p, name_p))); - switch ( (ecma_lexical_environment_type_t) lex_env_p->u.lexical_environment.type ) + switch ((ecma_lexical_environment_type_t) lex_env_p->u.lexical_environment.type) { case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE: { - ecma_property_t *property_p = ecma_get_named_data_property( lex_env_p, name_p); + ecma_property_t *property_p = ecma_get_named_data_property (lex_env_p, name_p); ecma_value_t prop_value = property_p->u.named_data_property.value; /* is the binding mutable? */ - if ( property_p->u.named_data_property.writable == ECMA_PROPERTY_WRITABLE ) + if (property_p->u.named_data_property.writable == ECMA_PROPERTY_WRITABLE) { - return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL, - ecma_copy_value( prop_value, true), + 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 ) + if (is_strict) { - return ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_REFERENCE)); + return ecma_make_throw_value (ecma_new_standard_error (ECMA_ERROR_REFERENCE)); } else { - return ecma_make_simple_completion_value( ECMA_SIMPLE_VALUE_UNDEFINED); + return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_UNDEFINED); } } @@ -276,23 +276,23 @@ ecma_op_get_binding_value(ecma_object_t *lex_env_p, /**< lexical environment */ } case ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND: { - ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object( lex_env_p); + ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p); - bool has_prop = ecma_op_object_has_property( binding_obj_p, name_p); + bool has_prop = ecma_op_object_has_property (binding_obj_p, name_p); - if ( !has_prop ) + if (!has_prop) { - if ( is_strict ) + if (is_strict) { - return ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_REFERENCE)); + return ecma_make_throw_value (ecma_new_standard_error (ECMA_ERROR_REFERENCE)); } else { - return ecma_make_simple_completion_value( ECMA_SIMPLE_VALUE_UNDEFINED); + return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_UNDEFINED); } } - return ecma_op_object_get( binding_obj_p, name_p); + return ecma_op_object_get (binding_obj_p, name_p); } } @@ -309,46 +309,46 @@ ecma_op_get_binding_value(ecma_object_t *lex_env_p, /**< lexical environment */ * However, ecma_free_completion_value may be called for it, but it is a no-op. */ ecma_completion_value_t -ecma_op_delete_binding(ecma_object_t *lex_env_p, /**< lexical environment */ +ecma_op_delete_binding (ecma_object_t *lex_env_p, /**< lexical environment */ const ecma_char_t *name_p) /**< argument N */ { - JERRY_ASSERT( lex_env_p != NULL && lex_env_p->is_lexical_environment ); - JERRY_ASSERT( name_p != NULL ); + JERRY_ASSERT(lex_env_p != NULL && lex_env_p->is_lexical_environment); + JERRY_ASSERT(name_p != NULL); - switch ( (ecma_lexical_environment_type_t) lex_env_p->u.lexical_environment.type ) + switch ((ecma_lexical_environment_type_t) lex_env_p->u.lexical_environment.type) { case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE: { - ecma_property_t *prop_p = ecma_find_named_property( lex_env_p, name_p); + ecma_property_t *prop_p = ecma_find_named_property (lex_env_p, name_p); ecma_simple_value_t ret_val; - if ( prop_p == NULL ) + if (prop_p == NULL) { ret_val = ECMA_SIMPLE_VALUE_TRUE; } else { - JERRY_ASSERT( prop_p->type == ECMA_PROPERTY_NAMEDDATA ); + JERRY_ASSERT(prop_p->type == ECMA_PROPERTY_NAMEDDATA); - if ( prop_p->u.named_data_property.configurable == ECMA_PROPERTY_NOT_CONFIGURABLE ) + if (prop_p->u.named_data_property.configurable == ECMA_PROPERTY_NOT_CONFIGURABLE) { ret_val = ECMA_SIMPLE_VALUE_FALSE; } else { - ecma_delete_property( lex_env_p, prop_p); + ecma_delete_property (lex_env_p, prop_p); ret_val = ECMA_SIMPLE_VALUE_TRUE; } } - return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL, - ecma_make_simple_value( ret_val), + return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL, + ecma_make_simple_value (ret_val), ECMA_TARGET_ID_RESERVED); } case ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND: { - ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object( lex_env_p); + ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p); - return ecma_op_object_delete( binding_obj_p, name_p, false); + return ecma_op_object_delete (binding_obj_p, name_p, false); } } @@ -364,35 +364,35 @@ ecma_op_delete_binding(ecma_object_t *lex_env_p, /**< lexical environment */ * Returned value must be freed with ecma_free_completion_value. */ ecma_completion_value_t -ecma_op_implicit_this_value( ecma_object_t *lex_env_p) /**< lexical environment */ +ecma_op_implicit_this_value (ecma_object_t *lex_env_p) /**< lexical environment */ { - JERRY_ASSERT( lex_env_p != NULL && lex_env_p->is_lexical_environment ); + JERRY_ASSERT(lex_env_p != NULL && lex_env_p->is_lexical_environment); - switch ( (ecma_lexical_environment_type_t) lex_env_p->u.lexical_environment.type ) + switch ((ecma_lexical_environment_type_t) lex_env_p->u.lexical_environment.type) { case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE: { - return ecma_make_simple_completion_value( ECMA_SIMPLE_VALUE_UNDEFINED); + return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_UNDEFINED); } case ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND: { - ecma_property_t *provide_this_prop_p = ecma_get_internal_property( lex_env_p, + ecma_property_t *provide_this_prop_p = ecma_get_internal_property (lex_env_p, ECMA_INTERNAL_PROPERTY_PROVIDE_THIS); bool provide_this = provide_this_prop_p->u.internal_property.value; - if ( provide_this ) + if (provide_this) { - ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object( lex_env_p); - ecma_ref_object( binding_obj_p); + ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p); + ecma_ref_object (binding_obj_p); - return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL, - ecma_make_object_value( binding_obj_p), + return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL, + ecma_make_object_value (binding_obj_p), ECMA_TARGET_ID_RESERVED); } else { - return ecma_make_simple_completion_value( ECMA_SIMPLE_VALUE_UNDEFINED); + return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_UNDEFINED); } } } @@ -406,28 +406,28 @@ ecma_op_implicit_this_value( ecma_object_t *lex_env_p) /**< lexical environment * See also: ECMA-262 v5, 10.2.1 */ void -ecma_op_create_immutable_binding(ecma_object_t *lex_env_p, /**< lexical environment */ +ecma_op_create_immutable_binding (ecma_object_t *lex_env_p, /**< lexical environment */ const ecma_char_t *name_p) /**< argument N */ { - JERRY_ASSERT( lex_env_p != NULL && lex_env_p->is_lexical_environment ); + JERRY_ASSERT(lex_env_p != NULL && lex_env_p->is_lexical_environment); - switch ( (ecma_lexical_environment_type_t) lex_env_p->u.lexical_environment.type ) + switch ((ecma_lexical_environment_type_t) lex_env_p->u.lexical_environment.type) { case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE: { - JERRY_ASSERT( ecma_is_completion_value_normal_false( ecma_op_has_binding( lex_env_p, name_p)) ); + JERRY_ASSERT(ecma_is_completion_value_normal_false (ecma_op_has_binding (lex_env_p, name_p))); /* * Warning: * Whether immutable bindings are deletable seems not to be defined by ECMA v5. */ - ecma_property_t *prop_p = ecma_create_named_data_property( lex_env_p, + ecma_property_t *prop_p = ecma_create_named_data_property (lex_env_p, name_p, ECMA_PROPERTY_NOT_WRITABLE, ECMA_PROPERTY_NOT_ENUMERABLE, ECMA_PROPERTY_NOT_CONFIGURABLE); - JERRY_ASSERT( ecma_is_value_undefined( prop_p->u.named_data_property.value ) ); + JERRY_ASSERT(ecma_is_value_undefined (prop_p->u.named_data_property.value)); prop_p->u.named_data_property.value.value_type = ECMA_TYPE_SIMPLE; prop_p->u.named_data_property.value.value = ECMA_SIMPLE_VALUE_EMPTY; @@ -447,27 +447,27 @@ ecma_op_create_immutable_binding(ecma_object_t *lex_env_p, /**< lexical environm * See also: ECMA-262 v5, 10.2.1 */ void -ecma_op_initialize_immutable_binding(ecma_object_t *lex_env_p, /**< lexical environment */ +ecma_op_initialize_immutable_binding (ecma_object_t *lex_env_p, /**< lexical environment */ const ecma_char_t *name_p, /**< argument N */ ecma_value_t value) /**< argument V */ { - JERRY_ASSERT( lex_env_p != NULL && lex_env_p->is_lexical_environment ); + JERRY_ASSERT(lex_env_p != NULL && lex_env_p->is_lexical_environment); - switch ( (ecma_lexical_environment_type_t) lex_env_p->u.lexical_environment.type ) + switch ((ecma_lexical_environment_type_t) lex_env_p->u.lexical_environment.type) { case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE: { - JERRY_ASSERT( ecma_is_completion_value_normal_true( ecma_op_has_binding( lex_env_p, name_p)) ); + JERRY_ASSERT(ecma_is_completion_value_normal_true (ecma_op_has_binding (lex_env_p, name_p))); - ecma_property_t *prop_p = ecma_get_named_data_property( lex_env_p, name_p); + ecma_property_t *prop_p = ecma_get_named_data_property (lex_env_p, name_p); /* The binding must be unitialized immutable binding */ - JERRY_ASSERT( prop_p->u.named_data_property.writable == ECMA_PROPERTY_NOT_WRITABLE - && ecma_is_value_empty( prop_p->u.named_data_property.value) ); + JERRY_ASSERT(prop_p->u.named_data_property.writable == ECMA_PROPERTY_NOT_WRITABLE + && ecma_is_value_empty (prop_p->u.named_data_property.value)); - prop_p->u.named_data_property.value = ecma_copy_value( value, false); + prop_p->u.named_data_property.value = ecma_copy_value (value, false); - ecma_gc_update_may_ref_younger_object_flag_by_value( lex_env_p, value); + ecma_gc_update_may_ref_younger_object_flag_by_value (lex_env_p, value); } case ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND: { @@ -486,13 +486,13 @@ ecma_op_initialize_immutable_binding(ecma_object_t *lex_env_p, /**< lexical envi * @return pointer to created lexical environment */ ecma_object_t* -ecma_op_create_global_environment( void) +ecma_op_create_global_environment (void) { - ecma_object_t *glob_obj_p = ecma_op_create_global_object(); + ecma_object_t *glob_obj_p = ecma_op_create_global_object (); - ecma_object_t *glob_env_p = ecma_create_object_lex_env( NULL, glob_obj_p, false); + ecma_object_t *glob_env_p = ecma_create_object_lex_env (NULL, glob_obj_p, false); - ecma_deref_object( glob_obj_p); + ecma_deref_object (glob_obj_p); return glob_env_p; } /* ecma_op_create_global_environment */ diff --git a/src/libecmaoperations/ecma-lex-env.h b/src/libecmaoperations/ecma-lex-env.h index 0d3a25757..d39248f3c 100644 --- a/src/libecmaoperations/ecma-lex-env.h +++ b/src/libecmaoperations/ecma-lex-env.h @@ -29,18 +29,18 @@ */ /* ECMA-262 v5, Table 17. Abstract methods of Environment Records */ -extern ecma_completion_value_t ecma_op_has_binding( ecma_object_t *lex_env_p, const ecma_char_t *name_p); -extern ecma_completion_value_t ecma_op_create_mutable_binding( ecma_object_t *lex_env_p, const ecma_char_t *name_p, bool is_deletable); -extern ecma_completion_value_t ecma_op_set_mutable_binding( ecma_object_t *lex_env_p, const ecma_char_t *name_p, ecma_value_t value, bool is_strict); -extern ecma_completion_value_t ecma_op_get_binding_value( ecma_object_t *lex_env_p, const ecma_char_t *name_p, bool is_strict); -extern ecma_completion_value_t ecma_op_delete_binding( ecma_object_t *lex_env_p, const ecma_char_t *name_p); -extern ecma_completion_value_t ecma_op_implicit_this_value( ecma_object_t *lex_env_p); +extern ecma_completion_value_t ecma_op_has_binding (ecma_object_t *lex_env_p, const ecma_char_t *name_p); +extern ecma_completion_value_t ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, const ecma_char_t *name_p, bool is_deletable); +extern ecma_completion_value_t ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, const ecma_char_t *name_p, ecma_value_t value, bool is_strict); +extern ecma_completion_value_t ecma_op_get_binding_value (ecma_object_t *lex_env_p, const ecma_char_t *name_p, bool is_strict); +extern ecma_completion_value_t ecma_op_delete_binding (ecma_object_t *lex_env_p, const ecma_char_t *name_p); +extern ecma_completion_value_t ecma_op_implicit_this_value (ecma_object_t *lex_env_p); /* ECMA-262 v5, Table 18. Additional methods of Declarative Environment Records */ -extern void ecma_op_create_immutable_binding( ecma_object_t *lex_env_p, const ecma_char_t *name_p); -extern void ecma_op_initialize_immutable_binding( ecma_object_t *lex_env_p, const ecma_char_t *name_p, ecma_value_t value); +extern void ecma_op_create_immutable_binding (ecma_object_t *lex_env_p, const ecma_char_t *name_p); +extern void ecma_op_initialize_immutable_binding (ecma_object_t *lex_env_p, const ecma_char_t *name_p, ecma_value_t value); -extern ecma_object_t* ecma_op_create_global_environment( void); +extern ecma_object_t* ecma_op_create_global_environment (void); /** * @} diff --git a/src/libecmaoperations/ecma-magic-strings.c b/src/libecmaoperations/ecma-magic-strings.c index e7c50f843..229eb0092 100644 --- a/src/libecmaoperations/ecma-magic-strings.c +++ b/src/libecmaoperations/ecma-magic-strings.c @@ -28,11 +28,11 @@ * @return pointer to magic string contant */ const ecma_char_t* -ecma_get_magic_string( ecma_magic_string_id_t id) /**< magic string id */ +ecma_get_magic_string (ecma_magic_string_id_t id) /**< magic string id */ { - TODO( Support UTF-16 ); + TODO(Support UTF-16); - switch ( id ) + switch (id) { case ECMA_MAGIC_STRING_ARGUMENTS: return (ecma_char_t*) "arguments"; diff --git a/src/libecmaoperations/ecma-magic-strings.h b/src/libecmaoperations/ecma-magic-strings.h index 2cbda2359..d4222e011 100644 --- a/src/libecmaoperations/ecma-magic-strings.h +++ b/src/libecmaoperations/ecma-magic-strings.h @@ -38,7 +38,7 @@ typedef enum ECMA_MAGIC_STRING_UNDEFINED /**< undefined */ } ecma_magic_string_id_t; -extern const ecma_char_t* ecma_get_magic_string( ecma_magic_string_id_t id); +extern const ecma_char_t* ecma_get_magic_string (ecma_magic_string_id_t id); /** * @} diff --git a/src/libecmaoperations/ecma-number-arithmetic.c b/src/libecmaoperations/ecma-number-arithmetic.c index 4e5b5ca6d..c7ed1557a 100644 --- a/src/libecmaoperations/ecma-number-arithmetic.c +++ b/src/libecmaoperations/ecma-number-arithmetic.c @@ -34,10 +34,10 @@ * @return number - result of addition. */ ecma_number_t -ecma_op_number_add(ecma_number_t left_num, /**< left operand */ +ecma_op_number_add (ecma_number_t left_num, /**< left operand */ ecma_number_t right_num) /**< right operand */ { - TODO( Implement according to ECMA ); + TODO(Implement according to ECMA); return left_num + right_num; } /* ecma_op_number_add */ @@ -51,10 +51,10 @@ ecma_op_number_add(ecma_number_t left_num, /**< left operand */ * @return number - result of substraction. */ ecma_number_t -ecma_op_number_substract(ecma_number_t left_num, /**< left operand */ +ecma_op_number_substract (ecma_number_t left_num, /**< left operand */ ecma_number_t right_num) /**< right operand */ { - return ecma_op_number_add( left_num, ecma_op_number_negate( right_num)); + return ecma_op_number_add (left_num, ecma_op_number_negate (right_num)); } /* ecma_op_number_substract */ /** @@ -66,10 +66,10 @@ ecma_op_number_substract(ecma_number_t left_num, /**< left operand */ * @return number - result of multiplication. */ ecma_number_t -ecma_op_number_multiply(ecma_number_t left_num, /**< left operand */ +ecma_op_number_multiply (ecma_number_t left_num, /**< left operand */ ecma_number_t right_num) /**< right operand */ { - TODO( Implement according to ECMA ); + TODO(Implement according to ECMA); return left_num * right_num; } /* ecma_op_number_multiply */ @@ -83,10 +83,10 @@ ecma_op_number_multiply(ecma_number_t left_num, /**< left operand */ * @return number - result of division. */ ecma_number_t -ecma_op_number_divide(ecma_number_t left_num, /**< left operand */ +ecma_op_number_divide (ecma_number_t left_num, /**< left operand */ ecma_number_t right_num) /**< right operand */ { - TODO( Implement according to ECMA ); + TODO(Implement according to ECMA); return left_num / right_num; } /* ecma_op_number_divide */ @@ -100,14 +100,14 @@ ecma_op_number_divide(ecma_number_t left_num, /**< left operand */ * @return number - calculated remainder. */ ecma_number_t -ecma_op_number_remainder(ecma_number_t left_num, /**< left operand */ +ecma_op_number_remainder (ecma_number_t left_num, /**< left operand */ ecma_number_t right_num) /**< right operand */ { - TODO( Implement according to ECMA ); + TODO(Implement according to ECMA); ecma_number_t n = left_num, d = right_num; - return ( n - d * (ecma_number_t)( (int32_t)( n / d ) ) ); + return (n - d * (ecma_number_t)((int32_t)(n / d))); } /* ecma_op_number_remainder */ /** @@ -119,9 +119,9 @@ ecma_op_number_remainder(ecma_number_t left_num, /**< left operand */ * @return number - result of negation. */ ecma_number_t -ecma_op_number_negate(ecma_number_t num) /**< operand */ +ecma_op_number_negate (ecma_number_t num) /**< operand */ { - TODO( Implement according to ECMA ); + TODO(Implement according to ECMA); return -num; } /* ecma_op_number_negate */ diff --git a/src/libecmaoperations/ecma-number-arithmetic.h b/src/libecmaoperations/ecma-number-arithmetic.h index 7a157fcf9..408f405cc 100644 --- a/src/libecmaoperations/ecma-number-arithmetic.h +++ b/src/libecmaoperations/ecma-number-arithmetic.h @@ -27,12 +27,12 @@ * @{ */ -extern ecma_number_t ecma_op_number_add( ecma_number_t left_num, ecma_number_t right_num); -extern ecma_number_t ecma_op_number_substract( ecma_number_t left_num, ecma_number_t right_num); -extern ecma_number_t ecma_op_number_multiply( ecma_number_t left_num, ecma_number_t right_num); -extern ecma_number_t ecma_op_number_divide( ecma_number_t left_num, ecma_number_t right_num); -extern ecma_number_t ecma_op_number_remainder( ecma_number_t left_num, ecma_number_t right_num); -extern ecma_number_t ecma_op_number_negate( ecma_number_t num); +extern ecma_number_t ecma_op_number_add (ecma_number_t left_num, ecma_number_t right_num); +extern ecma_number_t ecma_op_number_substract (ecma_number_t left_num, ecma_number_t right_num); +extern ecma_number_t ecma_op_number_multiply (ecma_number_t left_num, ecma_number_t right_num); +extern ecma_number_t ecma_op_number_divide (ecma_number_t left_num, ecma_number_t right_num); +extern ecma_number_t ecma_op_number_remainder (ecma_number_t left_num, ecma_number_t right_num); +extern ecma_number_t ecma_op_number_negate (ecma_number_t num); /** * @} diff --git a/src/libecmaoperations/ecma-objects-properties.c b/src/libecmaoperations/ecma-objects-properties.c index c4aa3fc48..702477604 100644 --- a/src/libecmaoperations/ecma-objects-properties.c +++ b/src/libecmaoperations/ecma-objects-properties.c @@ -33,15 +33,15 @@ * Returned value must be freed with ecma_free_completion_value */ static ecma_completion_value_t -ecma_reject( bool is_throw) /**< Throw flag */ +ecma_reject (bool is_throw) /**< Throw flag */ { - if ( is_throw ) + if (is_throw) { - return ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_TYPE)); + return ecma_make_throw_value (ecma_new_standard_error (ECMA_ERROR_TYPE)); } else { - return ecma_make_simple_completion_value( ECMA_SIMPLE_VALUE_FALSE); + return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_FALSE); } } /* ecma_reject */ @@ -55,11 +55,11 @@ ecma_reject( bool is_throw) /**< Throw flag */ * Returned value must be freed with ecma_free_completion_value */ ecma_completion_value_t -ecma_op_object_get( ecma_object_t *obj_p, /**< the object */ +ecma_op_object_get (ecma_object_t *obj_p, /**< the object */ const ecma_char_t *property_name_p) /**< property name */ { - JERRY_ASSERT( obj_p != NULL && !obj_p->is_lexical_environment ); - JERRY_ASSERT( property_name_p != NULL ); + JERRY_ASSERT(obj_p != NULL && !obj_p->is_lexical_environment); + JERRY_ASSERT(property_name_p != NULL); /* * ECMA-262 v5, 8.12.3 @@ -68,30 +68,30 @@ ecma_op_object_get( ecma_object_t *obj_p, /**< the object */ */ // 1. - const ecma_property_t* prop_p = ecma_op_object_get_property( obj_p, property_name_p); + const ecma_property_t* prop_p = ecma_op_object_get_property (obj_p, property_name_p); // 2. - if ( prop_p == NULL ) + if (prop_p == NULL) { - return ecma_make_simple_completion_value( ECMA_SIMPLE_VALUE_UNDEFINED); + return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_UNDEFINED); } // 3. - if ( prop_p->type == ECMA_PROPERTY_NAMEDDATA ) + if (prop_p->type == ECMA_PROPERTY_NAMEDDATA) { - return ecma_make_completion_value( ECMA_COMPLETION_TYPE_NORMAL, - ecma_copy_value( prop_p->u.named_data_property.value, true), + return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL, + ecma_copy_value (prop_p->u.named_data_property.value, true), ECMA_TARGET_ID_RESERVED); } else { // 4. - ecma_object_t *getter = ECMA_GET_POINTER( prop_p->u.named_accessor_property.get_p); + ecma_object_t *getter = ECMA_GET_POINTER(prop_p->u.named_accessor_property.get_p); // 5. - if ( getter == NULL ) + if (getter == NULL) { - return ecma_make_simple_completion_value( ECMA_SIMPLE_VALUE_UNDEFINED); + return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_UNDEFINED); } else { @@ -115,11 +115,11 @@ ecma_op_object_get( ecma_object_t *obj_p, /**< the object */ * NULL (i.e. ecma-undefined) - otherwise. */ ecma_property_t* -ecma_op_object_get_own_property( ecma_object_t *obj_p, /**< the object */ +ecma_op_object_get_own_property (ecma_object_t *obj_p, /**< the object */ const ecma_char_t *property_name_p) /**< property name */ { - JERRY_ASSERT( obj_p != NULL && !obj_p->is_lexical_environment ); - JERRY_ASSERT( property_name_p != NULL ); + JERRY_ASSERT(obj_p != NULL && !obj_p->is_lexical_environment); + JERRY_ASSERT(property_name_p != NULL); /* * ECMA-262 v5, 8.12.2 @@ -127,7 +127,7 @@ ecma_op_object_get_own_property( ecma_object_t *obj_p, /**< the object */ * Common implementation of operation for objects other than Host, Function or Arguments objects. */ - return ecma_find_named_property( obj_p, property_name_p); + return ecma_find_named_property (obj_p, property_name_p); } /* ecma_op_object_get_own_property */ /** @@ -140,11 +140,11 @@ ecma_op_object_get_own_property( ecma_object_t *obj_p, /**< the object */ * NULL (i.e. ecma-undefined) - otherwise. */ ecma_property_t* -ecma_op_object_get_property( ecma_object_t *obj_p, /**< the object */ +ecma_op_object_get_property (ecma_object_t *obj_p, /**< the object */ const ecma_char_t *property_name_p) /**< property name */ { - JERRY_ASSERT( obj_p != NULL && !obj_p->is_lexical_environment ); - JERRY_ASSERT( property_name_p != NULL ); + JERRY_ASSERT(obj_p != NULL && !obj_p->is_lexical_environment); + JERRY_ASSERT(property_name_p != NULL); /* * ECMA-262 v5, 8.12.2 @@ -153,21 +153,21 @@ ecma_op_object_get_property( ecma_object_t *obj_p, /**< the object */ */ // 1. - ecma_property_t *prop_p = ecma_op_object_get_own_property( obj_p, property_name_p); + ecma_property_t *prop_p = ecma_op_object_get_own_property (obj_p, property_name_p); // 2. - if ( prop_p != NULL ) + if (prop_p != NULL) { return prop_p; } // 3. - ecma_object_t *prototype_p = ECMA_GET_POINTER( obj_p->u.object.prototype_object_p); + ecma_object_t *prototype_p = ECMA_GET_POINTER(obj_p->u.object.prototype_object_p); // 4., 5. - if ( prototype_p != NULL ) + if (prototype_p != NULL) { - return ecma_op_object_get_property( prototype_p, property_name_p); + return ecma_op_object_get_property (prototype_p, property_name_p); } else { @@ -185,65 +185,65 @@ ecma_op_object_get_property( ecma_object_t *obj_p, /**< the object */ * Returned value must be freed with ecma_free_completion_value */ ecma_completion_value_t -ecma_op_object_put( ecma_object_t *obj_p, /**< the object */ +ecma_op_object_put (ecma_object_t *obj_p, /**< the object */ const ecma_char_t *property_name_p, /**< property name */ ecma_value_t value, /**< ecma-value */ bool is_throw) /**< flag that controls failure handling */ { - JERRY_ASSERT( obj_p != NULL && !obj_p->is_lexical_environment ); - JERRY_ASSERT( property_name_p != NULL ); + JERRY_ASSERT(obj_p != NULL && !obj_p->is_lexical_environment); + JERRY_ASSERT(property_name_p != NULL); // 1. - if ( !ecma_op_object_can_put( obj_p, property_name_p) ) + if (!ecma_op_object_can_put (obj_p, property_name_p)) { - if ( is_throw ) + if (is_throw) { // a. - return ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_TYPE)); + return ecma_make_throw_value (ecma_new_standard_error (ECMA_ERROR_TYPE)); } else { // b. - return ecma_make_simple_completion_value( ECMA_SIMPLE_VALUE_FALSE); + return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_FALSE); } } // 2. - ecma_property_t *own_desc_p = ecma_op_object_get_own_property( obj_p, property_name_p); + ecma_property_t *own_desc_p = ecma_op_object_get_own_property (obj_p, property_name_p); // 3. - if ( own_desc_p != NULL - && own_desc_p->type == ECMA_PROPERTY_NAMEDDATA ) + if (own_desc_p != NULL + && own_desc_p->type == ECMA_PROPERTY_NAMEDDATA) { // a. - ecma_property_descriptor_t value_desc = ecma_make_empty_property_descriptor(); + ecma_property_descriptor_t value_desc = ecma_make_empty_property_descriptor (); { value_desc.is_value_defined = true; value_desc.value = value; } // b., c. - return ecma_op_object_define_own_property( obj_p, + return ecma_op_object_define_own_property (obj_p, property_name_p, value_desc, is_throw); } // 4. - ecma_property_t *desc_p = ecma_op_object_get_property( obj_p, property_name_p); + ecma_property_t *desc_p = ecma_op_object_get_property (obj_p, property_name_p); // 5. - if ( desc_p != NULL - && desc_p->type == ECMA_PROPERTY_NAMEDACCESSOR ) + if (desc_p != NULL + && desc_p->type == ECMA_PROPERTY_NAMEDACCESSOR) { // a. - ecma_object_t *setter_p = ECMA_GET_POINTER( desc_p->u.named_accessor_property.set_p); + ecma_object_t *setter_p = ECMA_GET_POINTER(desc_p->u.named_accessor_property.set_p); - JERRY_ASSERT( setter_p != NULL ); + JERRY_ASSERT(setter_p != NULL); // b. /* - * setter_p->[[Call]]( obj_p, value); + * setter_p->[[Call]](obj_p, value); */ JERRY_UNIMPLEMENTED(); } @@ -252,7 +252,7 @@ ecma_op_object_put( ecma_object_t *obj_p, /**< the object */ // 6. // a. - ecma_property_descriptor_t new_desc = ecma_make_empty_property_descriptor(); + ecma_property_descriptor_t new_desc = ecma_make_empty_property_descriptor (); { new_desc.is_value_defined = true; new_desc.value = value; @@ -268,7 +268,7 @@ ecma_op_object_put( ecma_object_t *obj_p, /**< the object */ } // b. - return ecma_op_object_define_own_property( obj_p, + return ecma_op_object_define_own_property (obj_p, property_name_p, new_desc, is_throw); @@ -287,11 +287,11 @@ ecma_op_object_put( ecma_object_t *obj_p, /**< the object */ * false - otherwise. */ bool -ecma_op_object_can_put( ecma_object_t *obj_p, /**< the object */ +ecma_op_object_can_put (ecma_object_t *obj_p, /**< the object */ const ecma_char_t *property_name_p) /**< property name */ { - JERRY_ASSERT( obj_p != NULL && !obj_p->is_lexical_environment ); - JERRY_ASSERT( property_name_p != NULL ); + JERRY_ASSERT(obj_p != NULL && !obj_p->is_lexical_environment); + JERRY_ASSERT(property_name_p != NULL); /* * ECMA-262 v5, 8.12.2 @@ -300,18 +300,18 @@ ecma_op_object_can_put( ecma_object_t *obj_p, /**< the object */ */ // 1. - ecma_property_t *prop_p = ecma_op_object_get_own_property( obj_p, property_name_p); + ecma_property_t *prop_p = ecma_op_object_get_own_property (obj_p, property_name_p); // 2. - if ( prop_p != NULL ) + if (prop_p != NULL) { // a. - if ( prop_p->type == ECMA_PROPERTY_NAMEDACCESSOR ) + if (prop_p->type == ECMA_PROPERTY_NAMEDACCESSOR) { - ecma_object_t *setter_p = ECMA_GET_POINTER( prop_p->u.named_accessor_property.set_p); + ecma_object_t *setter_p = ECMA_GET_POINTER(prop_p->u.named_accessor_property.set_p); // i. - if ( setter_p == NULL ) + if (setter_p == NULL) { return false; } @@ -323,37 +323,37 @@ ecma_op_object_can_put( ecma_object_t *obj_p, /**< the object */ { // b. - JERRY_ASSERT( prop_p->type == ECMA_PROPERTY_NAMEDDATA ); + JERRY_ASSERT(prop_p->type == ECMA_PROPERTY_NAMEDDATA); - return ( prop_p->u.named_data_property.writable == ECMA_PROPERTY_WRITABLE ); + return (prop_p->u.named_data_property.writable == ECMA_PROPERTY_WRITABLE); } } // 3. - ecma_object_t *proto_p = ECMA_GET_POINTER( obj_p->u.object.prototype_object_p); + ecma_object_t *proto_p = ECMA_GET_POINTER(obj_p->u.object.prototype_object_p); // 4. - if ( proto_p == NULL ) + if (proto_p == NULL) { return obj_p->u.object.extensible; } // 5. - ecma_property_t *inherited_p = ecma_op_object_get_property( proto_p, property_name_p); + ecma_property_t *inherited_p = ecma_op_object_get_property (proto_p, property_name_p); // 6. - if ( inherited_p == NULL ) + if (inherited_p == NULL) { return obj_p->u.object.extensible; } // 7. - if ( inherited_p->type == ECMA_PROPERTY_NAMEDACCESSOR ) + if (inherited_p->type == ECMA_PROPERTY_NAMEDACCESSOR) { - ecma_object_t *setter_p = ECMA_GET_POINTER( inherited_p->u.named_accessor_property.set_p); + ecma_object_t *setter_p = ECMA_GET_POINTER(inherited_p->u.named_accessor_property.set_p); // a. - if ( setter_p == NULL ) + if (setter_p == NULL) { return false; } @@ -364,17 +364,17 @@ ecma_op_object_can_put( ecma_object_t *obj_p, /**< the object */ else { // 8. - JERRY_ASSERT( inherited_p->type == ECMA_PROPERTY_NAMEDDATA ); + JERRY_ASSERT(inherited_p->type == ECMA_PROPERTY_NAMEDDATA); // a. - if ( !obj_p->u.object.extensible ) + if (!obj_p->u.object.extensible) { return false; } else { // b. - return ( inherited_p->u.named_data_property.writable == ECMA_PROPERTY_WRITABLE ); + return (inherited_p->u.named_data_property.writable == ECMA_PROPERTY_WRITABLE); } } @@ -391,11 +391,11 @@ ecma_op_object_can_put( ecma_object_t *obj_p, /**< the object */ * false - otherwise. */ bool -ecma_op_object_has_property( ecma_object_t *obj_p, /**< the object */ +ecma_op_object_has_property (ecma_object_t *obj_p, /**< the object */ const ecma_char_t *property_name_p) /**< property name */ { - JERRY_ASSERT( obj_p != NULL && !obj_p->is_lexical_environment ); - JERRY_ASSERT( property_name_p != NULL ); + JERRY_ASSERT(obj_p != NULL && !obj_p->is_lexical_environment); + JERRY_ASSERT(property_name_p != NULL); /* * ECMA-262 v5, 8.12.2 @@ -403,9 +403,9 @@ ecma_op_object_has_property( ecma_object_t *obj_p, /**< the object */ * Common implementation of operation for objects other than Host, Function or Arguments objects. */ - ecma_property_t *desc_p = ecma_op_object_get_property( obj_p, property_name_p); + ecma_property_t *desc_p = ecma_op_object_get_property (obj_p, property_name_p); - return ( desc_p != NULL ); + return (desc_p != NULL); } /* ecma_op_object_has_property */ /** @@ -418,12 +418,12 @@ ecma_op_object_has_property( ecma_object_t *obj_p, /**< the object */ * Returned value must be freed with ecma_free_completion_value */ ecma_completion_value_t -ecma_op_object_delete( ecma_object_t *obj_p, /**< the object */ +ecma_op_object_delete (ecma_object_t *obj_p, /**< the object */ const ecma_char_t *property_name_p, /**< property name */ bool is_throw) /**< flag that controls failure handling */ { - JERRY_ASSERT( obj_p != NULL && !obj_p->is_lexical_environment ); - JERRY_ASSERT( property_name_p != NULL ); + JERRY_ASSERT(obj_p != NULL && !obj_p->is_lexical_environment); + JERRY_ASSERT(property_name_p != NULL); /* * ECMA-262 v5, 8.12.2 @@ -432,44 +432,44 @@ ecma_op_object_delete( ecma_object_t *obj_p, /**< the object */ */ // 1. - ecma_property_t *desc_p = ecma_op_object_get_own_property( obj_p, property_name_p); + ecma_property_t *desc_p = ecma_op_object_get_own_property (obj_p, property_name_p); // 2. - if ( desc_p == NULL ) + if (desc_p == NULL) { - return ecma_make_simple_completion_value( ECMA_SIMPLE_VALUE_TRUE); + return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE); } // 3. bool is_configurable; - if ( desc_p->type == ECMA_PROPERTY_NAMEDACCESSOR ) + if (desc_p->type == ECMA_PROPERTY_NAMEDACCESSOR) { is_configurable = desc_p->u.named_accessor_property.configurable; } else { - JERRY_ASSERT( desc_p->type == ECMA_PROPERTY_NAMEDDATA ); + JERRY_ASSERT(desc_p->type == ECMA_PROPERTY_NAMEDDATA); is_configurable = desc_p->u.named_data_property.configurable; } - if ( is_configurable ) + if (is_configurable) { // a. - ecma_delete_property( obj_p, desc_p); + ecma_delete_property (obj_p, desc_p); // b. - return ecma_make_simple_completion_value( ECMA_SIMPLE_VALUE_TRUE); + return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE); } - else if ( is_throw ) + else if (is_throw) { // 4. - return ecma_make_throw_value( ecma_new_standard_error( ECMA_ERROR_TYPE)); + return ecma_make_throw_value (ecma_new_standard_error (ECMA_ERROR_TYPE)); } else { // 5. - return ecma_make_simple_completion_value( ECMA_SIMPLE_VALUE_FALSE); + return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_FALSE); } JERRY_UNREACHABLE(); @@ -485,12 +485,12 @@ ecma_op_object_delete( ecma_object_t *obj_p, /**< the object */ * Returned value must be freed with ecma_free_completion_value */ ecma_completion_value_t -ecma_op_object_default_value( ecma_object_t *obj_p, /**< the object */ +ecma_op_object_default_value (ecma_object_t *obj_p, /**< the object */ ecma_preferred_type_hint_t hint) /**< hint on preferred result type */ { - JERRY_ASSERT( obj_p != NULL && !obj_p->is_lexical_environment ); + JERRY_ASSERT(obj_p != NULL && !obj_p->is_lexical_environment); - JERRY_UNIMPLEMENTED_REF_UNUSED_VARS( obj_p, hint); + JERRY_UNIMPLEMENTED_REF_UNUSED_VARS(obj_p, hint); } /* ecma_op_object_default_value */ /** @@ -503,60 +503,60 @@ ecma_op_object_default_value( ecma_object_t *obj_p, /**< the object */ * Returned value must be freed with ecma_free_completion_value */ ecma_completion_value_t -ecma_op_object_define_own_property( ecma_object_t *obj_p, /**< the object */ +ecma_op_object_define_own_property (ecma_object_t *obj_p, /**< the object */ const ecma_char_t *property_name_p, /**< property name */ ecma_property_descriptor_t property_desc, /**< property descriptor */ bool is_throw) /**< flag that controls failure handling */ { - JERRY_ASSERT( obj_p != NULL && !obj_p->is_lexical_environment ); - JERRY_ASSERT( property_name_p != NULL ); + JERRY_ASSERT(obj_p != NULL && !obj_p->is_lexical_environment); + JERRY_ASSERT(property_name_p != NULL); - const bool is_property_desc_generic_descriptor = ( !property_desc.is_value_defined + const bool is_property_desc_generic_descriptor = (!property_desc.is_value_defined && !property_desc.is_writable_defined && !property_desc.is_get_defined - && !property_desc.is_set_defined ); - const bool is_property_desc_data_descriptor = ( property_desc.is_value_defined - || property_desc.is_writable_defined ); - const bool is_property_desc_accessor_descriptor = ( property_desc.is_get_defined - || property_desc.is_set_defined ); + && !property_desc.is_set_defined); + const bool is_property_desc_data_descriptor = (property_desc.is_value_defined + || property_desc.is_writable_defined); + const bool is_property_desc_accessor_descriptor = (property_desc.is_get_defined + || property_desc.is_set_defined); // 1. - ecma_property_t *current_p = ecma_op_object_get_own_property( obj_p, property_name_p); + ecma_property_t *current_p = ecma_op_object_get_own_property (obj_p, property_name_p); // 2. bool extensible = obj_p->u.object.extensible; - if ( current_p == NULL ) + if (current_p == NULL) { // 3. - if ( !extensible ) + if (!extensible) { - return ecma_reject( is_throw); + return ecma_reject (is_throw); } else { // 4. // a. - if ( is_property_desc_generic_descriptor - || is_property_desc_data_descriptor ) + if (is_property_desc_generic_descriptor + || is_property_desc_data_descriptor) { - ecma_property_t *new_prop_p = ecma_create_named_data_property( obj_p, + ecma_property_t *new_prop_p = ecma_create_named_data_property (obj_p, property_name_p, property_desc.writable, property_desc.enumerable, property_desc.configurable); - new_prop_p->u.named_data_property.value = ecma_copy_value( property_desc.value, false); + new_prop_p->u.named_data_property.value = ecma_copy_value (property_desc.value, false); - ecma_gc_update_may_ref_younger_object_flag_by_value( obj_p, property_desc.value); + ecma_gc_update_may_ref_younger_object_flag_by_value (obj_p, property_desc.value); } else { // b. - JERRY_ASSERT( is_property_desc_accessor_descriptor ); + JERRY_ASSERT(is_property_desc_accessor_descriptor); - ecma_create_named_accessor_property( obj_p, + ecma_create_named_accessor_property (obj_p, property_name_p, property_desc.get_p, property_desc.set_p, @@ -565,21 +565,21 @@ ecma_op_object_define_own_property( ecma_object_t *obj_p, /**< the object */ } - return ecma_make_simple_completion_value( ECMA_SIMPLE_VALUE_TRUE); + return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE); } } // 5. - if ( is_property_desc_generic_descriptor + if (is_property_desc_generic_descriptor && !property_desc.is_enumerable_defined - && !property_desc.is_configurable_defined ) + && !property_desc.is_configurable_defined) { - return ecma_make_simple_completion_value( ECMA_SIMPLE_VALUE_TRUE); + return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE); } // 6. - const bool is_current_data_descriptor = ( current_p->type == ECMA_PROPERTY_NAMEDDATA ); - const bool is_current_accessor_descriptor = ( current_p->type == ECMA_PROPERTY_NAMEDACCESSOR ); + const bool is_current_data_descriptor = (current_p->type == ECMA_PROPERTY_NAMEDDATA); + const bool is_current_accessor_descriptor = (current_p->type == ECMA_PROPERTY_NAMEDACCESSOR); const ecma_property_enumerable_value_t current_enumerable = is_current_data_descriptor ? current_p->u.named_data_property.enumerable @@ -588,100 +588,100 @@ ecma_op_object_define_own_property( ecma_object_t *obj_p, /**< the object */ is_current_data_descriptor ? current_p->u.named_data_property.configurable : current_p->u.named_accessor_property.configurable; - JERRY_ASSERT( is_current_data_descriptor || is_current_accessor_descriptor ); + JERRY_ASSERT(is_current_data_descriptor || is_current_accessor_descriptor); bool is_every_field_in_desc_also_occurs_in_current_desc_with_same_value = true; - if ( property_desc.is_value_defined ) + if (property_desc.is_value_defined) { - if ( !is_current_data_descriptor - || !ecma_op_same_value( property_desc.value, - current_p->u.named_data_property.value) ) + if (!is_current_data_descriptor + || !ecma_op_same_value (property_desc.value, + current_p->u.named_data_property.value)) { is_every_field_in_desc_also_occurs_in_current_desc_with_same_value = false; } } - if ( property_desc.is_writable_defined ) + if (property_desc.is_writable_defined) { - if ( !is_current_data_descriptor - || property_desc.writable != current_p->u.named_data_property.writable ) + if (!is_current_data_descriptor + || property_desc.writable != current_p->u.named_data_property.writable) { is_every_field_in_desc_also_occurs_in_current_desc_with_same_value = false; } } - if ( property_desc.is_get_defined ) + if (property_desc.is_get_defined) { - if ( !is_current_accessor_descriptor - || property_desc.get_p != ECMA_GET_POINTER( current_p->u.named_accessor_property.get_p) ) + if (!is_current_accessor_descriptor + || property_desc.get_p != ECMA_GET_POINTER(current_p->u.named_accessor_property.get_p)) { is_every_field_in_desc_also_occurs_in_current_desc_with_same_value = false; } } - if ( property_desc.is_set_defined ) + if (property_desc.is_set_defined) { - if ( !is_current_accessor_descriptor - || property_desc.set_p != ECMA_GET_POINTER( current_p->u.named_accessor_property.set_p) ) + if (!is_current_accessor_descriptor + || property_desc.set_p != ECMA_GET_POINTER(current_p->u.named_accessor_property.set_p)) { is_every_field_in_desc_also_occurs_in_current_desc_with_same_value = false; } } - if ( property_desc.is_enumerable_defined ) + if (property_desc.is_enumerable_defined) { - if ( property_desc.enumerable != current_enumerable ) + if (property_desc.enumerable != current_enumerable) { is_every_field_in_desc_also_occurs_in_current_desc_with_same_value = false; } } - if ( property_desc.is_configurable_defined ) + if (property_desc.is_configurable_defined) { - if ( property_desc.configurable != current_configurable ) + if (property_desc.configurable != current_configurable) { is_every_field_in_desc_also_occurs_in_current_desc_with_same_value = false; } } - if ( is_every_field_in_desc_also_occurs_in_current_desc_with_same_value ) + if (is_every_field_in_desc_also_occurs_in_current_desc_with_same_value) { - return ecma_make_simple_completion_value( ECMA_SIMPLE_VALUE_TRUE); + return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE); } // 7. - if ( current_p->u.named_accessor_property.configurable == ECMA_PROPERTY_NOT_CONFIGURABLE ) + if (current_p->u.named_accessor_property.configurable == ECMA_PROPERTY_NOT_CONFIGURABLE) { - if ( property_desc.configurable == ECMA_PROPERTY_CONFIGURABLE - || ( property_desc.is_enumerable_defined - && property_desc.enumerable != current_enumerable ) ) + if (property_desc.configurable == ECMA_PROPERTY_CONFIGURABLE + || (property_desc.is_enumerable_defined + && property_desc.enumerable != current_enumerable)) { // a., b. - return ecma_reject( is_throw); + return ecma_reject (is_throw); } } // 8. - if ( is_property_desc_generic_descriptor ) + if (is_property_desc_generic_descriptor) { // no action required } - else if ( is_property_desc_data_descriptor != is_current_data_descriptor ) + else if (is_property_desc_data_descriptor != is_current_data_descriptor) { // 9. - if ( current_configurable == ECMA_PROPERTY_NOT_CONFIGURABLE ) + if (current_configurable == ECMA_PROPERTY_NOT_CONFIGURABLE) { // a. - return ecma_reject( is_throw); + return ecma_reject (is_throw); } - ecma_delete_property( obj_p, current_p); + ecma_delete_property (obj_p, current_p); - if ( is_current_data_descriptor ) + if (is_current_data_descriptor) { // b. - current_p = ecma_create_named_accessor_property( obj_p, + current_p = ecma_create_named_accessor_property (obj_p, property_name_p, NULL, NULL, @@ -692,97 +692,97 @@ ecma_op_object_define_own_property( ecma_object_t *obj_p, /**< the object */ { // c. - current_p = ecma_create_named_data_property( obj_p, + current_p = ecma_create_named_data_property (obj_p, property_name_p, ECMA_PROPERTY_NOT_WRITABLE, current_enumerable, current_configurable); } } - else if ( is_property_desc_data_descriptor && is_current_data_descriptor ) + else if (is_property_desc_data_descriptor && is_current_data_descriptor) { // 10. - if ( current_configurable == ECMA_PROPERTY_NOT_CONFIGURABLE ) + if (current_configurable == ECMA_PROPERTY_NOT_CONFIGURABLE) { // a. - if ( current_p->u.named_data_property.writable == ECMA_PROPERTY_NOT_WRITABLE ) + if (current_p->u.named_data_property.writable == ECMA_PROPERTY_NOT_WRITABLE) { // i. - if( property_desc.writable == ECMA_PROPERTY_WRITABLE ) + if (property_desc.writable == ECMA_PROPERTY_WRITABLE) { - return ecma_reject( is_throw); + return ecma_reject (is_throw); } // ii. - if ( property_desc.is_value_defined - && !ecma_op_same_value( property_desc.value, - current_p->u.named_data_property.value) ) + if (property_desc.is_value_defined + && !ecma_op_same_value (property_desc.value, + current_p->u.named_data_property.value)) { - return ecma_reject( is_throw); + return ecma_reject (is_throw); } } } } else { - JERRY_ASSERT( is_property_desc_accessor_descriptor && is_current_accessor_descriptor ); + JERRY_ASSERT(is_property_desc_accessor_descriptor && is_current_accessor_descriptor); // 11. - if ( current_configurable == ECMA_PROPERTY_NOT_CONFIGURABLE ) + if (current_configurable == ECMA_PROPERTY_NOT_CONFIGURABLE) { // a. - if ( ( property_desc.is_get_defined - && property_desc.get_p != ECMA_GET_POINTER( current_p->u.named_accessor_property.get_p) ) - || ( property_desc.is_set_defined - && property_desc.set_p != ECMA_GET_POINTER( current_p->u.named_accessor_property.set_p) ) ) + if ((property_desc.is_get_defined + && property_desc.get_p != ECMA_GET_POINTER(current_p->u.named_accessor_property.get_p)) + || (property_desc.is_set_defined + && property_desc.set_p != ECMA_GET_POINTER(current_p->u.named_accessor_property.set_p))) { // i., ii. - return ecma_reject( is_throw); + return ecma_reject (is_throw); } } } // 12. - if ( property_desc.is_value_defined ) + if (property_desc.is_value_defined) { - JERRY_ASSERT( is_current_data_descriptor ); + JERRY_ASSERT(is_current_data_descriptor); - ecma_free_value( current_p->u.named_data_property.value, false); - current_p->u.named_data_property.value = ecma_copy_value( property_desc.value, false); + ecma_free_value (current_p->u.named_data_property.value, false); + current_p->u.named_data_property.value = ecma_copy_value (property_desc.value, false); - ecma_gc_update_may_ref_younger_object_flag_by_value( obj_p, property_desc.value); + ecma_gc_update_may_ref_younger_object_flag_by_value (obj_p, property_desc.value); } - if ( property_desc.is_writable_defined ) + if (property_desc.is_writable_defined) { - JERRY_ASSERT( is_current_data_descriptor ); + JERRY_ASSERT(is_current_data_descriptor); current_p->u.named_data_property.writable = property_desc.writable; } - if ( property_desc.is_get_defined ) + if (property_desc.is_get_defined) { - JERRY_ASSERT( is_current_accessor_descriptor ); + JERRY_ASSERT(is_current_accessor_descriptor); - ECMA_SET_POINTER( current_p->u.named_accessor_property.get_p, property_desc.get_p); + ECMA_SET_POINTER(current_p->u.named_accessor_property.get_p, property_desc.get_p); - ecma_gc_update_may_ref_younger_object_flag_by_object( obj_p, property_desc.get_p); + ecma_gc_update_may_ref_younger_object_flag_by_object (obj_p, property_desc.get_p); } - if ( property_desc.is_set_defined ) + if (property_desc.is_set_defined) { - JERRY_ASSERT( is_current_accessor_descriptor ); + JERRY_ASSERT(is_current_accessor_descriptor); - ECMA_SET_POINTER( current_p->u.named_accessor_property.set_p, property_desc.set_p); + ECMA_SET_POINTER(current_p->u.named_accessor_property.set_p, property_desc.set_p); - ecma_gc_update_may_ref_younger_object_flag_by_object( obj_p, property_desc.set_p); + ecma_gc_update_may_ref_younger_object_flag_by_object (obj_p, property_desc.set_p); } - if ( property_desc.is_enumerable_defined ) + if (property_desc.is_enumerable_defined) { - if ( is_current_data_descriptor ) + if (is_current_data_descriptor) { current_p->u.named_data_property.enumerable = property_desc.enumerable; } @@ -792,9 +792,9 @@ ecma_op_object_define_own_property( ecma_object_t *obj_p, /**< the object */ } } - if ( property_desc.is_configurable_defined ) + if (property_desc.is_configurable_defined) { - if ( is_current_data_descriptor ) + if (is_current_data_descriptor) { current_p->u.named_data_property.configurable = property_desc.configurable; } @@ -804,7 +804,7 @@ ecma_op_object_define_own_property( ecma_object_t *obj_p, /**< the object */ } } - return ecma_make_simple_completion_value( ECMA_SIMPLE_VALUE_TRUE); + return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE); } /* ecma_op_object_define_own_property */ /** diff --git a/src/libecmaoperations/ecma-objects-properties.h b/src/libecmaoperations/ecma-objects-properties.h index f8f919f29..63df0fe89 100644 --- a/src/libecmaoperations/ecma-objects-properties.h +++ b/src/libecmaoperations/ecma-objects-properties.h @@ -26,20 +26,20 @@ * @{ */ -extern ecma_completion_value_t ecma_op_object_get( ecma_object_t *obj_p, const ecma_char_t *property_name_p); -extern ecma_property_t *ecma_op_object_get_own_property( ecma_object_t *obj_p, const ecma_char_t *property_name_p); -extern ecma_property_t *ecma_op_object_get_property( ecma_object_t *obj_p, const ecma_char_t *property_name_p); -extern ecma_completion_value_t ecma_op_object_put( ecma_object_t *obj_p, +extern ecma_completion_value_t ecma_op_object_get (ecma_object_t *obj_p, const ecma_char_t *property_name_p); +extern ecma_property_t *ecma_op_object_get_own_property (ecma_object_t *obj_p, const ecma_char_t *property_name_p); +extern ecma_property_t *ecma_op_object_get_property (ecma_object_t *obj_p, const ecma_char_t *property_name_p); +extern ecma_completion_value_t ecma_op_object_put (ecma_object_t *obj_p, const ecma_char_t *property_name_p, ecma_value_t value, bool is_throw); -extern bool ecma_op_object_can_put( ecma_object_t *obj_p, const ecma_char_t *property_name_p); -extern bool ecma_op_object_has_property( ecma_object_t *obj_p, const ecma_char_t *property_name_p); -extern ecma_completion_value_t ecma_op_object_delete( ecma_object_t *obj_p, +extern bool ecma_op_object_can_put (ecma_object_t *obj_p, const ecma_char_t *property_name_p); +extern bool ecma_op_object_has_property (ecma_object_t *obj_p, const ecma_char_t *property_name_p); +extern ecma_completion_value_t ecma_op_object_delete (ecma_object_t *obj_p, const ecma_char_t *property_name_p, bool is_throw); -extern ecma_completion_value_t ecma_op_object_default_value( ecma_object_t *obj_p, ecma_preferred_type_hint_t hint); -extern ecma_completion_value_t ecma_op_object_define_own_property( ecma_object_t *obj_p, +extern ecma_completion_value_t ecma_op_object_default_value (ecma_object_t *obj_p, ecma_preferred_type_hint_t hint); +extern ecma_completion_value_t ecma_op_object_define_own_property (ecma_object_t *obj_p, const ecma_char_t *property_name_p, ecma_property_descriptor_t property_desc, bool is_throw); diff --git a/src/libecmaoperations/ecma-operations.h b/src/libecmaoperations/ecma-operations.h index 1a76afb0a..d0c99c635 100644 --- a/src/libecmaoperations/ecma-operations.h +++ b/src/libecmaoperations/ecma-operations.h @@ -27,12 +27,12 @@ * @{ */ -extern ecma_reference_t ecma_op_get_identifier_reference( ecma_object_t *lex_env_p, const ecma_char_t *name_p, bool is_strict); +extern ecma_reference_t ecma_op_get_identifier_reference (ecma_object_t *lex_env_p, const ecma_char_t *name_p, bool is_strict); -extern ecma_completion_value_t ecma_op_get_value( ecma_reference_t ref); -extern ecma_completion_value_t ecma_op_put_value( ecma_reference_t ref, ecma_value_t value); +extern ecma_completion_value_t ecma_op_get_value (ecma_reference_t ref); +extern ecma_completion_value_t ecma_op_put_value (ecma_reference_t ref, ecma_value_t value); -extern void ecma_finalize( void); +extern void ecma_finalize (void); /** * @} diff --git a/src/libecmaoperations/ecma-reference.c b/src/libecmaoperations/ecma-reference.c index 6129c73ef..c30d987b0 100644 --- a/src/libecmaoperations/ecma-reference.c +++ b/src/libecmaoperations/ecma-reference.c @@ -40,33 +40,33 @@ * Returned value must be freed through ecma_free_reference. */ ecma_reference_t -ecma_op_get_identifier_reference(ecma_object_t *lex_env_p, /**< lexical environment */ +ecma_op_get_identifier_reference (ecma_object_t *lex_env_p, /**< lexical environment */ const ecma_char_t *name_p, /**< identifier's name */ bool is_strict) /**< strict reference flag */ { - JERRY_ASSERT( lex_env_p != NULL ); + JERRY_ASSERT(lex_env_p != NULL); ecma_object_t *lex_env_iter_p = lex_env_p; - while ( lex_env_iter_p != NULL ) + while (lex_env_iter_p != NULL) { ecma_completion_value_t completion_value; - completion_value = ecma_op_has_binding( lex_env_iter_p, name_p); + completion_value = ecma_op_has_binding (lex_env_iter_p, name_p); - if ( ecma_is_completion_value_normal_true( completion_value) ) + if (ecma_is_completion_value_normal_true (completion_value)) { - return ecma_make_reference( ecma_make_object_value( lex_env_iter_p), + return ecma_make_reference (ecma_make_object_value (lex_env_iter_p), name_p, is_strict); } else { - JERRY_ASSERT( ecma_is_completion_value_normal_false( completion_value) ); + JERRY_ASSERT(ecma_is_completion_value_normal_false (completion_value)); } - lex_env_iter_p = ECMA_GET_POINTER( lex_env_iter_p->u.lexical_environment.outer_reference_p); + lex_env_iter_p = ECMA_GET_POINTER(lex_env_iter_p->u.lexical_environment.outer_reference_p); } - return ecma_make_reference( ecma_make_simple_value( ECMA_SIMPLE_VALUE_UNDEFINED), + return ecma_make_reference (ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED), name_p, is_strict); } /* ecma_op_get_identifier_reference */ @@ -82,11 +82,11 @@ ecma_op_get_identifier_reference(ecma_object_t *lex_env_p, /**< lexical environm * Returned value must be freed through ecma_free_reference. */ ecma_reference_t -ecma_make_reference(ecma_value_t base, /**< base value */ +ecma_make_reference (ecma_value_t base, /**< base value */ const ecma_char_t *name_p, /**< referenced name */ bool is_strict) /**< strict reference flag */ { - ecma_reference_t ref = (ecma_reference_t) { .base = ecma_copy_value( base, true), + ecma_reference_t ref = (ecma_reference_t) { .base = ecma_copy_value (base, true), .referenced_name_p = name_p, .is_strict = is_strict }; @@ -100,9 +100,9 @@ ecma_make_reference(ecma_value_t base, /**< base value */ * freeing invalidates all copies of the reference. */ void -ecma_free_reference( const ecma_reference_t ref) /**< reference */ +ecma_free_reference (const ecma_reference_t ref) /**< reference */ { - ecma_free_value( ref.base, true); + ecma_free_value (ref.base, true); } /* ecma_free_reference */ /** diff --git a/src/libecmaoperations/ecma-reference.h b/src/libecmaoperations/ecma-reference.h index 2f488695f..dd210fa3f 100644 --- a/src/libecmaoperations/ecma-reference.h +++ b/src/libecmaoperations/ecma-reference.h @@ -28,9 +28,9 @@ * @{ */ -extern ecma_reference_t ecma_op_get_identifier_reference(ecma_object_t *lex_env_p, const ecma_char_t *name_p, bool is_strict); -extern ecma_reference_t ecma_make_reference( ecma_value_t base, const ecma_char_t *name_p, bool is_strict); -extern void ecma_free_reference( const ecma_reference_t ref); +extern ecma_reference_t ecma_op_get_identifier_reference (ecma_object_t *lex_env_p, const ecma_char_t *name_p, bool is_strict); +extern ecma_reference_t ecma_make_reference (ecma_value_t base, const ecma_char_t *name_p, bool is_strict); +extern void ecma_free_reference (const ecma_reference_t ref); /** * @} diff --git a/src/libecmaoperations/ecma-try-catch-macro.h b/src/libecmaoperations/ecma-try-catch-macro.h index 1b47559ef..a5ead17c4 100644 --- a/src/libecmaoperations/ecma-try-catch-macro.h +++ b/src/libecmaoperations/ecma-try-catch-macro.h @@ -29,13 +29,13 @@ */ #define ECMA_TRY_CATCH(var, op, return_value) \ ecma_completion_value_t var = op; \ - if ( unlikely( ecma_is_completion_value_throw( var) ) ) \ + if (unlikely (ecma_is_completion_value_throw (var))) \ { \ - return_value = ecma_copy_completion_value( var); \ + return_value = ecma_copy_completion_value (var); \ } \ else \ { \ - JERRY_ASSERT( ecma_is_completion_value_normal( var) ) + JERRY_ASSERT(ecma_is_completion_value_normal (var)) /** * The macro marks end of code block that is executed if no exception @@ -47,6 +47,6 @@ * argument as corresponding ECMA_TRY_CATCH's first argument. */ #define ECMA_FINALIZE(var) } \ - ecma_free_completion_value( var) + ecma_free_completion_value (var) #endif /* !ECMA_TRY_CATCH_MACRO_H */