From ea77a79461c10e4e109c568fae53cb0da47c4d9e Mon Sep 17 00:00:00 2001 From: Daniel Balla Date: Mon, 2 Sep 2019 14:52:35 +0300 Subject: [PATCH] Add missing feature guard to jerry_create_typedarray_for_arraybuffer function (#3035) JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu --- jerry-core/api/jerry.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jerry-core/api/jerry.c b/jerry-core/api/jerry.c index 0d2bc391e..6170e88a1 100644 --- a/jerry-core/api/jerry.c +++ b/jerry-core/api/jerry.c @@ -3594,8 +3594,15 @@ jerry_create_typedarray_for_arraybuffer (jerry_typedarray_type_t type_name, /**< const jerry_value_t arraybuffer) /**< ArrayBuffer to use */ { jerry_assert_api_available (); + +#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) jerry_length_t byteLength = jerry_get_arraybuffer_byte_length (arraybuffer); return jerry_create_typedarray_for_arraybuffer_sz (type_name, arraybuffer, 0, byteLength); +#else /* !ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ + JERRY_UNUSED (type_name); + JERRY_UNUSED (arraybuffer); + return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("TypedArray not supported."))); +#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ } /* jerry_create_typedarray_for_arraybuffer */ /**