Revise ES2015 feature guards (#3240)

All the basic language element guards are merged into JERRY_ES2015 macro guard.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2019-10-24 14:44:51 +02:00
committed by Dániel Bátyai
parent 59e0d6e262
commit 3b73562fa5
77 changed files with 725 additions and 911 deletions
+34 -34
View File
@@ -173,12 +173,12 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
/* ES2015 9.4.5.1 */
if (ecma_is_typedarray (ecma_make_object_value (object_p)))
{
#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL)
#if ENABLED (JERRY_ES2015)
if (ecma_prop_name_is_symbol (property_name_p))
{
break;
}
#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */
#endif /* ENABLED (JERRY_ES2015) */
uint32_t array_index = ecma_string_get_array_index (property_name_p);
@@ -250,7 +250,7 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
/* Get length virtual property. */
const ecma_compiled_code_t *bytecode_data_p;
#if ENABLED (JERRY_ES2015_ARROW_FUNCTION)
#if ENABLED (JERRY_ES2015)
if (type != ECMA_OBJECT_TYPE_ARROW_FUNCTION)
{
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;
@@ -261,10 +261,10 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
ecma_arrow_function_t *arrow_func_p = (ecma_arrow_function_t *) object_p;
bytecode_data_p = ecma_op_arrow_function_get_compiled_code (arrow_func_p);
}
#else /* !ENABLED (JERRY_ES2015_ARROW_FUNCTION) */
#else /* !ENABLED (JERRY_ES2015) */
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;
bytecode_data_p = ecma_op_function_get_compiled_code (ext_func_p);
#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */
#endif /* ENABLED (JERRY_ES2015) */
uint32_t len;
if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)
@@ -542,12 +542,12 @@ ecma_op_object_find_own (ecma_value_t base_value, /**< base value */
/* ES2015 9.4.5.4 */
if (ecma_is_typedarray (ecma_make_object_value (object_p)))
{
#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL)
#if ENABLED (JERRY_ES2015)
if (ecma_prop_name_is_symbol (property_name_p))
{
break;
}
#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */
#endif /* ENABLED (JERRY_ES2015) */
uint32_t array_index = ecma_string_get_array_index (property_name_p);
@@ -602,7 +602,7 @@ ecma_op_object_find_own (ecma_value_t base_value, /**< base value */
/* Get length virtual property. */
const ecma_compiled_code_t *bytecode_data_p;
#if ENABLED (JERRY_ES2015_ARROW_FUNCTION)
#if ENABLED (JERRY_ES2015)
if (type != ECMA_OBJECT_TYPE_ARROW_FUNCTION)
{
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;
@@ -613,10 +613,10 @@ ecma_op_object_find_own (ecma_value_t base_value, /**< base value */
ecma_arrow_function_t *arrow_func_p = (ecma_arrow_function_t *) object_p;
bytecode_data_p = ecma_op_arrow_function_get_compiled_code (arrow_func_p);
}
#else /* !ENABLED (JERRY_ES2015_ARROW_FUNCTION) */
#else /* !ENABLED (JERRY_ES2015) */
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;
bytecode_data_p = ecma_op_function_get_compiled_code (ext_func_p);
#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */
#endif /* ENABLED (JERRY_ES2015) */
uint32_t len;
if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)
@@ -847,7 +847,7 @@ ecma_op_object_get_by_magic_id (ecma_object_t *object_p, /**< the object */
return ecma_op_object_get (object_p, ecma_get_magic_string (property_id));
} /* ecma_op_object_get_by_magic_id */
#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL)
#if ENABLED (JERRY_ES2015)
/**
* [[Get]] operation of ecma object where the property is a well-known symbol
*
@@ -919,7 +919,7 @@ ecma_op_get_method_by_symbol_id (ecma_value_t value, /**< ecma value */
/* 6. */
return func;
} /* ecma_op_get_method_by_symbol_id */
#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */
#endif /* ENABLED (JERRY_ES2015) */
/**
* [[Put]] ecma general object's operation specialized for uint32_ property index
@@ -1072,12 +1072,12 @@ ecma_op_object_put (ecma_object_t *object_p, /**< the object */
/* ES2015 9.4.5.5 */
if (ecma_is_typedarray (ecma_make_object_value (object_p)))
{
#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL)
#if ENABLED (JERRY_ES2015)
if (ecma_prop_name_is_symbol (property_name_p))
{
break;
}
#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */
#endif /* ENABLED (JERRY_ES2015) */
uint32_t array_index = ecma_string_get_array_index (property_name_p);
@@ -1447,9 +1447,9 @@ ecma_op_object_define_own_property (ecma_object_t *obj_p, /**< the object */
case ECMA_OBJECT_TYPE_GENERAL:
case ECMA_OBJECT_TYPE_CLASS:
case ECMA_OBJECT_TYPE_FUNCTION:
#if ENABLED (JERRY_ES2015_ARROW_FUNCTION)
#if ENABLED (JERRY_ES2015)
case ECMA_OBJECT_TYPE_ARROW_FUNCTION:
#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */
#endif /* ENABLED (JERRY_ES2015) */
case ECMA_OBJECT_TYPE_EXTERNAL_FUNCTION:
case ECMA_OBJECT_TYPE_BOUND_FUNCTION:
{
@@ -1485,14 +1485,14 @@ ecma_op_object_define_own_property (ecma_object_t *obj_p, /**< the object */
/* ES2015 9.4.5.3 */
if (ecma_is_typedarray (ecma_make_object_value (obj_p)))
{
#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL)
#if ENABLED (JERRY_ES2015)
if (ecma_prop_name_is_symbol (property_name_p))
{
return ecma_op_general_object_define_own_property (obj_p,
property_name_p,
property_desc_p);
}
#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */
#endif /* ENABLED (JERRY_ES2015) */
uint32_t array_index = ecma_string_get_array_index (property_name_p);
if (array_index != ECMA_STRING_NOT_ARRAY_INDEX)
@@ -1717,9 +1717,9 @@ ecma_op_object_get_property_names (ecma_object_t *obj_p, /**< object */
const bool is_enumerable_only = (opts & ECMA_LIST_ENUMERABLE) != 0;
const bool is_array_indices_only = (opts & ECMA_LIST_ARRAY_INDICES) != 0;
const bool is_with_prototype_chain = (opts & ECMA_LIST_PROTOTYPE) != 0;
#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL)
#if ENABLED (JERRY_ES2015)
const bool is_symbols_only = (opts & ECMA_LIST_SYMBOLS) != 0;
#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */
#endif /* ENABLED (JERRY_ES2015) */
const size_t bitmap_row_size = sizeof (uint32_t) * JERRY_BITSINBYTE;
const size_t names_hashes_bitmap_size = ECMA_OBJECT_HASH_BITMAP_SIZE / bitmap_row_size;
@@ -1736,10 +1736,10 @@ ecma_op_object_get_property_names (ecma_object_t *obj_p, /**< object */
ecma_collection_t *prop_names_p = ecma_new_collection ();
#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL)
#if ENABLED (JERRY_ES2015)
if (JERRY_LIKELY (!is_symbols_only))
{
#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */
#endif /* ENABLED (JERRY_ES2015) */
if (obj_is_builtin)
{
@@ -1763,9 +1763,9 @@ ecma_op_object_get_property_names (ecma_object_t *obj_p, /**< object */
break;
}
case ECMA_OBJECT_TYPE_FUNCTION:
#if ENABLED (JERRY_ES2015_ARROW_FUNCTION)
#if ENABLED (JERRY_ES2015)
case ECMA_OBJECT_TYPE_ARROW_FUNCTION:
#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */
#endif /* ENABLED (JERRY_ES2015) */
{
ecma_op_function_list_lazy_property_names (obj_p,
is_enumerable_only,
@@ -1817,9 +1817,9 @@ ecma_op_object_get_property_names (ecma_object_t *obj_p, /**< object */
}
}
}
#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL)
#if ENABLED (JERRY_ES2015)
}
#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */
#endif /* ENABLED (JERRY_ES2015) */
ecma_value_t *buffer_p = prop_names_p->buffer_p;
@@ -1831,10 +1831,10 @@ ecma_op_object_get_property_names (ecma_object_t *obj_p, /**< object */
{
ecma_string_t *name_p = ecma_get_string_from_value (buffer_p[i]);
#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL)
#if ENABLED (JERRY_ES2015)
/* Symbols are never lazy listed */
JERRY_ASSERT (!ecma_prop_name_is_symbol (name_p));
#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */
#endif /* ENABLED (JERRY_ES2015) */
uint8_t hash = (uint8_t) ecma_string_hash (name_p);
uint32_t bitmap_row = (uint32_t) (hash / bitmap_row_size);
@@ -1938,7 +1938,7 @@ ecma_op_object_get_property_names (ecma_object_t *obj_p, /**< object */
if (!(is_enumerable_only && !ecma_is_property_enumerable (*property_p)))
{
#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL)
#if ENABLED (JERRY_ES2015)
/* If is_symbols_only is false and prop_name is symbol
we should skip the current property e.g. for-in.
@@ -1949,7 +1949,7 @@ ecma_op_object_get_property_names (ecma_object_t *obj_p, /**< object */
ecma_deref_ecma_string (name_p);
continue;
}
#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */
#endif /* ENABLED (JERRY_ES2015) */
uint8_t hash = (uint8_t) ecma_string_hash (name_p);
uint32_t bitmap_row = (uint32_t) (hash / bitmap_row_size);
@@ -2220,9 +2220,9 @@ ecma_object_check_class_name_is_object (ecma_object_t *obj_p) /**< object */
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_SET_ITERATOR_PROTOTYPE)
#endif /* ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) */
#endif /* ENABLED (JERRY_ES2015_BUILTIN_SET) */
#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL)
#if ENABLED (JERRY_ES2015)
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE)
#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */
#endif /* ENABLED (JERRY_ES2015) */
#if ENABLED (JERRY_ES2015_BUILTIN_DATAVIEW)
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_DATAVIEW_PROTOTYPE)
#endif /* ENABLED (JERRY_ES2015_BUILTIN_DATAVIEW) */
@@ -2298,9 +2298,9 @@ ecma_object_get_class_name (ecma_object_t *obj_p) /**< object */
break;
}
case ECMA_OBJECT_TYPE_FUNCTION:
#if ENABLED (JERRY_ES2015_ARROW_FUNCTION)
#if ENABLED (JERRY_ES2015)
case ECMA_OBJECT_TYPE_ARROW_FUNCTION:
#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */
#endif /* ENABLED (JERRY_ES2015) */
case ECMA_OBJECT_TYPE_EXTERNAL_FUNCTION:
case ECMA_OBJECT_TYPE_BOUND_FUNCTION:
{