test262/implementation-contributed/javascriptcore/stress/function-caller-async-arrow...

28 lines
544 B
JavaScript

// Reviewed
//@ runDefault
(function thingy() {
function bar()
{
return bar.caller;
}
var ok = false;
var badError = null;
var foo = async () => {
try {
bar();
ok = true;
} catch (e) {
if (e.toString() != "TypeError: Function.caller used to retrieve async function body")
badError = e;
}
}
foo();
if (ok)
throw "Error: did not throw error";
if (badError)
throw "Bad error: " + badError;
})();