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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
|
=== tests/cases/conformance/es2021/logicalAssignment/logicalAssignment4.ts ===
function foo1(results: number[] | undefined) {
>foo1 : Symbol(foo1, Decl(logicalAssignment4.ts, 0, 0))
>results : Symbol(results, Decl(logicalAssignment4.ts, 0, 14))
(results ||= []).push(100);
>(results ||= []).push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
>results : Symbol(results, Decl(logicalAssignment4.ts, 0, 14))
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
}
function foo2(results: number[] | undefined) {
>foo2 : Symbol(foo2, Decl(logicalAssignment4.ts, 2, 1))
>results : Symbol(results, Decl(logicalAssignment4.ts, 4, 14))
(results ??= []).push(100);
>(results ??= []).push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
>results : Symbol(results, Decl(logicalAssignment4.ts, 4, 14))
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
}
function foo3(results: number[] | undefined) {
>foo3 : Symbol(foo3, Decl(logicalAssignment4.ts, 6, 1))
>results : Symbol(results, Decl(logicalAssignment4.ts, 8, 14))
results ||= [];
>results : Symbol(results, Decl(logicalAssignment4.ts, 8, 14))
results.push(100);
>results.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
>results : Symbol(results, Decl(logicalAssignment4.ts, 8, 14))
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
}
function foo4(results: number[] | undefined) {
>foo4 : Symbol(foo4, Decl(logicalAssignment4.ts, 11, 1))
>results : Symbol(results, Decl(logicalAssignment4.ts, 13, 14))
results ??= [];
>results : Symbol(results, Decl(logicalAssignment4.ts, 13, 14))
results.push(100);
>results.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
>results : Symbol(results, Decl(logicalAssignment4.ts, 13, 14))
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
}
interface ThingWithOriginal {
>ThingWithOriginal : Symbol(ThingWithOriginal, Decl(logicalAssignment4.ts, 16, 1))
name: string;
>name : Symbol(ThingWithOriginal.name, Decl(logicalAssignment4.ts, 18, 29))
original?: ThingWithOriginal
>original : Symbol(ThingWithOriginal.original, Decl(logicalAssignment4.ts, 19, 17))
>ThingWithOriginal : Symbol(ThingWithOriginal, Decl(logicalAssignment4.ts, 16, 1))
}
declare const v: number
>v : Symbol(v, Decl(logicalAssignment4.ts, 22, 13))
function doSomethingWithAlias(thing: ThingWithOriginal | undefined, defaultValue: ThingWithOriginal | undefined) {
>doSomethingWithAlias : Symbol(doSomethingWithAlias, Decl(logicalAssignment4.ts, 22, 23))
>thing : Symbol(thing, Decl(logicalAssignment4.ts, 23, 30))
>ThingWithOriginal : Symbol(ThingWithOriginal, Decl(logicalAssignment4.ts, 16, 1))
>defaultValue : Symbol(defaultValue, Decl(logicalAssignment4.ts, 23, 67))
>ThingWithOriginal : Symbol(ThingWithOriginal, Decl(logicalAssignment4.ts, 16, 1))
if (v === 1) {
>v : Symbol(v, Decl(logicalAssignment4.ts, 22, 13))
if (thing &&= thing.original) {
>thing : Symbol(thing, Decl(logicalAssignment4.ts, 23, 30))
>thing.original : Symbol(ThingWithOriginal.original, Decl(logicalAssignment4.ts, 19, 17))
>thing : Symbol(thing, Decl(logicalAssignment4.ts, 23, 30))
>original : Symbol(ThingWithOriginal.original, Decl(logicalAssignment4.ts, 19, 17))
thing.name;
>thing.name : Symbol(ThingWithOriginal.name, Decl(logicalAssignment4.ts, 18, 29))
>thing : Symbol(thing, Decl(logicalAssignment4.ts, 23, 30))
>name : Symbol(ThingWithOriginal.name, Decl(logicalAssignment4.ts, 18, 29))
}
}
else if (v === 2) {
>v : Symbol(v, Decl(logicalAssignment4.ts, 22, 13))
if (thing &&= defaultValue) {
>thing : Symbol(thing, Decl(logicalAssignment4.ts, 23, 30))
>defaultValue : Symbol(defaultValue, Decl(logicalAssignment4.ts, 23, 67))
thing.name;
>thing.name : Symbol(ThingWithOriginal.name, Decl(logicalAssignment4.ts, 18, 29))
>thing : Symbol(thing, Decl(logicalAssignment4.ts, 23, 30))
>name : Symbol(ThingWithOriginal.name, Decl(logicalAssignment4.ts, 18, 29))
defaultValue.name
>defaultValue.name : Symbol(ThingWithOriginal.name, Decl(logicalAssignment4.ts, 18, 29))
>defaultValue : Symbol(defaultValue, Decl(logicalAssignment4.ts, 23, 67))
>name : Symbol(ThingWithOriginal.name, Decl(logicalAssignment4.ts, 18, 29))
}
}
else if (v === 3) {
>v : Symbol(v, Decl(logicalAssignment4.ts, 22, 13))
if (thing ||= defaultValue) {
>thing : Symbol(thing, Decl(logicalAssignment4.ts, 23, 30))
>defaultValue : Symbol(defaultValue, Decl(logicalAssignment4.ts, 23, 67))
thing.name;
>thing.name : Symbol(ThingWithOriginal.name, Decl(logicalAssignment4.ts, 18, 29))
>thing : Symbol(thing, Decl(logicalAssignment4.ts, 23, 30))
>name : Symbol(ThingWithOriginal.name, Decl(logicalAssignment4.ts, 18, 29))
defaultValue.name;
>defaultValue.name : Symbol(ThingWithOriginal.name, Decl(logicalAssignment4.ts, 18, 29))
>defaultValue : Symbol(defaultValue, Decl(logicalAssignment4.ts, 23, 67))
>name : Symbol(ThingWithOriginal.name, Decl(logicalAssignment4.ts, 18, 29))
}
}
else {
if (thing ??= defaultValue) {
>thing : Symbol(thing, Decl(logicalAssignment4.ts, 23, 30))
>defaultValue : Symbol(defaultValue, Decl(logicalAssignment4.ts, 23, 67))
thing.name;
>thing.name : Symbol(ThingWithOriginal.name, Decl(logicalAssignment4.ts, 18, 29))
>thing : Symbol(thing, Decl(logicalAssignment4.ts, 23, 30))
>name : Symbol(ThingWithOriginal.name, Decl(logicalAssignment4.ts, 18, 29))
defaultValue.name;
>defaultValue.name : Symbol(ThingWithOriginal.name, Decl(logicalAssignment4.ts, 18, 29))
>defaultValue : Symbol(defaultValue, Decl(logicalAssignment4.ts, 23, 67))
>name : Symbol(ThingWithOriginal.name, Decl(logicalAssignment4.ts, 18, 29))
}
}
}
|