|
33 | 33 | #define ECMA_BUILTINS_INTERNAL
|
34 | 34 | #include "ecma-builtins-internal.h"
|
35 | 35 |
|
| 36 | +/** |
| 37 | + * This object has a custom dispatch function. |
| 38 | + */ |
| 39 | +#define BUILTIN_CUSTOM_DISPATCH |
| 40 | + |
| 41 | +/** |
| 42 | + * List of built-in routine identifiers. |
| 43 | + */ |
| 44 | +enum |
| 45 | +{ |
| 46 | + ECMA_BUILTIN_STRING_ROUTINE_START = 0, |
| 47 | + ECMA_BUILTIN_STRING_OBJECT_FROM_CHAR_CODE, |
| 48 | + ECMA_BUILTIN_STRING_OBJECT_FROM_CODE_POINT, |
| 49 | + ECMA_BUILTIN_STRING_OBJECT_RAW, |
| 50 | +}; |
| 51 | + |
36 | 52 | #define BUILTIN_INC_HEADER_NAME "ecma-builtin-string.inc.h"
|
37 | 53 | #define BUILTIN_UNDERSCORED_ID string
|
38 | 54 | #include "ecma-builtin-internal-routines-template.inc.h"
|
|
57 | 73 | * Returned value must be freed with ecma_free_value.
|
58 | 74 | */
|
59 | 75 | static ecma_value_t
|
60 |
| -ecma_builtin_string_object_from_char_code (ecma_value_t this_arg, /**< 'this' argument */ |
61 |
| - const ecma_value_t args[], /**< arguments list */ |
| 76 | +ecma_builtin_string_object_from_char_code (const ecma_value_t args[], /**< arguments list */ |
62 | 77 | uint32_t args_number) /**< number of arguments */
|
63 | 78 | {
|
64 |
| - JERRY_UNUSED (this_arg); |
65 |
| - |
66 | 79 | if (args_number == 0)
|
67 | 80 | {
|
68 | 81 | return ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);
|
@@ -120,12 +133,9 @@ ecma_builtin_string_object_from_char_code (ecma_value_t this_arg, /**< 'this' ar
|
120 | 133 | * Returned value must be freed with ecma_free_value.
|
121 | 134 | */
|
122 | 135 | static ecma_value_t
|
123 |
| -ecma_builtin_string_object_raw (ecma_value_t this_arg, /**< 'this' argument */ |
124 |
| - const ecma_value_t args[], /**< arguments list */ |
| 136 | +ecma_builtin_string_object_raw (const ecma_value_t args[], /**< arguments list */ |
125 | 137 | uint32_t args_number) /**< number of arguments */
|
126 | 138 | {
|
127 |
| - JERRY_UNUSED (this_arg); |
128 |
| - |
129 | 139 | /* 1 - 2. */
|
130 | 140 | const ecma_value_t *substitutions;
|
131 | 141 | uint32_t number_of_substitutions;
|
@@ -274,12 +284,9 @@ ecma_builtin_string_object_raw (ecma_value_t this_arg, /**< 'this' argument */
|
274 | 284 | * Returned value must be freed with ecma_free_value.
|
275 | 285 | */
|
276 | 286 | static ecma_value_t
|
277 |
| -ecma_builtin_string_object_from_code_point (ecma_value_t this_arg, /**< 'this' argument */ |
278 |
| - const ecma_value_t args[], /**< arguments list */ |
| 287 | +ecma_builtin_string_object_from_code_point (const ecma_value_t args[], /**< arguments list */ |
279 | 288 | uint32_t args_number) /**< number of arguments */
|
280 | 289 | {
|
281 |
| - JERRY_UNUSED (this_arg); |
282 |
| - |
283 | 290 | if (args_number == 0)
|
284 | 291 | {
|
285 | 292 | return ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);
|
@@ -387,6 +394,44 @@ ecma_builtin_string_dispatch_construct (const ecma_value_t *arguments_list_p, /*
|
387 | 394 | return ecma_op_create_string_object (arguments_list_p, arguments_list_len);
|
388 | 395 | } /* ecma_builtin_string_dispatch_construct */
|
389 | 396 |
|
| 397 | +/** |
| 398 | + * Dispatcher of the built-in's routines |
| 399 | + * |
| 400 | + * @return ecma value |
| 401 | + * Returned value must be freed with ecma_free_value. |
| 402 | + */ |
| 403 | +ecma_value_t |
| 404 | +ecma_builtin_string_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */ |
| 405 | + ecma_value_t this_arg, /**< 'this' argument value */ |
| 406 | + const ecma_value_t arguments_list_p[], /**< list of arguments |
| 407 | + * passed to routine */ |
| 408 | + uint32_t arguments_number) /**< length of arguments' list */ |
| 409 | +{ |
| 410 | + JERRY_UNUSED (this_arg); |
| 411 | + |
| 412 | + switch (builtin_routine_id) |
| 413 | + { |
| 414 | + case ECMA_BUILTIN_STRING_OBJECT_FROM_CHAR_CODE: |
| 415 | + { |
| 416 | + return ecma_builtin_string_object_from_char_code (arguments_list_p, arguments_number); |
| 417 | + } |
| 418 | +#if JERRY_ESNEXT |
| 419 | + case ECMA_BUILTIN_STRING_OBJECT_FROM_CODE_POINT: |
| 420 | + { |
| 421 | + return ecma_builtin_string_object_from_code_point (arguments_list_p, arguments_number); |
| 422 | + } |
| 423 | + case ECMA_BUILTIN_STRING_OBJECT_RAW: |
| 424 | + { |
| 425 | + return ecma_builtin_string_object_raw (arguments_list_p, arguments_number); |
| 426 | + } |
| 427 | +#endif /* JERRY_ESNEXT */ |
| 428 | + default: |
| 429 | + { |
| 430 | + JERRY_UNREACHABLE (); |
| 431 | + } |
| 432 | + } |
| 433 | +} /* ecma_builtin_string_dispatch_routine */ |
| 434 | + |
390 | 435 | /**
|
391 | 436 | * @}
|
392 | 437 | * @}
|
|
0 commit comments