diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.js new file mode 100644 index 00000000000..cdf4451195e --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.js @@ -0,0 +1,49 @@ +//// [sourceMapValidationDestructuringVariableStatement1.ts] +interface Robot { + name: string; + skill: string; +} +declare var console: { + log(msg: string): void; +} +var hello = "hello"; +var robotA: Robot = { name: "mower", skill: "mowing" }; +var robotB: Robot = { name: "trimmer", skill: "trimming" }; +var a: string, { name: nameA } = robotA; +var b: string, { name: nameB, skill: skillB } = robotB; +var c: string, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }; + +var { name: nameA } = robotA, a = hello; +var { name: nameB, skill: skillB } = robotB, b = " hello"; +var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c = hello; + +var a = hello, { name: nameA } = robotA, a1= "hello"; +var b = hello, { name: nameB, skill: skillB } = robotB, b1 = "hello"; +var c = hello, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c1 = hello; +if (nameA == nameB) { + console.log(skillB); +} +else { + console.log(nameC); +} + +//// [sourceMapValidationDestructuringVariableStatement1.js] +var hello = "hello"; +var robotA = { name: "mower", skill: "mowing" }; +var robotB = { name: "trimmer", skill: "trimming" }; +var a, nameA = robotA.name; +var b, nameB = robotB.name, skillB = robotB.skill; +var c, _a = { name: "Edger", skill: "cutting edges" }, nameC = _a.name, skillC = _a.skill; +var nameA = robotA.name, a = hello; +var nameB = robotB.name, skillB = robotB.skill, b = " hello"; +var _b = { name: "Edger", skill: "cutting edges" }, nameC = _b.name, skillC = _b.skill, c = hello; +var a = hello, nameA = robotA.name, a1 = "hello"; +var b = hello, nameB = robotB.name, skillB = robotB.skill, b1 = "hello"; +var c = hello, _c = { name: "Edger", skill: "cutting edges" }, nameC = _c.name, skillC = _c.skill, c1 = hello; +if (nameA == nameB) { + console.log(skillB); +} +else { + console.log(nameC); +} +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatement1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.js.map new file mode 100644 index 00000000000..cc2ae54143d --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatement1.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatement1.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatement1.ts"],"names":[],"mappings":"AAOA,IAAI,KAAK,GAAG,OAAO,CAAC;AACpB,IAAI,MAAM,GAAU,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AACvD,IAAI,MAAM,GAAU,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AAC3D,IAAI,CAAS,EAAI,mBAAW,CAAY;AACxC,IAAI,CAAS,EAAI,mBAAW,EAAE,qBAAa,CAAY;AACvD,IAAI,CAAS,EAAE,8CAA0E,EAAxE,eAAW,EAAE,iBAAa,CAA+C;AAEpF,uBAAW,EAAa,CAAC,GAAG,KAAK,CAAC;AAClC,uBAAW,EAAE,qBAAa,EAAa,CAAC,GAAG,QAAQ,CAAC;AAC1D,IAAA,8CAA8E,EAAxE,eAAW,EAAE,iBAAa,EAAgD,CAAC,GAAG,KAAK,CAAC;AAE1F,IAAI,CAAC,GAAG,KAAK,EAAI,mBAAW,EAAa,EAAE,GAAE,OAAO,CAAC;AACrD,IAAI,CAAC,GAAG,KAAK,EAAI,mBAAW,EAAE,qBAAa,EAAa,EAAE,GAAG,OAAO,CAAC;AACrE,IAAI,CAAC,GAAG,KAAK,EAAE,8CAA0E,EAAxE,eAAW,EAAE,iBAAa,EAAgD,EAAE,GAAG,KAAK,CAAC;AACtG,EAAE,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC;IACjB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AACD,IAAI,CAAC,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.sourcemap.txt new file mode 100644 index 00000000000..70407ad9f81 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.sourcemap.txt @@ -0,0 +1,571 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatement1.js +mapUrl: sourceMapValidationDestructuringVariableStatement1.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatement1.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatement1.js +sourceFile:sourceMapValidationDestructuringVariableStatement1.ts +------------------------------------------------------------------- +>>>var hello = "hello"; +1 > +2 >^^^^ +3 > ^^^^^ +4 > ^^^ +5 > ^^^^^^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 >interface Robot { + > name: string; + > skill: string; + >} + >declare var console: { + > log(msg: string): void; + >} + > +2 >var +3 > hello +4 > = +5 > "hello" +6 > ; +1 >Emitted(1, 1) Source(8, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(8, 5) + SourceIndex(0) +3 >Emitted(1, 10) Source(8, 10) + SourceIndex(0) +4 >Emitted(1, 13) Source(8, 13) + SourceIndex(0) +5 >Emitted(1, 20) Source(8, 20) + SourceIndex(0) +6 >Emitted(1, 21) Source(8, 21) + SourceIndex(0) +--- +>>>var robotA = { name: "mower", skill: "mowing" }; +1-> +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^^^^ +7 > ^^ +8 > ^^^^^^^ +9 > ^^ +10> ^^^^^ +11> ^^ +12> ^^^^^^^^ +13> ^^ +14> ^ +15> ^^^^^-> +1-> + > +2 >var +3 > robotA +4 > : Robot = +5 > { +6 > name +7 > : +8 > "mower" +9 > , +10> skill +11> : +12> "mowing" +13> } +14> ; +1->Emitted(2, 1) Source(9, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(9, 5) + SourceIndex(0) +3 >Emitted(2, 11) Source(9, 11) + SourceIndex(0) +4 >Emitted(2, 14) Source(9, 21) + SourceIndex(0) +5 >Emitted(2, 16) Source(9, 23) + SourceIndex(0) +6 >Emitted(2, 20) Source(9, 27) + SourceIndex(0) +7 >Emitted(2, 22) Source(9, 29) + SourceIndex(0) +8 >Emitted(2, 29) Source(9, 36) + SourceIndex(0) +9 >Emitted(2, 31) Source(9, 38) + SourceIndex(0) +10>Emitted(2, 36) Source(9, 43) + SourceIndex(0) +11>Emitted(2, 38) Source(9, 45) + SourceIndex(0) +12>Emitted(2, 46) Source(9, 53) + SourceIndex(0) +13>Emitted(2, 48) Source(9, 55) + SourceIndex(0) +14>Emitted(2, 49) Source(9, 56) + SourceIndex(0) +--- +>>>var robotB = { name: "trimmer", skill: "trimming" }; +1-> +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^^^^ +7 > ^^ +8 > ^^^^^^^^^ +9 > ^^ +10> ^^^^^ +11> ^^ +12> ^^^^^^^^^^ +13> ^^ +14> ^ +1-> + > +2 >var +3 > robotB +4 > : Robot = +5 > { +6 > name +7 > : +8 > "trimmer" +9 > , +10> skill +11> : +12> "trimming" +13> } +14> ; +1->Emitted(3, 1) Source(10, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(10, 5) + SourceIndex(0) +3 >Emitted(3, 11) Source(10, 11) + SourceIndex(0) +4 >Emitted(3, 14) Source(10, 21) + SourceIndex(0) +5 >Emitted(3, 16) Source(10, 23) + SourceIndex(0) +6 >Emitted(3, 20) Source(10, 27) + SourceIndex(0) +7 >Emitted(3, 22) Source(10, 29) + SourceIndex(0) +8 >Emitted(3, 31) Source(10, 38) + SourceIndex(0) +9 >Emitted(3, 33) Source(10, 40) + SourceIndex(0) +10>Emitted(3, 38) Source(10, 45) + SourceIndex(0) +11>Emitted(3, 40) Source(10, 47) + SourceIndex(0) +12>Emitted(3, 50) Source(10, 57) + SourceIndex(0) +13>Emitted(3, 52) Source(10, 59) + SourceIndex(0) +14>Emitted(3, 53) Source(10, 60) + SourceIndex(0) +--- +>>>var a, nameA = robotA.name; +1 > +2 >^^^^ +3 > ^ +4 > ^^ +5 > ^^^^^^^^^^^^^^^^^^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a: string +4 > , { +5 > name: nameA +6 > } = robotA; +1 >Emitted(4, 1) Source(11, 1) + SourceIndex(0) +2 >Emitted(4, 5) Source(11, 5) + SourceIndex(0) +3 >Emitted(4, 6) Source(11, 14) + SourceIndex(0) +4 >Emitted(4, 8) Source(11, 18) + SourceIndex(0) +5 >Emitted(4, 27) Source(11, 29) + SourceIndex(0) +6 >Emitted(4, 28) Source(11, 41) + SourceIndex(0) +--- +>>>var b, nameB = robotB.name, skillB = robotB.skill; +1-> +2 >^^^^ +3 > ^ +4 > ^^ +5 > ^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^ +8 > ^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >var +3 > b: string +4 > , { +5 > name: nameB +6 > , +7 > skill: skillB +8 > } = robotB; +1->Emitted(5, 1) Source(12, 1) + SourceIndex(0) +2 >Emitted(5, 5) Source(12, 5) + SourceIndex(0) +3 >Emitted(5, 6) Source(12, 14) + SourceIndex(0) +4 >Emitted(5, 8) Source(12, 18) + SourceIndex(0) +5 >Emitted(5, 27) Source(12, 29) + SourceIndex(0) +6 >Emitted(5, 29) Source(12, 31) + SourceIndex(0) +7 >Emitted(5, 50) Source(12, 44) + SourceIndex(0) +8 >Emitted(5, 51) Source(12, 56) + SourceIndex(0) +--- +>>>var c, _a = { name: "Edger", skill: "cutting edges" }, nameC = _a.name, skillC = _a.skill; +1-> +2 >^^^^ +3 > ^ +4 > ^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^ +10> ^ +1-> + > +2 >var +3 > c: string +4 > , +5 > { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" } +6 > +7 > name: nameC +8 > , +9 > skill: skillC +10> } = { name: "Edger", skill: "cutting edges" }; +1->Emitted(6, 1) Source(13, 1) + SourceIndex(0) +2 >Emitted(6, 5) Source(13, 5) + SourceIndex(0) +3 >Emitted(6, 6) Source(13, 14) + SourceIndex(0) +4 >Emitted(6, 8) Source(13, 16) + SourceIndex(0) +5 >Emitted(6, 54) Source(13, 90) + SourceIndex(0) +6 >Emitted(6, 56) Source(13, 18) + SourceIndex(0) +7 >Emitted(6, 71) Source(13, 29) + SourceIndex(0) +8 >Emitted(6, 73) Source(13, 31) + SourceIndex(0) +9 >Emitted(6, 90) Source(13, 44) + SourceIndex(0) +10>Emitted(6, 91) Source(13, 91) + SourceIndex(0) +--- +>>>var nameA = robotA.name, a = hello; +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^ +5 > ^^^ +6 > ^^^^^ +7 > ^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + >var { +2 >name: nameA +3 > } = robotA, +4 > a +5 > = +6 > hello +7 > ; +1 >Emitted(7, 1) Source(15, 7) + SourceIndex(0) +2 >Emitted(7, 24) Source(15, 18) + SourceIndex(0) +3 >Emitted(7, 26) Source(15, 31) + SourceIndex(0) +4 >Emitted(7, 27) Source(15, 32) + SourceIndex(0) +5 >Emitted(7, 30) Source(15, 35) + SourceIndex(0) +6 >Emitted(7, 35) Source(15, 40) + SourceIndex(0) +7 >Emitted(7, 36) Source(15, 41) + SourceIndex(0) +--- +>>>var nameB = robotB.name, skillB = robotB.skill, b = " hello"; +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^ +5 > ^^ +6 > ^ +7 > ^^^ +8 > ^^^^^^^^ +9 > ^ +10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + >var { +2 >name: nameB +3 > , +4 > skill: skillB +5 > } = robotB, +6 > b +7 > = +8 > " hello" +9 > ; +1->Emitted(8, 1) Source(16, 7) + SourceIndex(0) +2 >Emitted(8, 24) Source(16, 18) + SourceIndex(0) +3 >Emitted(8, 26) Source(16, 20) + SourceIndex(0) +4 >Emitted(8, 47) Source(16, 33) + SourceIndex(0) +5 >Emitted(8, 49) Source(16, 46) + SourceIndex(0) +6 >Emitted(8, 50) Source(16, 47) + SourceIndex(0) +7 >Emitted(8, 53) Source(16, 50) + SourceIndex(0) +8 >Emitted(8, 61) Source(16, 58) + SourceIndex(0) +9 >Emitted(8, 62) Source(16, 59) + SourceIndex(0) +--- +>>>var _b = { name: "Edger", skill: "cutting edges" }, nameC = _b.name, skillC = _b.skill, c = hello; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^ +10> ^^^ +11> ^^^^^ +12> ^ +1-> + > +2 > +3 > var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" } +4 > +5 > name: nameC +6 > , +7 > skill: skillC +8 > } = { name: "Edger", skill: "cutting edges" }, +9 > c +10> = +11> hello +12> ; +1->Emitted(9, 1) Source(17, 1) + SourceIndex(0) +2 >Emitted(9, 5) Source(17, 1) + SourceIndex(0) +3 >Emitted(9, 51) Source(17, 79) + SourceIndex(0) +4 >Emitted(9, 53) Source(17, 7) + SourceIndex(0) +5 >Emitted(9, 68) Source(17, 18) + SourceIndex(0) +6 >Emitted(9, 70) Source(17, 20) + SourceIndex(0) +7 >Emitted(9, 87) Source(17, 33) + SourceIndex(0) +8 >Emitted(9, 89) Source(17, 81) + SourceIndex(0) +9 >Emitted(9, 90) Source(17, 82) + SourceIndex(0) +10>Emitted(9, 93) Source(17, 85) + SourceIndex(0) +11>Emitted(9, 98) Source(17, 90) + SourceIndex(0) +12>Emitted(9, 99) Source(17, 91) + SourceIndex(0) +--- +>>>var a = hello, nameA = robotA.name, a1 = "hello"; +1 > +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^ +10> ^^^ +11> ^^^^^^^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +2 >var +3 > a +4 > = +5 > hello +6 > , { +7 > name: nameA +8 > } = robotA, +9 > a1 +10> = +11> "hello" +12> ; +1 >Emitted(10, 1) Source(19, 1) + SourceIndex(0) +2 >Emitted(10, 5) Source(19, 5) + SourceIndex(0) +3 >Emitted(10, 6) Source(19, 6) + SourceIndex(0) +4 >Emitted(10, 9) Source(19, 9) + SourceIndex(0) +5 >Emitted(10, 14) Source(19, 14) + SourceIndex(0) +6 >Emitted(10, 16) Source(19, 18) + SourceIndex(0) +7 >Emitted(10, 35) Source(19, 29) + SourceIndex(0) +8 >Emitted(10, 37) Source(19, 42) + SourceIndex(0) +9 >Emitted(10, 39) Source(19, 44) + SourceIndex(0) +10>Emitted(10, 42) Source(19, 46) + SourceIndex(0) +11>Emitted(10, 49) Source(19, 53) + SourceIndex(0) +12>Emitted(10, 50) Source(19, 54) + SourceIndex(0) +--- +>>>var b = hello, nameB = robotB.name, skillB = robotB.skill, b1 = "hello"; +1-> +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^^^^^^^ +10> ^^ +11> ^^ +12> ^^^ +13> ^^^^^^^ +14> ^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >var +3 > b +4 > = +5 > hello +6 > , { +7 > name: nameB +8 > , +9 > skill: skillB +10> } = robotB, +11> b1 +12> = +13> "hello" +14> ; +1->Emitted(11, 1) Source(20, 1) + SourceIndex(0) +2 >Emitted(11, 5) Source(20, 5) + SourceIndex(0) +3 >Emitted(11, 6) Source(20, 6) + SourceIndex(0) +4 >Emitted(11, 9) Source(20, 9) + SourceIndex(0) +5 >Emitted(11, 14) Source(20, 14) + SourceIndex(0) +6 >Emitted(11, 16) Source(20, 18) + SourceIndex(0) +7 >Emitted(11, 35) Source(20, 29) + SourceIndex(0) +8 >Emitted(11, 37) Source(20, 31) + SourceIndex(0) +9 >Emitted(11, 58) Source(20, 44) + SourceIndex(0) +10>Emitted(11, 60) Source(20, 57) + SourceIndex(0) +11>Emitted(11, 62) Source(20, 59) + SourceIndex(0) +12>Emitted(11, 65) Source(20, 62) + SourceIndex(0) +13>Emitted(11, 72) Source(20, 69) + SourceIndex(0) +14>Emitted(11, 73) Source(20, 70) + SourceIndex(0) +--- +>>>var c = hello, _c = { name: "Edger", skill: "cutting edges" }, nameC = _c.name, skillC = _c.skill, c1 = hello; +1-> +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^^ +12> ^^ +13> ^^ +14> ^^^ +15> ^^^^^ +16> ^ +1-> + > +2 >var +3 > c +4 > = +5 > hello +6 > , +7 > { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" } +8 > +9 > name: nameC +10> , +11> skill: skillC +12> } = { name: "Edger", skill: "cutting edges" }, +13> c1 +14> = +15> hello +16> ; +1->Emitted(12, 1) Source(21, 1) + SourceIndex(0) +2 >Emitted(12, 5) Source(21, 5) + SourceIndex(0) +3 >Emitted(12, 6) Source(21, 6) + SourceIndex(0) +4 >Emitted(12, 9) Source(21, 9) + SourceIndex(0) +5 >Emitted(12, 14) Source(21, 14) + SourceIndex(0) +6 >Emitted(12, 16) Source(21, 16) + SourceIndex(0) +7 >Emitted(12, 62) Source(21, 90) + SourceIndex(0) +8 >Emitted(12, 64) Source(21, 18) + SourceIndex(0) +9 >Emitted(12, 79) Source(21, 29) + SourceIndex(0) +10>Emitted(12, 81) Source(21, 31) + SourceIndex(0) +11>Emitted(12, 98) Source(21, 44) + SourceIndex(0) +12>Emitted(12, 100) Source(21, 92) + SourceIndex(0) +13>Emitted(12, 102) Source(21, 94) + SourceIndex(0) +14>Emitted(12, 105) Source(21, 97) + SourceIndex(0) +15>Emitted(12, 110) Source(21, 102) + SourceIndex(0) +16>Emitted(12, 111) Source(21, 103) + SourceIndex(0) +--- +>>>if (nameA == nameB) { +1 > +2 >^^ +3 > ^ +4 > ^ +5 > ^^^^^ +6 > ^^^^ +7 > ^^^^^ +8 > ^ +9 > ^ +10> ^ +11> ^^^^-> +1 > + > +2 >if +3 > +4 > ( +5 > nameA +6 > == +7 > nameB +8 > ) +9 > +10> { +1 >Emitted(13, 1) Source(22, 1) + SourceIndex(0) +2 >Emitted(13, 3) Source(22, 3) + SourceIndex(0) +3 >Emitted(13, 4) Source(22, 4) + SourceIndex(0) +4 >Emitted(13, 5) Source(22, 5) + SourceIndex(0) +5 >Emitted(13, 10) Source(22, 10) + SourceIndex(0) +6 >Emitted(13, 14) Source(22, 14) + SourceIndex(0) +7 >Emitted(13, 19) Source(22, 19) + SourceIndex(0) +8 >Emitted(13, 20) Source(22, 20) + SourceIndex(0) +9 >Emitted(13, 21) Source(22, 21) + SourceIndex(0) +10>Emitted(13, 22) Source(22, 22) + SourceIndex(0) +--- +>>> console.log(skillB); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^^ +7 > ^ +8 > ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > skillB +7 > ) +8 > ; +1->Emitted(14, 5) Source(23, 5) + SourceIndex(0) +2 >Emitted(14, 12) Source(23, 12) + SourceIndex(0) +3 >Emitted(14, 13) Source(23, 13) + SourceIndex(0) +4 >Emitted(14, 16) Source(23, 16) + SourceIndex(0) +5 >Emitted(14, 17) Source(23, 17) + SourceIndex(0) +6 >Emitted(14, 23) Source(23, 23) + SourceIndex(0) +7 >Emitted(14, 24) Source(23, 24) + SourceIndex(0) +8 >Emitted(14, 25) Source(23, 25) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^-> +1 > + > +2 >} +1 >Emitted(15, 1) Source(24, 1) + SourceIndex(0) +2 >Emitted(15, 2) Source(24, 2) + SourceIndex(0) +--- +>>>else { +1-> +2 >^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >else +3 > +4 > { +1->Emitted(16, 1) Source(25, 1) + SourceIndex(0) +2 >Emitted(16, 5) Source(25, 5) + SourceIndex(0) +3 >Emitted(16, 6) Source(25, 6) + SourceIndex(0) +4 >Emitted(16, 7) Source(25, 7) + SourceIndex(0) +--- +>>> console.log(nameC); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +1-> + > +2 > console +3 > . +4 > log +5 > ( +6 > nameC +7 > ) +8 > ; +1->Emitted(17, 5) Source(26, 5) + SourceIndex(0) +2 >Emitted(17, 12) Source(26, 12) + SourceIndex(0) +3 >Emitted(17, 13) Source(26, 13) + SourceIndex(0) +4 >Emitted(17, 16) Source(26, 16) + SourceIndex(0) +5 >Emitted(17, 17) Source(26, 17) + SourceIndex(0) +6 >Emitted(17, 22) Source(26, 22) + SourceIndex(0) +7 >Emitted(17, 23) Source(26, 23) + SourceIndex(0) +8 >Emitted(17, 24) Source(26, 24) + SourceIndex(0) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(18, 1) Source(27, 1) + SourceIndex(0) +2 >Emitted(18, 2) Source(27, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatement1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.symbols new file mode 100644 index 00000000000..eb009ba9ad7 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.symbols @@ -0,0 +1,127 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatement1.ts === +interface Robot { +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 0, 0)) + + name: string; +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 0, 17)) + + skill: string; +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 1, 17)) +} +declare var console: { +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 4, 11)) + + log(msg: string): void; +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 4, 22)) +>msg : Symbol(msg, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 5, 8)) +} +var hello = "hello"; +>hello : Symbol(hello, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 7, 3)) + +var robotA: Robot = { name: "mower", skill: "mowing" }; +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 8, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 0, 0)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 8, 21)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 8, 36)) + +var robotB: Robot = { name: "trimmer", skill: "trimming" }; +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 9, 3)) +>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 0, 0)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 9, 21)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 9, 38)) + +var a: string, { name: nameA } = robotA; +>a : Symbol(a, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 10, 3), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 14, 29), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 18, 3)) +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 0, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 10, 16), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 14, 5), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 18, 16)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 8, 3)) + +var b: string, { name: nameB, skill: skillB } = robotB; +>b : Symbol(b, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 11, 3), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 15, 44), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 19, 3)) +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 0, 17)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 11, 16), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 15, 5), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 19, 16)) +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 1, 17)) +>skillB : Symbol(skillB, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 11, 29), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 15, 18), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 19, 29)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 9, 3)) + +var c: string, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }; +>c : Symbol(c, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 3), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 79), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 3)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 49)) +>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 16), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 5), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 16)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 64)) +>skillC : Symbol(skillC, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 29), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 18), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 29)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 49)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 64)) + +var { name: nameA } = robotA, a = hello; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 0, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 10, 16), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 14, 5), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 18, 16)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 8, 3)) +>a : Symbol(a, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 10, 3), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 14, 29), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 18, 3)) +>hello : Symbol(hello, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 7, 3)) + +var { name: nameB, skill: skillB } = robotB, b = " hello"; +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 0, 17)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 11, 16), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 15, 5), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 19, 16)) +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 1, 17)) +>skillB : Symbol(skillB, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 11, 29), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 15, 18), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 19, 29)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 9, 3)) +>b : Symbol(b, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 11, 3), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 15, 44), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 19, 3)) + +var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c = hello; +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 38)) +>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 16), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 5), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 16)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 53)) +>skillC : Symbol(skillC, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 29), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 18), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 29)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 38)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 53)) +>c : Symbol(c, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 3), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 79), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 3)) +>hello : Symbol(hello, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 7, 3)) + +var a = hello, { name: nameA } = robotA, a1= "hello"; +>a : Symbol(a, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 10, 3), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 14, 29), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 18, 3)) +>hello : Symbol(hello, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 7, 3)) +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 0, 17)) +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 10, 16), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 14, 5), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 18, 16)) +>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 8, 3)) +>a1 : Symbol(a1, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 18, 40)) + +var b = hello, { name: nameB, skill: skillB } = robotB, b1 = "hello"; +>b : Symbol(b, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 11, 3), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 15, 44), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 19, 3)) +>hello : Symbol(hello, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 7, 3)) +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 0, 17)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 11, 16), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 15, 5), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 19, 16)) +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 1, 17)) +>skillB : Symbol(skillB, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 11, 29), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 15, 18), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 19, 29)) +>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 9, 3)) +>b1 : Symbol(b1, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 19, 55)) + +var c = hello, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c1 = hello; +>c : Symbol(c, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 3), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 79), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 3)) +>hello : Symbol(hello, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 7, 3)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 49)) +>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 16), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 5), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 16)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 64)) +>skillC : Symbol(skillC, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 29), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 18), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 29)) +>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 49)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 64)) +>c1 : Symbol(c1, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 90)) +>hello : Symbol(hello, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 7, 3)) + +if (nameA == nameB) { +>nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 10, 16), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 14, 5), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 18, 16)) +>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 11, 16), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 15, 5), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 19, 16)) + + console.log(skillB); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 4, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 4, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 4, 22)) +>skillB : Symbol(skillB, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 11, 29), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 15, 18), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 19, 29)) +} +else { + console.log(nameC); +>console.log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 4, 22)) +>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 4, 11)) +>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 4, 22)) +>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringVariableStatement1.ts, 12, 16), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 16, 5), Decl(sourceMapValidationDestructuringVariableStatement1.ts, 20, 16)) +} diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.types new file mode 100644 index 00000000000..9d8023f5f74 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatement1.types @@ -0,0 +1,149 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatement1.ts === +interface Robot { +>Robot : Robot + + name: string; +>name : string + + skill: string; +>skill : string +} +declare var console: { +>console : { log(msg: string): void; } + + log(msg: string): void; +>log : (msg: string) => void +>msg : string +} +var hello = "hello"; +>hello : string +>"hello" : string + +var robotA: Robot = { name: "mower", skill: "mowing" }; +>robotA : Robot +>Robot : Robot +>{ name: "mower", skill: "mowing" } : { name: string; skill: string; } +>name : string +>"mower" : string +>skill : string +>"mowing" : string + +var robotB: Robot = { name: "trimmer", skill: "trimming" }; +>robotB : Robot +>Robot : Robot +>{ name: "trimmer", skill: "trimming" } : { name: string; skill: string; } +>name : string +>"trimmer" : string +>skill : string +>"trimming" : string + +var a: string, { name: nameA } = robotA; +>a : string +>name : any +>nameA : string +>robotA : Robot + +var b: string, { name: nameB, skill: skillB } = robotB; +>b : string +>name : any +>nameB : string +>skill : any +>skillB : string +>robotB : Robot + +var c: string, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }; +>c : string +>name : any +>nameC : string +>skill : any +>skillC : string +>{ name: "Edger", skill: "cutting edges" } : { name: string; skill: string; } +>name : string +>"Edger" : string +>skill : string +>"cutting edges" : string + +var { name: nameA } = robotA, a = hello; +>name : any +>nameA : string +>robotA : Robot +>a : string +>hello : string + +var { name: nameB, skill: skillB } = robotB, b = " hello"; +>name : any +>nameB : string +>skill : any +>skillB : string +>robotB : Robot +>b : string +>" hello" : string + +var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c = hello; +>name : any +>nameC : string +>skill : any +>skillC : string +>{ name: "Edger", skill: "cutting edges" } : { name: string; skill: string; } +>name : string +>"Edger" : string +>skill : string +>"cutting edges" : string +>c : string +>hello : string + +var a = hello, { name: nameA } = robotA, a1= "hello"; +>a : string +>hello : string +>name : any +>nameA : string +>robotA : Robot +>a1 : string +>"hello" : string + +var b = hello, { name: nameB, skill: skillB } = robotB, b1 = "hello"; +>b : string +>hello : string +>name : any +>nameB : string +>skill : any +>skillB : string +>robotB : Robot +>b1 : string +>"hello" : string + +var c = hello, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c1 = hello; +>c : string +>hello : string +>name : any +>nameC : string +>skill : any +>skillC : string +>{ name: "Edger", skill: "cutting edges" } : { name: string; skill: string; } +>name : string +>"Edger" : string +>skill : string +>"cutting edges" : string +>c1 : string +>hello : string + +if (nameA == nameB) { +>nameA == nameB : boolean +>nameA : string +>nameB : string + + console.log(skillB); +>console.log(skillB) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>skillB : string +} +else { + console.log(nameC); +>console.log(nameC) : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>nameC : string +} diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatement1.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatement1.ts new file mode 100644 index 00000000000..3697402bbcf --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatement1.ts @@ -0,0 +1,28 @@ +// @sourcemap: true +interface Robot { + name: string; + skill: string; +} +declare var console: { + log(msg: string): void; +} +var hello = "hello"; +var robotA: Robot = { name: "mower", skill: "mowing" }; +var robotB: Robot = { name: "trimmer", skill: "trimming" }; +var a: string, { name: nameA } = robotA; +var b: string, { name: nameB, skill: skillB } = robotB; +var c: string, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }; + +var { name: nameA } = robotA, a = hello; +var { name: nameB, skill: skillB } = robotB, b = " hello"; +var { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c = hello; + +var a = hello, { name: nameA } = robotA, a1= "hello"; +var b = hello, { name: nameB, skill: skillB } = robotB, b1 = "hello"; +var c = hello, { name: nameC, skill: skillC } = { name: "Edger", skill: "cutting edges" }, c1 = hello; +if (nameA == nameB) { + console.log(skillB); +} +else { + console.log(nameC); +} \ No newline at end of file