|
| 1 | +=== tests/cases/compiler/uncalledFunctionChecksInConditional2.ts === |
| 2 | +{ |
| 3 | + const perf = window.performance |
| 4 | +>perf : Symbol(perf, Decl(uncalledFunctionChecksInConditional2.ts, 1, 7)) |
| 5 | +>window.performance : Symbol(performance, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) |
| 6 | +>window : Symbol(window, Decl(lib.dom.d.ts, --, --)) |
| 7 | +>performance : Symbol(performance, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) |
| 8 | + |
| 9 | + // Simplified |
| 10 | + if ( |
| 11 | + perf && |
| 12 | +>perf : Symbol(perf, Decl(uncalledFunctionChecksInConditional2.ts, 1, 7)) |
| 13 | + |
| 14 | + perf.measure && |
| 15 | +>perf.measure : Symbol(Performance.measure, Decl(lib.dom.d.ts, --, --)) |
| 16 | +>perf : Symbol(perf, Decl(uncalledFunctionChecksInConditional2.ts, 1, 7)) |
| 17 | +>measure : Symbol(Performance.measure, Decl(lib.dom.d.ts, --, --)) |
| 18 | + |
| 19 | + perf.clearMarks && |
| 20 | +>perf.clearMarks : Symbol(Performance.clearMarks, Decl(lib.dom.d.ts, --, --)) |
| 21 | +>perf : Symbol(perf, Decl(uncalledFunctionChecksInConditional2.ts, 1, 7)) |
| 22 | +>clearMarks : Symbol(Performance.clearMarks, Decl(lib.dom.d.ts, --, --)) |
| 23 | + |
| 24 | + perf.clearMeasures |
| 25 | +>perf.clearMeasures : Symbol(Performance.clearMeasures, Decl(lib.dom.d.ts, --, --)) |
| 26 | +>perf : Symbol(perf, Decl(uncalledFunctionChecksInConditional2.ts, 1, 7)) |
| 27 | +>clearMeasures : Symbol(Performance.clearMeasures, Decl(lib.dom.d.ts, --, --)) |
| 28 | + |
| 29 | + ) { |
| 30 | + perf.measure(""); |
| 31 | +>perf.measure : Symbol(Performance.measure, Decl(lib.dom.d.ts, --, --)) |
| 32 | +>perf : Symbol(perf, Decl(uncalledFunctionChecksInConditional2.ts, 1, 7)) |
| 33 | +>measure : Symbol(Performance.measure, Decl(lib.dom.d.ts, --, --)) |
| 34 | + |
| 35 | + perf.clearMarks("") |
| 36 | +>perf.clearMarks : Symbol(Performance.clearMarks, Decl(lib.dom.d.ts, --, --)) |
| 37 | +>perf : Symbol(perf, Decl(uncalledFunctionChecksInConditional2.ts, 1, 7)) |
| 38 | +>clearMarks : Symbol(Performance.clearMarks, Decl(lib.dom.d.ts, --, --)) |
| 39 | + |
| 40 | + perf.clearMeasures("") |
| 41 | +>perf.clearMeasures : Symbol(Performance.clearMeasures, Decl(lib.dom.d.ts, --, --)) |
| 42 | +>perf : Symbol(perf, Decl(uncalledFunctionChecksInConditional2.ts, 1, 7)) |
| 43 | +>clearMeasures : Symbol(Performance.clearMeasures, Decl(lib.dom.d.ts, --, --)) |
| 44 | + } |
| 45 | + |
| 46 | + // With || |
| 47 | + if ( |
| 48 | + perf && |
| 49 | +>perf : Symbol(perf, Decl(uncalledFunctionChecksInConditional2.ts, 1, 7)) |
| 50 | + |
| 51 | + perf.mark && |
| 52 | +>perf.mark : Symbol(Performance.mark, Decl(lib.dom.d.ts, --, --)) |
| 53 | +>perf : Symbol(perf, Decl(uncalledFunctionChecksInConditional2.ts, 1, 7)) |
| 54 | +>mark : Symbol(Performance.mark, Decl(lib.dom.d.ts, --, --)) |
| 55 | + |
| 56 | + perf.measure || !!true |
| 57 | +>perf.measure : Symbol(Performance.measure, Decl(lib.dom.d.ts, --, --)) |
| 58 | +>perf : Symbol(perf, Decl(uncalledFunctionChecksInConditional2.ts, 1, 7)) |
| 59 | +>measure : Symbol(Performance.measure, Decl(lib.dom.d.ts, --, --)) |
| 60 | + |
| 61 | + ) { |
| 62 | + perf.mark(""); |
| 63 | +>perf.mark : Symbol(Performance.mark, Decl(lib.dom.d.ts, --, --)) |
| 64 | +>perf : Symbol(perf, Decl(uncalledFunctionChecksInConditional2.ts, 1, 7)) |
| 65 | +>mark : Symbol(Performance.mark, Decl(lib.dom.d.ts, --, --)) |
| 66 | + } |
| 67 | +}; |
| 68 | + |
| 69 | +// Original #49192 |
| 70 | +declare let inBrowser: boolean; |
| 71 | +>inBrowser : Symbol(inBrowser, Decl(uncalledFunctionChecksInConditional2.ts, 26, 11)) |
| 72 | +{ |
| 73 | + let mark; |
| 74 | +>mark : Symbol(mark, Decl(uncalledFunctionChecksInConditional2.ts, 28, 5)) |
| 75 | + |
| 76 | + let measure; |
| 77 | +>measure : Symbol(measure, Decl(uncalledFunctionChecksInConditional2.ts, 29, 5)) |
| 78 | + |
| 79 | + const perf = inBrowser && window.performance |
| 80 | +>perf : Symbol(perf, Decl(uncalledFunctionChecksInConditional2.ts, 30, 7)) |
| 81 | +>inBrowser : Symbol(inBrowser, Decl(uncalledFunctionChecksInConditional2.ts, 26, 11)) |
| 82 | +>window.performance : Symbol(performance, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) |
| 83 | +>window : Symbol(window, Decl(lib.dom.d.ts, --, --)) |
| 84 | +>performance : Symbol(performance, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) |
| 85 | + |
| 86 | + /* istanbul ignore if */ |
| 87 | + if ( |
| 88 | + perf && |
| 89 | +>perf : Symbol(perf, Decl(uncalledFunctionChecksInConditional2.ts, 30, 7)) |
| 90 | + |
| 91 | + perf.mark && |
| 92 | +>perf.mark : Symbol(Performance.mark, Decl(lib.dom.d.ts, --, --)) |
| 93 | +>perf : Symbol(perf, Decl(uncalledFunctionChecksInConditional2.ts, 30, 7)) |
| 94 | +>mark : Symbol(Performance.mark, Decl(lib.dom.d.ts, --, --)) |
| 95 | + |
| 96 | + perf.measure && |
| 97 | +>perf.measure : Symbol(Performance.measure, Decl(lib.dom.d.ts, --, --)) |
| 98 | +>perf : Symbol(perf, Decl(uncalledFunctionChecksInConditional2.ts, 30, 7)) |
| 99 | +>measure : Symbol(Performance.measure, Decl(lib.dom.d.ts, --, --)) |
| 100 | + |
| 101 | + perf.clearMarks && |
| 102 | +>perf.clearMarks : Symbol(Performance.clearMarks, Decl(lib.dom.d.ts, --, --)) |
| 103 | +>perf : Symbol(perf, Decl(uncalledFunctionChecksInConditional2.ts, 30, 7)) |
| 104 | +>clearMarks : Symbol(Performance.clearMarks, Decl(lib.dom.d.ts, --, --)) |
| 105 | + |
| 106 | + perf.clearMeasures |
| 107 | +>perf.clearMeasures : Symbol(Performance.clearMeasures, Decl(lib.dom.d.ts, --, --)) |
| 108 | +>perf : Symbol(perf, Decl(uncalledFunctionChecksInConditional2.ts, 30, 7)) |
| 109 | +>clearMeasures : Symbol(Performance.clearMeasures, Decl(lib.dom.d.ts, --, --)) |
| 110 | + |
| 111 | + ) { |
| 112 | + mark = (tag) => perf.mark(tag) |
| 113 | +>mark : Symbol(mark, Decl(uncalledFunctionChecksInConditional2.ts, 28, 5)) |
| 114 | +>tag : Symbol(tag, Decl(uncalledFunctionChecksInConditional2.ts, 39, 12)) |
| 115 | +>perf.mark : Symbol(Performance.mark, Decl(lib.dom.d.ts, --, --)) |
| 116 | +>perf : Symbol(perf, Decl(uncalledFunctionChecksInConditional2.ts, 30, 7)) |
| 117 | +>mark : Symbol(Performance.mark, Decl(lib.dom.d.ts, --, --)) |
| 118 | +>tag : Symbol(tag, Decl(uncalledFunctionChecksInConditional2.ts, 39, 12)) |
| 119 | + |
| 120 | + measure = (name, startTag, endTag) => { |
| 121 | +>measure : Symbol(measure, Decl(uncalledFunctionChecksInConditional2.ts, 29, 5)) |
| 122 | +>name : Symbol(name, Decl(uncalledFunctionChecksInConditional2.ts, 40, 15)) |
| 123 | +>startTag : Symbol(startTag, Decl(uncalledFunctionChecksInConditional2.ts, 40, 20)) |
| 124 | +>endTag : Symbol(endTag, Decl(uncalledFunctionChecksInConditional2.ts, 40, 30)) |
| 125 | + |
| 126 | + perf.measure(name, startTag, endTag) |
| 127 | +>perf.measure : Symbol(Performance.measure, Decl(lib.dom.d.ts, --, --)) |
| 128 | +>perf : Symbol(perf, Decl(uncalledFunctionChecksInConditional2.ts, 30, 7)) |
| 129 | +>measure : Symbol(Performance.measure, Decl(lib.dom.d.ts, --, --)) |
| 130 | +>name : Symbol(name, Decl(uncalledFunctionChecksInConditional2.ts, 40, 15)) |
| 131 | +>startTag : Symbol(startTag, Decl(uncalledFunctionChecksInConditional2.ts, 40, 20)) |
| 132 | +>endTag : Symbol(endTag, Decl(uncalledFunctionChecksInConditional2.ts, 40, 30)) |
| 133 | + |
| 134 | + perf.clearMarks(startTag) |
| 135 | +>perf.clearMarks : Symbol(Performance.clearMarks, Decl(lib.dom.d.ts, --, --)) |
| 136 | +>perf : Symbol(perf, Decl(uncalledFunctionChecksInConditional2.ts, 30, 7)) |
| 137 | +>clearMarks : Symbol(Performance.clearMarks, Decl(lib.dom.d.ts, --, --)) |
| 138 | +>startTag : Symbol(startTag, Decl(uncalledFunctionChecksInConditional2.ts, 40, 20)) |
| 139 | + |
| 140 | + perf.clearMarks(endTag) |
| 141 | +>perf.clearMarks : Symbol(Performance.clearMarks, Decl(lib.dom.d.ts, --, --)) |
| 142 | +>perf : Symbol(perf, Decl(uncalledFunctionChecksInConditional2.ts, 30, 7)) |
| 143 | +>clearMarks : Symbol(Performance.clearMarks, Decl(lib.dom.d.ts, --, --)) |
| 144 | +>endTag : Symbol(endTag, Decl(uncalledFunctionChecksInConditional2.ts, 40, 30)) |
| 145 | + |
| 146 | + // perf.clearMeasures(name) |
| 147 | + } |
| 148 | + } |
| 149 | +}; |
| 150 | + |
0 commit comments