summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/arguments/alias-function-not-closed.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/jit-test/tests/arguments/alias-function-not-closed.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/jit-test/tests/arguments/alias-function-not-closed.js')
-rw-r--r--js/src/jit-test/tests/arguments/alias-function-not-closed.js89
1 files changed, 89 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/arguments/alias-function-not-closed.js b/js/src/jit-test/tests/arguments/alias-function-not-closed.js
new file mode 100644
index 000000000..acb83cd29
--- /dev/null
+++ b/js/src/jit-test/tests/arguments/alias-function-not-closed.js
@@ -0,0 +1,89 @@
+function f1(a, aIs, // without default parameter
+ b=()=>62, bIs, // with default parameter
+ // before function body
+ c=(assertEq(a(), aIs), assertEq(b(), bIs),
+ ()=>63),
+ cIs) {
+ // before function declarations
+ assertEq(a(), 52);
+ assertEq(b(), 53);
+ assertEq(c(), 55);
+
+ function a() {
+ return 52;
+ }
+ function b() {
+ return 53;
+ }
+ function c() {
+ return 54;
+ }
+
+ assertEq(a(), 52); // after function declaration
+ assertEq(b(), 53); // after function declaration
+ assertEq(c(), 55); // before last function declaration
+
+ c = ()=>72;
+ assertEq(c(), 72); // after assignment in body
+
+ // function re-declaration after assignment
+ function c() {
+ return 55;
+ }
+}
+f1(()=>42, 42, undefined, 62, undefined, 63);
+f1(()=>42, 42, undefined, 62, ()=>44, 44);
+f1(()=>42, 42, ()=>43, 43, undefined, 63);
+f1(()=>42, 42, ()=>43, 43, ()=>44, 44);
+
+function f2(a,
+ // assignment before body
+ b=a=()=>62,
+ c=(assertEq(a(), 62)),
+ // eval in defaults exprs get own var envs
+ d=eval("function a() { return 72; }"),
+ e=(assertEq(a(), 62))) {
+ function a() {
+ return 52;
+ }
+
+ assertEq(a(), 52);
+}
+f2(()=>42);
+
+function f3(a, b, c, d) {
+ // before var/function declarations
+ assertEq(a(), 52);
+ assertEq(b(), 53);
+ assertEq(c(), 54);
+ assertEq(d(), 55);
+
+ var a, b = ()=>63;
+ var c, d = ()=>65;
+
+ // after var declarations, before function declarations
+ assertEq(a(), 52);
+ assertEq(b(), 63);
+ assertEq(c(), 54);
+ assertEq(d(), 65);
+
+ function a() {
+ return 52;
+ }
+ function b() {
+ return 53;
+ }
+ function c() {
+ return 54;
+ }
+ function d() {
+ return 55;
+ }
+
+ // after var/function declarations
+ assertEq(a(), 52);
+ assertEq(b(), 63);
+ assertEq(c(), 54);
+ assertEq(d(), 65);
+}
+f3(()=>42, ()=>43, ()=>44, ()=>45);