Debian Codegraph @

packages/babel-plugin-proposal-optional-chaining/test/fixtures/assumption-noDocumentAll/cast-to-boolean/output.js

raw
1 class C {
2 static testIf(o) {
3 if (o != null && o.a.b.c.d) {
4 return true;
5 }
6 return false;
7 }
8 static testConditional(o) {
9 var _o$a$b;
10 return o != null && (_o$a$b = o.a.b) != null && _o$a$b.c.d ? true : false;
11 }
12 static testLoop(o) {
13 while (o != null && o.a.b.c.d) {
14 for (; o != null && (_o$a$b$c = o.a.b.c) != null && _o$a$b$c.d;) {
15 var _o$a$b$c;
16 let i = 0;
17 do {
18 var _o$a$b2;
19 i++;
20 if (i === 2) {
21 return true;
22 }
23 } while (o != null && (_o$a$b2 = o.a.b) != null && _o$a$b2.c.d);
24 }
25 }
26 return false;
27 }
28 static testNegate(o) {
29 var _o$a$b3;
30 return !!(o != null && (_o$a$b3 = o.a.b) != null && _o$a$b3.c.d);
31 }
32 static testIfDeep(o) {
33 var _o$obj, _o$obj$a$b;
34 if ((_o$obj = o.obj) != null && (_o$obj$a$b = _o$obj.a.b) != null && _o$obj$a$b.c.d) {
35 return true;
36 }
37 return false;
38 }
39 static testConditionalDeep(o) {
40 var _o$obj2, _o$obj2$a$b;
41 return (_o$obj2 = o.obj) != null && (_o$obj2$a$b = _o$obj2.a.b) != null && _o$obj2$a$b.c.d ? true : false;
42 }
43 static testLoopDeep(o) {
44 while ((_o$obj3 = o.obj) != null && _o$obj3.a.b.c.d) {
45 var _o$obj3;
46 for (; (_o$obj4 = o.obj) != null && (_o$obj4$a$b$c = _o$obj4.a.b.c) != null && _o$obj4$a$b$c.d;) {
47 var _o$obj4, _o$obj4$a$b$c;
48 let i = 0;
49 do {
50 var _o$obj5, _o$obj5$a$b;
51 i++;
52 if (i === 2) {
53 return true;
54 }
55 } while ((_o$obj5 = o.obj) != null && (_o$obj5$a$b = _o$obj5.a.b) != null && _o$obj5$a$b.c.d);
56 }
57 }
58 return false;
59 }
60 static testNegateDeep(o) {
61 var _o$obj6, _o$obj6$a$b;
62 return !!((_o$obj6 = o.obj) != null && (_o$obj6$a$b = _o$obj6.a.b) != null && _o$obj6$a$b.c.d);
63 }
64 static testLogicalInIf(o) {
65 var _o$a$b4, _o$a;
66 if (o != null && (_o$a$b4 = o.a.b) != null && _o$a$b4.c.d && o != null && (_o$a = o.a) != null && _o$a.b.c.d) {
67 return true;
68 }
69 return false;
70 }
71 static testLogicalInReturn(o) {
72 var _o$a$b5, _o$a2;
73 return (o == null ? void 0 : (_o$a$b5 = o.a.b) == null ? void 0 : _o$a$b5.c.d) && (o == null ? void 0 : (_o$a2 = o.a) == null ? void 0 : _o$a2.b.c.d);
74 }
75 static testNullishCoalescing(o) {
76 var _o$a$b$c$non_existent, _o$a$b6, _o$a$b7, _o$a$b$c$non_existent3, _o$a$b10;
77 if ((_o$a$b$c$non_existent = o == null ? void 0 : (_o$a$b6 = o.a.b) == null ? void 0 : _o$a$b6.c.non_existent) != null ? _o$a$b$c$non_existent : o == null ? void 0 : (_o$a$b7 = o.a.b) == null ? void 0 : _o$a$b7.c.d) {
78 var _o$a$b$c$non_existent2, _o$a$b8, _o$a$b9;
79 return (_o$a$b$c$non_existent2 = o == null ? void 0 : (_o$a$b8 = o.a.b) == null ? void 0 : _o$a$b8.c.non_existent) != null ? _o$a$b$c$non_existent2 : o == null ? void 0 : (_o$a$b9 = o.a.b) == null ? void 0 : _o$a$b9.c.d;
80 }
81 return (_o$a$b$c$non_existent3 = o == null ? void 0 : (_o$a$b10 = o.a.b) == null ? void 0 : _o$a$b10.c.non_existent) != null ? _o$a$b$c$non_existent3 : o;
82 }
83 }
84 C.test();
85 C.testNullish();