Support parsing async modifiers for functions. (#3460)

Only parsing is implemented, so the async functions currently behave
like normal function except they return with a resolved Promise object
when the function is terminated correctly.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2019-12-20 09:55:41 +01:00
committed by GitHub
parent 2a29b72a83
commit 8cb2be6001
22 changed files with 873 additions and 234 deletions
+16
View File
@@ -26,6 +26,7 @@
#include "ecma-iterator-object.h"
#include "ecma-lex-env.h"
#include "ecma-objects.h"
#include "ecma-promise-object.h"
#include "ecma-try-catch-macro.h"
#include "jcontext.h"
#include "opcodes.h"
@@ -706,6 +707,21 @@ opfunc_resume_executable_object (vm_executable_object_t *executable_object_p, /*
return result;
} /* opfunc_resume_executable_object */
/**
* Create a Promise object if needed and resolve it with a value
*
* @return Promise object
*/
ecma_value_t
opfunc_return_promise (ecma_value_t value) /**< value */
{
ecma_value_t promise = ecma_make_object_value (ecma_builtin_get (ECMA_BUILTIN_ID_PROMISE));
ecma_value_t result = ecma_promise_reject_or_resolve (promise, value, true);
ecma_free_value (value);
return result;
} /* opfunc_return_promise */
#endif /* ENABLED (JERRY_ES2015) */
/**