diff options
Diffstat (limited to 'js/src/jit-test/tests/modules/module-this.js')
-rw-r--r-- | js/src/jit-test/tests/modules/module-this.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/modules/module-this.js b/js/src/jit-test/tests/modules/module-this.js new file mode 100644 index 000000000..10a3241aa --- /dev/null +++ b/js/src/jit-test/tests/modules/module-this.js @@ -0,0 +1,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"); |