Implement Promise.prototype.onFinally (#3987)
The algorith is based on ECMA-262 v11, 25.6.5.3 JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
This commit is contained in:
@@ -69,6 +69,22 @@ ecma_builtin_promise_prototype_catch (ecma_value_t this_arg, /**< this argument
|
||||
return ecma_op_invoke_by_magic_id (this_arg, LIT_MAGIC_STRING_THEN, args, 2);
|
||||
} /* ecma_builtin_promise_prototype_catch */
|
||||
|
||||
/**
|
||||
* Promise routine: finally.
|
||||
*
|
||||
* See also:
|
||||
* ECMA-262 v11, 25.6.5.3
|
||||
*
|
||||
* @return ecma value of a new promise object.
|
||||
* Returned value must be freed with ecma_free_value.
|
||||
*/
|
||||
static ecma_value_t
|
||||
ecma_builtin_promise_prototype_finally (ecma_value_t this_arg, /**< this argument */
|
||||
ecma_value_t on_finally) /**< on_finally function */
|
||||
{
|
||||
return ecma_promise_finally (this_arg, on_finally);
|
||||
} /* ecma_builtin_promise_prototype_finally */
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
|
||||
@@ -31,6 +31,7 @@ STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
|
||||
|
||||
ROUTINE (LIT_MAGIC_STRING_THEN, ecma_builtin_promise_prototype_then, 2, 2)
|
||||
ROUTINE (LIT_MAGIC_STRING_CATCH, ecma_builtin_promise_prototype_catch, 1, 1)
|
||||
ROUTINE (LIT_MAGIC_STRING_FINALLY, ecma_builtin_promise_prototype_finally, 1, 1)
|
||||
|
||||
#endif /* ENABLED (JERRY_BUILTIN_PROMISE) */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user