summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Function/function-caller-restrictions.js
blob: 36c31279ba578806320a2c69cc90d723ab77d7fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Function#caller restrictions as proposed by
// https://github.com/claudepache/es-legacy-function-reflection/

function caller() {
    return caller.caller;
}

assertEq(caller(), null);
assertEq(Reflect.apply(caller, undefined, []), null);

assertEq([0].map(caller)[0], null);

(function strict() {
    "use strict";
    assertEq(caller(), null);
})();

(async function() {
    assertEq(caller(), null);
})();

assertEq(function*() {
    yield caller();
}().next().value, null);


if (typeof reportCompare === "function") {
    reportCompare(true, true);
}