summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/expressions/short-circuit-compound-assignment-anon-fns.js
blob: 406f143eadbf42372377b9d0d7c2f21d1436ac77 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
// NamedEvaluation applies to short-circuit assignment.

{
  let a;
  a ??= function(){};
  assertEq(a.name, "a");
}

{
  let a = false;
  a ||= function(){};
  assertEq(a.name, "a");
}

{
  let a = true;
  a &&= function(){};
  assertEq(a.name, "a");
}

// No name assignments for parenthesised left-hand sides.

{
  let a;
  (a) ??= function(){};
  assertEq(a.name, "");
}

{
  let a = false;
  (a) ||= function(){};
  assertEq(a.name, "");
}

{
  let a = true;
  (a) &&= function(){};
  assertEq(a.name, "");
}

if (typeof reportCompare === "function")
  reportCompare(0, 0);