mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 989204 part 1 - Add some arrow function tests. r=jorendorff
--HG-- extra : rebase_source : 0b3c9ddd82621fd76e7d48559f339cdea6c40a76
This commit is contained in:
parent
63d14af0e7
commit
89770a3cea
4
js/src/jit-test/tests/arrow-functions/bug889158.js
Normal file
4
js/src/jit-test/tests/arrow-functions/bug889158.js
Normal file
@ -0,0 +1,4 @@
|
||||
var f = x => arguments.callee;
|
||||
|
||||
for (var i=0; i<5; i++)
|
||||
assertEq(f(), f);
|
12
js/src/jit-test/tests/arrow-functions/this-5.js
Normal file
12
js/src/jit-test/tests/arrow-functions/this-5.js
Normal file
@ -0,0 +1,12 @@
|
||||
// Arrow functions can have primitive |this| values.
|
||||
|
||||
Number.prototype.foo = function() {
|
||||
"use strict";
|
||||
return () => this;
|
||||
}
|
||||
|
||||
for (var i=0; i<5; i++) {
|
||||
var n = i.foo()();
|
||||
assertEq(typeof n, "number");
|
||||
assertEq(n, i);
|
||||
}
|
11
js/src/jit-test/tests/arrow-functions/this-6.js
Normal file
11
js/src/jit-test/tests/arrow-functions/this-6.js
Normal file
@ -0,0 +1,11 @@
|
||||
// Eval expressions in arrow functions use the correct |this| value.
|
||||
|
||||
function Dog(name) {
|
||||
this.name = name;
|
||||
this.getName = () => eval("this.name");
|
||||
this.getNameHard = () => eval("(() => this.name)()");
|
||||
}
|
||||
|
||||
var d = new Dog("Max");
|
||||
assertEq(d.getName(), d.name);
|
||||
assertEq(d.getNameHard(), d.name);
|
Loading…
Reference in New Issue
Block a user