diff --git a/jerry-core/ecma/base/ecma-helpers-conversion.c b/jerry-core/ecma/base/ecma-helpers-conversion.c
index 4d04e65a8..160e67c58 100644
--- a/jerry-core/ecma/base/ecma-helpers-conversion.c
+++ b/jerry-core/ecma/base/ecma-helpers-conversion.c
@@ -295,7 +295,12 @@ ecma_utf8_string_to_number_by_radix (const lit_utf8_byte_t *str_p, /**< utf-8 st
const lit_utf8_byte_t *end_p, /**< end of utf-8 string */
uint32_t radix) /**< radix */
{
+#if ENABLED (JERRY_ESNEXT)
+ bool allow_underscore = (radix & ECMA_CONVERSION_ALLOW_UNDERSCORE);
+ radix &= (uint32_t) ~ECMA_CONVERSION_ALLOW_UNDERSCORE;
+#endif /* ENABLED (JERRY_ESNEXT) */
JERRY_ASSERT (radix == 2 || radix == 8 || radix == 16);
+
ecma_number_t num = ECMA_NUMBER_ZERO;
#if ENABLED (JERRY_ESNEXT)
@@ -342,6 +347,12 @@ ecma_utf8_string_to_number_by_radix (const lit_utf8_byte_t *str_p, /**< utf-8 st
{
digit_value = 10 + (*iter_p - LIT_CHAR_UPPERCASE_A);
}
+#if ENABLED (JERRY_ESNEXT)
+ else if (*iter_p == LIT_CHAR_UNDERSCORE && allow_underscore)
+ {
+ continue;
+ }
+#endif /* ENABLED (JERRY_ESNEXT) */
else
{
return ecma_number_make_nan ();
@@ -364,7 +375,8 @@ ecma_utf8_string_to_number_by_radix (const lit_utf8_byte_t *str_p, /**< utf-8 st
*/
ecma_number_t
ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */
- lit_utf8_size_t str_size) /**< string size */
+ lit_utf8_size_t str_size, /**< string size */
+ uint32_t options) /**< allowing underscore option bit */
{
/* TODO: Check license issues */
@@ -388,15 +400,15 @@ ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */
{
case LIT_CHAR_LOWERCASE_X :
{
- return ecma_utf8_string_to_number_by_radix (str_p + 2, end_p, 16);
+ return ecma_utf8_string_to_number_by_radix (str_p + 2, end_p, 16 | options);
}
case LIT_CHAR_LOWERCASE_O :
{
- return ecma_utf8_string_to_number_by_radix (str_p + 2, end_p, 8);
+ return ecma_utf8_string_to_number_by_radix (str_p + 2, end_p, 8 | options);
}
case LIT_CHAR_LOWERCASE_B :
{
- return ecma_utf8_string_to_number_by_radix (str_p + 2, end_p, 2);
+ return ecma_utf8_string_to_number_by_radix (str_p + 2, end_p, 2 | options);
}
default:
{
@@ -449,6 +461,13 @@ ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */
digit_seen = true;
digit_value = (*str_p - LIT_CHAR_0);
}
+#if ENABLED (JERRY_ESNEXT)
+ else if (*str_p == LIT_CHAR_UNDERSCORE && (options & ECMA_CONVERSION_ALLOW_UNDERSCORE))
+ {
+ str_p++;
+ continue;
+ }
+#endif /* ENABLED (JERRY_ESNEXT) */
else
{
break;
@@ -491,6 +510,11 @@ ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */
digit_seen = true;
digit_value = (*str_p - LIT_CHAR_0);
}
+ else if (*str_p == LIT_CHAR_UNDERSCORE && (options & ECMA_CONVERSION_ALLOW_UNDERSCORE))
+ {
+ str_p++;
+ continue;
+ }
else
{
break;
@@ -550,6 +574,13 @@ ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */
{
digit_value = (*str_p - LIT_CHAR_0);
}
+#if ENABLED (JERRY_ESNEXT)
+ else if (*str_p == LIT_CHAR_UNDERSCORE && (options & ECMA_CONVERSION_ALLOW_UNDERSCORE))
+ {
+ str_p++;
+ continue;
+ }
+#endif /* ENABLED (JERRY_ESNEXT) */
else
{
return ecma_number_make_nan ();
diff --git a/jerry-core/ecma/base/ecma-helpers-number.c b/jerry-core/ecma/base/ecma-helpers-number.c
index 846045ea0..07652f748 100644
--- a/jerry-core/ecma/base/ecma-helpers-number.c
+++ b/jerry-core/ecma/base/ecma-helpers-number.c
@@ -1059,7 +1059,7 @@ ecma_number_parse_float (const lit_utf8_byte_t *string_buff, /**< routine's firs
}
/* 5. */
- ecma_number_t ret_num = ecma_utf8_string_to_number (start_p, (lit_utf8_size_t) (end_p - start_p));
+ ecma_number_t ret_num = ecma_utf8_string_to_number (start_p, (lit_utf8_size_t) (end_p - start_p), 0);
if (sign)
{
diff --git a/jerry-core/ecma/base/ecma-helpers-string.c b/jerry-core/ecma/base/ecma-helpers-string.c
index 9a69a42d1..4317d462a 100644
--- a/jerry-core/ecma/base/ecma-helpers-string.c
+++ b/jerry-core/ecma/base/ecma-helpers-string.c
@@ -985,7 +985,7 @@ ecma_string_to_number (const ecma_string_t *string_p) /**< ecma-string */
return ECMA_NUMBER_ZERO;
}
- return ecma_utf8_string_to_number (chars_p, size);
+ return ecma_utf8_string_to_number (chars_p, size, 0);
} /* ecma_string_to_number */
/**
diff --git a/jerry-core/ecma/base/ecma-helpers.h b/jerry-core/ecma/base/ecma-helpers.h
index c7c5ed594..24e37874e 100644
--- a/jerry-core/ecma/base/ecma-helpers.h
+++ b/jerry-core/ecma/base/ecma-helpers.h
@@ -96,6 +96,11 @@ typedef enum
ECMA_STRING_FLAG_MUST_BE_FREED = (1 << 3), /**< The returned buffer must be freed */
} ecma_string_flag_t;
+/**
+ * Underscore is ignored when this option is passed.
+ */
+ #define ECMA_CONVERSION_ALLOW_UNDERSCORE 0x1
+
/**
* Convert ecma-string's contents to a cesu-8 string and put it into a buffer.
*/
@@ -525,7 +530,8 @@ ecma_native_pointer_t *ecma_get_native_pointer_value (ecma_object_t *obj_p, void
bool ecma_delete_native_pointer_property (ecma_object_t *obj_p, void *info_p);
/* ecma-helpers-conversion.c */
-ecma_number_t ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, lit_utf8_size_t str_size);
+ecma_number_t ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, lit_utf8_size_t str_size,
+ uint32_t option);
lit_utf8_size_t ecma_uint32_to_utf8_string (uint32_t value, lit_utf8_byte_t *out_buffer_p, lit_utf8_size_t buffer_size);
uint32_t ecma_number_to_uint32 (ecma_number_t num);
int32_t ecma_number_to_int32 (ecma_number_t num);
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-date.c b/jerry-core/ecma/builtin-objects/ecma-builtin-date.c
index 95521ac54..2a254cf13 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-date.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-date.c
@@ -68,7 +68,7 @@ ecma_date_parse_date_chars (const lit_utf8_byte_t **str_p, /**< pointer to the c
}
}
- ecma_number_t parsed_number = ecma_utf8_string_to_number (str_start_p, (lit_utf8_size_t) (*str_p - str_start_p));
+ ecma_number_t parsed_number = ecma_utf8_string_to_number (str_start_p, (lit_utf8_size_t) (*str_p - str_start_p), 0);
if (parsed_number < min || parsed_number > max)
{
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-json.c b/jerry-core/ecma/builtin-objects/ecma-builtin-json.c
index 760180489..aa42c4cfb 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-json.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-json.c
@@ -287,7 +287,7 @@ ecma_builtin_json_parse_number (ecma_json_token_t *token_p) /**< token argument
}
token_p->type = TOKEN_NUMBER;
- token_p->u.number = ecma_utf8_string_to_number (start_p, (lit_utf8_size_t) (current_p - start_p));
+ token_p->u.number = ecma_utf8_string_to_number (start_p, (lit_utf8_size_t) (current_p - start_p), 0);
token_p->current_p = current_p;
} /* ecma_builtin_json_parse_number */
diff --git a/jerry-core/ecma/operations/ecma-bigint.c b/jerry-core/ecma/operations/ecma-bigint.c
index b4d9c1e35..dfb9d2c2a 100644
--- a/jerry-core/ecma/operations/ecma-bigint.c
+++ b/jerry-core/ecma/operations/ecma-bigint.c
@@ -75,6 +75,7 @@ ecma_bigint_parse_string (const lit_utf8_byte_t *string_p, /**< string represena
{
ecma_bigint_digit_t radix = 10;
uint32_t sign = (options & ECMA_BIGINT_PARSE_SET_NEGATIVE) ? ECMA_BIGINT_SIGN : 0;
+ bool allow_underscore = options & ECMA_BIGINT_PARSE_ALLOW_UNDERSCORE;
const lit_utf8_byte_t *string_end_p = string_p + size;
string_p = ecma_string_trim_front (string_p, string_p + size);
@@ -120,7 +121,7 @@ ecma_bigint_parse_string (const lit_utf8_byte_t *string_p, /**< string represena
return ECMA_BIGINT_ZERO;
}
- while (string_p < string_end_p && *string_p == LIT_CHAR_0)
+ while (string_p < string_end_p && (*string_p == LIT_CHAR_0 || (*string_p == LIT_CHAR_UNDERSCORE && allow_underscore)))
{
string_p++;
}
@@ -140,6 +141,10 @@ ecma_bigint_parse_string (const lit_utf8_byte_t *string_p, /**< string represena
{
digit = (ecma_bigint_digit_t) (*string_p - LIT_CHAR_0);
}
+ else if (*string_p == LIT_CHAR_UNDERSCORE && allow_underscore)
+ {
+ continue;
+ }
else
{
lit_utf8_byte_t character = (lit_utf8_byte_t) LEXER_TO_ASCII_LOWERCASE (*string_p);
diff --git a/jerry-core/ecma/operations/ecma-bigint.h b/jerry-core/ecma/operations/ecma-bigint.h
index aa42ab08b..8c7f01358 100644
--- a/jerry-core/ecma/operations/ecma-bigint.h
+++ b/jerry-core/ecma/operations/ecma-bigint.h
@@ -36,6 +36,7 @@ typedef enum
* return with ECMA_VALUE_FALSE */
ECMA_BIGINT_PARSE_DISALLOW_MEMORY_ERROR = (1 << 2), /**< don't throw out-of-memory error,
* return with ECMA_VALUE_NULL instead */
+ ECMA_BIGINT_PARSE_ALLOW_UNDERSCORE = (1 << 3), /** allow parse underscore characters */
} ecma_bigint_parse_string_options_t;
/**
diff --git a/jerry-core/parser/js/js-lexer.c b/jerry-core/parser/js/js-lexer.c
index aa0db527b..dd2b97da2 100644
--- a/jerry-core/parser/js/js-lexer.c
+++ b/jerry-core/parser/js/js-lexer.c
@@ -1305,26 +1305,43 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
} /* lexer_parse_string */
/**
- * Parse octal number.
+ * Check number
*/
-static inline void
-lexer_parse_octal_number (parser_context_t *context_p, /** context */
- const uint8_t **source_p) /**< current source position */
+static void
+lexer_check_numbers (parser_context_t *context_p, /**< context */
+ const uint8_t **source_p, /**< source_pointer */
+ const uint8_t *source_end_p, /**< end of the source */
+ const ecma_char_t digit_max, /**< maximum of the number range */
+ const bool is_legacy) /**< is legacy octal number */
{
- do
+#if ENABLED (!JERRY_ESNEXT)
+ JERRY_UNUSED (context_p);
+ JERRY_UNUSED (is_legacy);
+#endif /* ENABLED (!JERRY_ESNEXT) */
+ while (true)
{
- (*source_p)++;
- }
- while (*source_p < context_p->source_end_p
- && *source_p[0] >= LIT_CHAR_0
- && *source_p[0] <= LIT_CHAR_7);
+ while (*source_p < source_end_p
+ && *source_p[0] >= LIT_CHAR_0
+ && *source_p[0] <= digit_max)
+ {
+ *source_p += 1;
+ }
+#if ENABLED (JERRY_ESNEXT)
+ if (*source_p != source_end_p && *source_p[0] == LIT_CHAR_UNDERSCORE)
+ {
+ *source_p += 1;
+ if (is_legacy || *source_p[0] == LIT_CHAR_UNDERSCORE
+ || *source_p[0] > digit_max || *source_p[0] < LIT_CHAR_0)
+ {
+ parser_raise_error (context_p, PARSER_ERR_INVALID_UNDERSCORE_IN_NUMBER);
+ }
+ continue;
+ }
+#endif /* ENABLED (JERRY_ESNEXT) */
- if (*source_p < context_p->source_end_p
- && (*source_p[0] == LIT_CHAR_8 || *source_p[0] == LIT_CHAR_9))
- {
- parser_raise_error (context_p, PARSER_ERR_INVALID_OCTAL_DIGIT);
+ break;
}
-} /* lexer_parse_octal_number */
+} /* lexer_check_numbers */
/**
* Parse number.
@@ -1349,6 +1366,12 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
if (source_p[0] == LIT_CHAR_0
&& source_p + 1 < source_end_p)
{
+#if ENABLED (JERRY_ESNEXT)
+ if (source_p[1] == LIT_CHAR_UNDERSCORE)
+ {
+ parser_raise_error (context_p, PARSER_ERR_INVALID_UNDERSCORE_IN_NUMBER);
+ }
+#endif /* ENABLED (JERRY_ESNEXT) */
if (LEXER_TO_ASCII_LOWERCASE (source_p[1]) == LIT_CHAR_LOWERCASE_X)
{
context_p->token.extra_value = LEXER_NUMBER_HEXADECIMAL;
@@ -1363,6 +1386,16 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
do
{
source_p++;
+#if ENABLED (JERRY_ESNEXT)
+ if (source_p < source_end_p && source_p[0] == LIT_CHAR_UNDERSCORE)
+ {
+ source_p++;
+ if (!lit_char_is_hex_digit (source_p[0]) || source_p == source_end_p)
+ {
+ parser_raise_error (context_p, PARSER_ERR_INVALID_UNDERSCORE_IN_NUMBER);
+ }
+ }
+#endif /* ENABLED (JERRY_ESNEXT) */
}
while (source_p < source_end_p
&& lit_char_is_hex_digit (source_p[0]));
@@ -1379,7 +1412,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
parser_raise_error (context_p, PARSER_ERR_INVALID_OCTAL_DIGIT);
}
- lexer_parse_octal_number (context_p, &source_p);
+ lexer_check_numbers (context_p, &source_p, source_end_p, LIT_CHAR_7, false);
}
#endif /* ENABLED (JERRY_ESNEXT) */
else if (source_p[1] >= LIT_CHAR_0
@@ -1395,7 +1428,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
parser_raise_error (context_p, PARSER_ERR_OCTAL_NUMBER_NOT_ALLOWED);
}
- lexer_parse_octal_number (context_p, &source_p);
+ lexer_check_numbers (context_p, &source_p, source_end_p, LIT_CHAR_7, true);
}
else if (source_p[1] >= LIT_CHAR_8
&& source_p[1] <= LIT_CHAR_9)
@@ -1417,6 +1450,16 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
do
{
source_p++;
+ if (source_p < source_end_p && source_p[0] == LIT_CHAR_UNDERSCORE)
+ {
+ source_p++;
+ if (source_p == source_end_p
+ || source_p[0] > LIT_CHAR_9
+ || source_p[0] < LIT_CHAR_0)
+ {
+ parser_raise_error (context_p, PARSER_ERR_INVALID_UNDERSCORE_IN_NUMBER);
+ }
+ }
}
while (source_p < source_end_p
&& lit_char_is_binary_digit (source_p[0]));
@@ -1430,13 +1473,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
}
else
{
- while (source_p < source_end_p
- && source_p[0] >= LIT_CHAR_0
- && source_p[0] <= LIT_CHAR_9)
- {
- source_p++;
- }
-
+ lexer_check_numbers (context_p, &source_p, source_end_p, LIT_CHAR_9, false);
can_be_float = true;
}
@@ -1450,12 +1487,13 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
can_be_bigint = false;
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
- while (source_p < source_end_p
- && source_p[0] >= LIT_CHAR_0
- && source_p[0] <= LIT_CHAR_9)
+#if ENABLED (JERRY_ESNEXT)
+ if (source_p < source_end_p && source_p[0] == LIT_CHAR_UNDERSCORE)
{
- source_p++;
+ parser_raise_error (context_p, PARSER_ERR_INVALID_UNDERSCORE_IN_NUMBER);
}
+#endif /* ENABLED (JERRY_ESNEXT) */
+ lexer_check_numbers (context_p, &source_p, source_end_p, LIT_CHAR_9, false);
}
if (source_p < source_end_p
@@ -1479,13 +1517,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
parser_raise_error (context_p, PARSER_ERR_MISSING_EXPONENT);
}
- do
- {
- source_p++;
- }
- while (source_p < source_end_p
- && source_p[0] >= LIT_CHAR_0
- && source_p[0] <= LIT_CHAR_9);
+ lexer_check_numbers (context_p, &source_p, source_end_p, LIT_CHAR_9, false);
}
}
@@ -2627,8 +2659,13 @@ lexer_construct_number_object (parser_context_t *context_p, /**< context */
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
if (context_p->token.extra_value < LEXER_NUMBER_OCTAL)
{
+#if ENABLED (JERRY_ESNEXT)
num = ecma_utf8_string_to_number (context_p->token.lit_location.char_p,
- length);
+ length,
+ ECMA_CONVERSION_ALLOW_UNDERSCORE);
+#else
+ num = ecma_utf8_string_to_number (context_p->token.lit_location.char_p, length, 0);
+#endif /* ENABLED (JERRY_ESNEXT) */
}
else
{
@@ -2653,6 +2690,10 @@ lexer_construct_number_object (parser_context_t *context_p, /**< context */
num = 0;
do
{
+ if (src_p[1] == LIT_CHAR_UNDERSCORE)
+ {
+ src_p++;
+ }
num = num * multiplier + (ecma_number_t) (*(++src_p) - LIT_CHAR_0);
}
while (src_p < src_end_p);
@@ -2681,7 +2722,9 @@ lexer_construct_number_object (parser_context_t *context_p, /**< context */
}
else
{
- uint32_t options = ECMA_BIGINT_PARSE_DISALLOW_SYNTAX_ERROR | ECMA_BIGINT_PARSE_DISALLOW_MEMORY_ERROR;
+ uint32_t options = (ECMA_BIGINT_PARSE_DISALLOW_SYNTAX_ERROR
+ | ECMA_BIGINT_PARSE_DISALLOW_MEMORY_ERROR
+ | ECMA_BIGINT_PARSE_ALLOW_UNDERSCORE);
if (is_negative_number)
{
diff --git a/jerry-core/parser/js/js-parser-util.c b/jerry-core/parser/js/js-parser-util.c
index 35a57d9c1..1338b6587 100644
--- a/jerry-core/parser/js/js-parser-util.c
+++ b/jerry-core/parser/js/js-parser-util.c
@@ -985,6 +985,10 @@ parser_error_to_string (parser_error_t error) /**< error code */
{
return "Missing exponent part.";
}
+ case PARSER_ERR_INVALID_UNDERSCORE_IN_NUMBER:
+ {
+ return "Invalid use of underscore character in number literals";
+ }
case PARSER_ERR_IDENTIFIER_AFTER_NUMBER:
{
return "Identifier cannot start after a number.";
diff --git a/jerry-core/parser/js/js-parser.h b/jerry-core/parser/js/js-parser.h
index 034b9be38..155a985b2 100644
--- a/jerry-core/parser/js/js-parser.h
+++ b/jerry-core/parser/js/js-parser.h
@@ -56,6 +56,7 @@ typedef enum
PARSER_ERR_INVALID_NUMBER, /**< invalid number literal */
PARSER_ERR_MISSING_EXPONENT, /**< missing exponent */
PARSER_ERR_IDENTIFIER_AFTER_NUMBER, /**< identifier start after number */
+ PARSER_ERR_INVALID_UNDERSCORE_IN_NUMBER, /**< invalid use of underscore in number */
#if ENABLED (JERRY_BUILTIN_BIGINT)
PARSER_ERR_INVALID_BIGINT, /**< number is not a valid BigInt */
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
diff --git a/tests/jerry/es.next/numeric-separator.js b/tests/jerry/es.next/numeric-separator.js
new file mode 100644
index 000000000..73ad6395a
--- /dev/null
+++ b/tests/jerry/es.next/numeric-separator.js
@@ -0,0 +1,45 @@
+// Copyright JS Foundation and other contributors, http://js.foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+
+// few valid numeric separators
+assert (1_1 == 11)
+assert (0x11_11 == 4369)
+assert (0b11_11 == 15)
+assert (0o11_11 == 585)
+assert (1_1n == 11n)
+assert (100_001.11_00 == 100001.11)
+assert (0x11_11n == 4369n)
+
+// checker functions
+
+function invalid_numeric_separator (expression)
+{
+ try {
+ var a = eval (expression)
+ assert (false)
+ } catch (e) {
+ assert (true)
+ }
+}
+
+// few invalid numeric separators
+invalid_numeric_separator ("_1_1")
+invalid_numeric_separator ("1__1")
+invalid_numeric_separator ("1_1_n")
+invalid_numeric_separator ("1_1n_")
+invalid_numeric_separator ("0b_11")
+invalid_numeric_separator ("0x_11")
+invalid_numeric_separator ("0o_11")
+invalid_numeric_separator ("0_0.123")
diff --git a/tests/test262-esnext-excludelist.xml b/tests/test262-esnext-excludelist.xml
index 1e588bb0d..d7ffadd2b 100644
--- a/tests/test262-esnext-excludelist.xml
+++ b/tests/test262-esnext-excludelist.xml
@@ -3803,56 +3803,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/unit-core/test-string-to-number.c b/tests/unit-core/test-string-to-number.c
index a91155705..fd16102e6 100644
--- a/tests/unit-core/test-string-to-number.c
+++ b/tests/unit-core/test-string-to-number.c
@@ -75,7 +75,7 @@ main (void)
i < sizeof (nums) / sizeof (nums[0]);
i++)
{
- ecma_number_t num = ecma_utf8_string_to_number (strings[i], lit_zt_utf8_string_size (strings[i]));
+ ecma_number_t num = ecma_utf8_string_to_number (strings[i], lit_zt_utf8_string_size (strings[i]), 0);
if (num != nums[i]
&& (!ecma_number_is_nan (num)