summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/modules/module-this.js
blob: 10a3241aa7566b97f248341fbdc96871873b4685 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Test 'this' is undefined in modules.

function parseAndEvaluate(source) {
    let m = parseModule(source);
    m.declarationInstantiation();
    return m.evaluation();
}

assertEq(typeof(parseAndEvaluate("this")), "undefined");

let m = parseModule("export function getThis() { return this; }");
m.declarationInstantiation();
m.evaluation();
let f = getModuleEnvironmentValue(m, "getThis");
assertEq(typeof(f()), "undefined");