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:
committed by
Dániel Bátyai
parent
59e0d6e262
commit
3b73562fa5
@@ -45,9 +45,9 @@ snapshot_get_global_flags (bool has_regex, /**< regex literal is present */
|
||||
#if ENABLED (JERRY_BUILTIN_REGEXP)
|
||||
flags |= (has_regex ? JERRY_SNAPSHOT_HAS_REGEX_LITERAL : 0);
|
||||
#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */
|
||||
#if ENABLED (JERRY_ES2015_CLASS)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
flags |= (has_class ? JERRY_SNAPSHOT_HAS_CLASS_LITERAL : 0);
|
||||
#endif /* ENABLED (JERRY_ES2015_CLASS) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
|
||||
return flags;
|
||||
} /* snapshot_get_global_flags */
|
||||
@@ -63,9 +63,9 @@ snapshot_check_global_flags (uint32_t global_flags) /**< global flags */
|
||||
#if ENABLED (JERRY_BUILTIN_REGEXP)
|
||||
global_flags &= (uint32_t) ~JERRY_SNAPSHOT_HAS_REGEX_LITERAL;
|
||||
#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */
|
||||
#if ENABLED (JERRY_ES2015_CLASS)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
global_flags &= (uint32_t) ~JERRY_SNAPSHOT_HAS_CLASS_LITERAL;
|
||||
#endif /* ENABLED (JERRY_ES2015_CLASS) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
|
||||
return global_flags == snapshot_get_global_flags (false, false);
|
||||
} /* snapshot_check_global_flags */
|
||||
@@ -160,12 +160,12 @@ snapshot_add_compiled_code (ecma_compiled_code_t *compiled_code_p, /**< compiled
|
||||
uint8_t *copied_code_start_p = snapshot_buffer_p + globals_p->snapshot_buffer_write_offset;
|
||||
ecma_compiled_code_t *copied_code_p = (ecma_compiled_code_t *) copied_code_start_p;
|
||||
|
||||
#if ENABLED (JERRY_ES2015_CLASS)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
if (compiled_code_p->status_flags & CBC_CODE_FLAGS_CONSTRUCTOR)
|
||||
{
|
||||
globals_p->class_found = true;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_CLASS) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_REGEXP)
|
||||
if (!(compiled_code_p->status_flags & CBC_CODE_FLAGS_FUNCTION))
|
||||
|
||||
+13
-13
@@ -811,12 +811,12 @@ jerry_value_is_symbol (const jerry_value_t value) /**< api value */
|
||||
{
|
||||
jerry_assert_api_available ();
|
||||
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
return ecma_is_value_symbol (value);
|
||||
#else /* !ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */
|
||||
#else /* !ENABLED (JERRY_ES2015) */
|
||||
JERRY_UNUSED (value);
|
||||
return false;
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
} /* jerry_value_is_symbol */
|
||||
|
||||
/**
|
||||
@@ -870,12 +870,12 @@ jerry_value_get_type (const jerry_value_t value) /**< input value to check */
|
||||
{
|
||||
return JERRY_TYPE_STRING;
|
||||
}
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
case LIT_MAGIC_STRING_SYMBOL:
|
||||
{
|
||||
return JERRY_TYPE_SYMBOL;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
case LIT_MAGIC_STRING_FUNCTION:
|
||||
{
|
||||
return JERRY_TYPE_FUNCTION;
|
||||
@@ -940,9 +940,9 @@ jerry_is_feature_enabled (const jerry_feature_t feature) /**< feature to check *
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_PROMISE)
|
||||
|| feature == JERRY_FEATURE_PROMISE
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_PROMISE) */
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
|| feature == JERRY_FEATURE_SYMBOL
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY)
|
||||
|| feature == JERRY_FEATURE_TYPEDARRAY
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */
|
||||
@@ -1638,11 +1638,11 @@ jerry_create_symbol (const jerry_value_t value) /**< api value */
|
||||
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
return jerry_return (ecma_op_create_symbol (&value, 1));
|
||||
#else /* !ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */
|
||||
#else /* !ENABLED (JERRY_ES2015) */
|
||||
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("Symbol is not supported.")));
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
} /* jerry_create_symbol */
|
||||
|
||||
/**
|
||||
@@ -3092,7 +3092,7 @@ jerry_get_symbol_descriptive_string (const jerry_value_t symbol) /**< symbol val
|
||||
{
|
||||
jerry_assert_api_available ();
|
||||
|
||||
#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL)
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
if (!ecma_is_value_symbol (symbol))
|
||||
{
|
||||
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
|
||||
@@ -3100,11 +3100,11 @@ jerry_get_symbol_descriptive_string (const jerry_value_t symbol) /**< symbol val
|
||||
|
||||
/* Note: This operation cannot throw an error */
|
||||
return ecma_get_symbol_descriptive_string (symbol);
|
||||
#else /* !ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */
|
||||
#else /* !ENABLED (JERRY_ES2015) */
|
||||
JERRY_UNUSED (symbol);
|
||||
|
||||
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("Symbol is not supported.")));
|
||||
#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
} /** jerry_get_symbol_descriptive_string */
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user