mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-09 07:21:18 -05:00
Test case for nested object binding pattern in variable statement
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
//// [sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts]
|
||||
declare var console: {
|
||||
log(msg: string): void;
|
||||
}
|
||||
interface Robot {
|
||||
name: string;
|
||||
skills: {
|
||||
primary: string;
|
||||
secondary: string;
|
||||
};
|
||||
}
|
||||
var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } };
|
||||
var robotB: Robot = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } };
|
||||
|
||||
var { skills: { primary: primaryA, secondary: secondaryA } } = robotA;
|
||||
var { name: nameB, skills: { primary: primaryB, secondary: secondaryB } } = robotB;
|
||||
var { name: nameC, skills: { primary: primaryB, secondary: secondaryB } } = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } };
|
||||
|
||||
if (nameB == nameB) {
|
||||
console.log(nameC);
|
||||
}
|
||||
else {
|
||||
console.log(nameC);
|
||||
}
|
||||
|
||||
//// [sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.js]
|
||||
var robotA = { name: "mower", skills: { primary: "mowing", secondary: "none" } };
|
||||
var robotB = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } };
|
||||
var _a = robotA.skills, primaryA = _a.primary, secondaryA = _a.secondary;
|
||||
var nameB = robotB.name, _b = robotB.skills, primaryB = _b.primary, secondaryB = _b.secondary;
|
||||
var _c = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }, nameC = _c.name, _d = _c.skills, primaryB = _d.primary, secondaryB = _d.secondary;
|
||||
if (nameB == nameB) {
|
||||
console.log(nameC);
|
||||
}
|
||||
else {
|
||||
console.log(nameC);
|
||||
}
|
||||
//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.js.map
|
||||
@@ -0,0 +1,2 @@
|
||||
//// [sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.js.map]
|
||||
{"version":3,"file":"sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts"],"names":[],"mappings":"AAUA,IAAI,MAAM,GAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC;AACxF,IAAI,MAAM,GAAU,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC;AAE9F,IAAI,oBAAY,qBAAiB,EAAE,yBAAqB,CAAc;AACtE,IAAM,mBAAW,sBAAY,qBAAiB,EAAE,yBAAqB,CAAc;AACnF,IAA4E,mFAA8E,EAApJ,eAAW,kBAAY,qBAAiB,EAAE,yBAAqB,CAAsF;AAE3J,EAAE,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC;IACjB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AACD,IAAI,CAAC,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC"}
|
||||
@@ -0,0 +1,371 @@
|
||||
===================================================================
|
||||
JsFile: sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.js
|
||||
mapUrl: sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.js.map
|
||||
sourceRoot:
|
||||
sources: sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts
|
||||
===================================================================
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.js
|
||||
sourceFile:sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>var robotA = { name: "mower", skills: { primary: "mowing", secondary: "none" } };
|
||||
1 >
|
||||
2 >^^^^
|
||||
3 > ^^^^^^
|
||||
4 > ^^^
|
||||
5 > ^^
|
||||
6 > ^^^^
|
||||
7 > ^^
|
||||
8 > ^^^^^^^
|
||||
9 > ^^
|
||||
10> ^^^^^^
|
||||
11> ^^
|
||||
12> ^^
|
||||
13> ^^^^^^^
|
||||
14> ^^
|
||||
15> ^^^^^^^^
|
||||
16> ^^
|
||||
17> ^^^^^^^^^
|
||||
18> ^^
|
||||
19> ^^^^^^
|
||||
20> ^^
|
||||
21> ^^
|
||||
22> ^
|
||||
23> ^^^^^^^->
|
||||
1 >declare var console: {
|
||||
> log(msg: string): void;
|
||||
>}
|
||||
>interface Robot {
|
||||
> name: string;
|
||||
> skills: {
|
||||
> primary: string;
|
||||
> secondary: string;
|
||||
> };
|
||||
>}
|
||||
>
|
||||
2 >var
|
||||
3 > robotA
|
||||
4 > : Robot =
|
||||
5 > {
|
||||
6 > name
|
||||
7 > :
|
||||
8 > "mower"
|
||||
9 > ,
|
||||
10> skills
|
||||
11> :
|
||||
12> {
|
||||
13> primary
|
||||
14> :
|
||||
15> "mowing"
|
||||
16> ,
|
||||
17> secondary
|
||||
18> :
|
||||
19> "none"
|
||||
20> }
|
||||
21> }
|
||||
22> ;
|
||||
1 >Emitted(1, 1) Source(11, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 5) Source(11, 5) + SourceIndex(0)
|
||||
3 >Emitted(1, 11) Source(11, 11) + SourceIndex(0)
|
||||
4 >Emitted(1, 14) Source(11, 21) + SourceIndex(0)
|
||||
5 >Emitted(1, 16) Source(11, 23) + SourceIndex(0)
|
||||
6 >Emitted(1, 20) Source(11, 27) + SourceIndex(0)
|
||||
7 >Emitted(1, 22) Source(11, 29) + SourceIndex(0)
|
||||
8 >Emitted(1, 29) Source(11, 36) + SourceIndex(0)
|
||||
9 >Emitted(1, 31) Source(11, 38) + SourceIndex(0)
|
||||
10>Emitted(1, 37) Source(11, 44) + SourceIndex(0)
|
||||
11>Emitted(1, 39) Source(11, 46) + SourceIndex(0)
|
||||
12>Emitted(1, 41) Source(11, 48) + SourceIndex(0)
|
||||
13>Emitted(1, 48) Source(11, 55) + SourceIndex(0)
|
||||
14>Emitted(1, 50) Source(11, 57) + SourceIndex(0)
|
||||
15>Emitted(1, 58) Source(11, 65) + SourceIndex(0)
|
||||
16>Emitted(1, 60) Source(11, 67) + SourceIndex(0)
|
||||
17>Emitted(1, 69) Source(11, 76) + SourceIndex(0)
|
||||
18>Emitted(1, 71) Source(11, 78) + SourceIndex(0)
|
||||
19>Emitted(1, 77) Source(11, 84) + SourceIndex(0)
|
||||
20>Emitted(1, 79) Source(11, 86) + SourceIndex(0)
|
||||
21>Emitted(1, 81) Source(11, 88) + SourceIndex(0)
|
||||
22>Emitted(1, 82) Source(11, 89) + SourceIndex(0)
|
||||
---
|
||||
>>>var robotB = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } };
|
||||
1->
|
||||
2 >^^^^
|
||||
3 > ^^^^^^
|
||||
4 > ^^^
|
||||
5 > ^^
|
||||
6 > ^^^^
|
||||
7 > ^^
|
||||
8 > ^^^^^^^^^
|
||||
9 > ^^
|
||||
10> ^^^^^^
|
||||
11> ^^
|
||||
12> ^^
|
||||
13> ^^^^^^^
|
||||
14> ^^
|
||||
15> ^^^^^^^^^^
|
||||
16> ^^
|
||||
17> ^^^^^^^^^
|
||||
18> ^^
|
||||
19> ^^^^^^^^
|
||||
20> ^^
|
||||
21> ^^
|
||||
22> ^
|
||||
1->
|
||||
>
|
||||
2 >var
|
||||
3 > robotB
|
||||
4 > : Robot =
|
||||
5 > {
|
||||
6 > name
|
||||
7 > :
|
||||
8 > "trimmer"
|
||||
9 > ,
|
||||
10> skills
|
||||
11> :
|
||||
12> {
|
||||
13> primary
|
||||
14> :
|
||||
15> "trimming"
|
||||
16> ,
|
||||
17> secondary
|
||||
18> :
|
||||
19> "edging"
|
||||
20> }
|
||||
21> }
|
||||
22> ;
|
||||
1->Emitted(2, 1) Source(12, 1) + SourceIndex(0)
|
||||
2 >Emitted(2, 5) Source(12, 5) + SourceIndex(0)
|
||||
3 >Emitted(2, 11) Source(12, 11) + SourceIndex(0)
|
||||
4 >Emitted(2, 14) Source(12, 21) + SourceIndex(0)
|
||||
5 >Emitted(2, 16) Source(12, 23) + SourceIndex(0)
|
||||
6 >Emitted(2, 20) Source(12, 27) + SourceIndex(0)
|
||||
7 >Emitted(2, 22) Source(12, 29) + SourceIndex(0)
|
||||
8 >Emitted(2, 31) Source(12, 38) + SourceIndex(0)
|
||||
9 >Emitted(2, 33) Source(12, 40) + SourceIndex(0)
|
||||
10>Emitted(2, 39) Source(12, 46) + SourceIndex(0)
|
||||
11>Emitted(2, 41) Source(12, 48) + SourceIndex(0)
|
||||
12>Emitted(2, 43) Source(12, 50) + SourceIndex(0)
|
||||
13>Emitted(2, 50) Source(12, 57) + SourceIndex(0)
|
||||
14>Emitted(2, 52) Source(12, 59) + SourceIndex(0)
|
||||
15>Emitted(2, 62) Source(12, 69) + SourceIndex(0)
|
||||
16>Emitted(2, 64) Source(12, 71) + SourceIndex(0)
|
||||
17>Emitted(2, 73) Source(12, 80) + SourceIndex(0)
|
||||
18>Emitted(2, 75) Source(12, 82) + SourceIndex(0)
|
||||
19>Emitted(2, 83) Source(12, 90) + SourceIndex(0)
|
||||
20>Emitted(2, 85) Source(12, 92) + SourceIndex(0)
|
||||
21>Emitted(2, 87) Source(12, 94) + SourceIndex(0)
|
||||
22>Emitted(2, 88) Source(12, 95) + SourceIndex(0)
|
||||
---
|
||||
>>>var _a = robotA.skills, primaryA = _a.primary, secondaryA = _a.secondary;
|
||||
1 >
|
||||
2 >^^^^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^
|
||||
4 > ^^^^^^^^^^^^^^^^^^^^^
|
||||
5 > ^^
|
||||
6 > ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
7 > ^
|
||||
8 > ^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
>
|
||||
2 >var
|
||||
3 > { skills: {
|
||||
4 > primary: primaryA
|
||||
5 > ,
|
||||
6 > secondary: secondaryA
|
||||
7 > } } = robotA;
|
||||
1 >Emitted(3, 1) Source(14, 1) + SourceIndex(0)
|
||||
2 >Emitted(3, 5) Source(14, 5) + SourceIndex(0)
|
||||
3 >Emitted(3, 25) Source(14, 17) + SourceIndex(0)
|
||||
4 >Emitted(3, 46) Source(14, 34) + SourceIndex(0)
|
||||
5 >Emitted(3, 48) Source(14, 36) + SourceIndex(0)
|
||||
6 >Emitted(3, 73) Source(14, 57) + SourceIndex(0)
|
||||
7 >Emitted(3, 74) Source(14, 71) + SourceIndex(0)
|
||||
---
|
||||
>>>var nameB = robotB.name, _b = robotB.skills, primaryB = _b.primary, secondaryB = _b.secondary;
|
||||
1->
|
||||
2 >^^^^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^
|
||||
4 > ^^^^^^^^^^^^^^^^^^^^^^
|
||||
5 > ^^^^^^^^^^^^^^^^^^^^^
|
||||
6 > ^^
|
||||
7 > ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
8 > ^
|
||||
9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->
|
||||
>
|
||||
2 >var {
|
||||
3 > name: nameB
|
||||
4 > , skills: {
|
||||
5 > primary: primaryB
|
||||
6 > ,
|
||||
7 > secondary: secondaryB
|
||||
8 > } } = robotB;
|
||||
1->Emitted(4, 1) Source(15, 1) + SourceIndex(0)
|
||||
2 >Emitted(4, 5) Source(15, 7) + SourceIndex(0)
|
||||
3 >Emitted(4, 24) Source(15, 18) + SourceIndex(0)
|
||||
4 >Emitted(4, 46) Source(15, 30) + SourceIndex(0)
|
||||
5 >Emitted(4, 67) Source(15, 47) + SourceIndex(0)
|
||||
6 >Emitted(4, 69) Source(15, 49) + SourceIndex(0)
|
||||
7 >Emitted(4, 94) Source(15, 70) + SourceIndex(0)
|
||||
8 >Emitted(4, 95) Source(15, 84) + SourceIndex(0)
|
||||
---
|
||||
>>>var _c = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }, nameC = _c.name, _d = _c.skills, primaryB = _d.primary, secondaryB = _d.secondary;
|
||||
1->
|
||||
2 >^^^^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
4 > ^^
|
||||
5 > ^^^^^^^^^^^^^^^
|
||||
6 > ^^^^^^^^^^^^^^^^^^
|
||||
7 > ^^^^^^^^^^^^^^^^^^^^^
|
||||
8 > ^^
|
||||
9 > ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
10> ^
|
||||
1->
|
||||
>
|
||||
2 >var { name: nameC, skills: { primary: primaryB, secondary: secondaryB } } =
|
||||
3 > { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } }
|
||||
4 >
|
||||
5 > name: nameC
|
||||
6 > , skills: {
|
||||
7 > primary: primaryB
|
||||
8 > ,
|
||||
9 > secondary: secondaryB
|
||||
10> } } = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } };
|
||||
1->Emitted(5, 1) Source(16, 1) + SourceIndex(0)
|
||||
2 >Emitted(5, 5) Source(16, 77) + SourceIndex(0)
|
||||
3 >Emitted(5, 88) Source(16, 155) + SourceIndex(0)
|
||||
4 >Emitted(5, 90) Source(16, 7) + SourceIndex(0)
|
||||
5 >Emitted(5, 105) Source(16, 18) + SourceIndex(0)
|
||||
6 >Emitted(5, 123) Source(16, 30) + SourceIndex(0)
|
||||
7 >Emitted(5, 144) Source(16, 47) + SourceIndex(0)
|
||||
8 >Emitted(5, 146) Source(16, 49) + SourceIndex(0)
|
||||
9 >Emitted(5, 171) Source(16, 70) + SourceIndex(0)
|
||||
10>Emitted(5, 172) Source(16, 156) + SourceIndex(0)
|
||||
---
|
||||
>>>if (nameB == nameB) {
|
||||
1 >
|
||||
2 >^^
|
||||
3 > ^
|
||||
4 > ^
|
||||
5 > ^^^^^
|
||||
6 > ^^^^
|
||||
7 > ^^^^^
|
||||
8 > ^
|
||||
9 > ^
|
||||
10> ^
|
||||
11> ^^^->
|
||||
1 >
|
||||
>
|
||||
>
|
||||
2 >if
|
||||
3 >
|
||||
4 > (
|
||||
5 > nameB
|
||||
6 > ==
|
||||
7 > nameB
|
||||
8 > )
|
||||
9 >
|
||||
10> {
|
||||
1 >Emitted(6, 1) Source(18, 1) + SourceIndex(0)
|
||||
2 >Emitted(6, 3) Source(18, 3) + SourceIndex(0)
|
||||
3 >Emitted(6, 4) Source(18, 4) + SourceIndex(0)
|
||||
4 >Emitted(6, 5) Source(18, 5) + SourceIndex(0)
|
||||
5 >Emitted(6, 10) Source(18, 10) + SourceIndex(0)
|
||||
6 >Emitted(6, 14) Source(18, 14) + SourceIndex(0)
|
||||
7 >Emitted(6, 19) Source(18, 19) + SourceIndex(0)
|
||||
8 >Emitted(6, 20) Source(18, 20) + SourceIndex(0)
|
||||
9 >Emitted(6, 21) Source(18, 21) + SourceIndex(0)
|
||||
10>Emitted(6, 22) Source(18, 22) + 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(7, 5) Source(19, 5) + SourceIndex(0)
|
||||
2 >Emitted(7, 12) Source(19, 12) + SourceIndex(0)
|
||||
3 >Emitted(7, 13) Source(19, 13) + SourceIndex(0)
|
||||
4 >Emitted(7, 16) Source(19, 16) + SourceIndex(0)
|
||||
5 >Emitted(7, 17) Source(19, 17) + SourceIndex(0)
|
||||
6 >Emitted(7, 22) Source(19, 22) + SourceIndex(0)
|
||||
7 >Emitted(7, 23) Source(19, 23) + SourceIndex(0)
|
||||
8 >Emitted(7, 24) Source(19, 24) + SourceIndex(0)
|
||||
---
|
||||
>>>}
|
||||
1 >
|
||||
2 >^
|
||||
3 > ^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 >}
|
||||
1 >Emitted(8, 1) Source(20, 1) + SourceIndex(0)
|
||||
2 >Emitted(8, 2) Source(20, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>else {
|
||||
1->
|
||||
2 >^^^^
|
||||
3 > ^
|
||||
4 > ^
|
||||
5 > ^^^^^^^^^^^^^^^^^^->
|
||||
1->
|
||||
>
|
||||
2 >else
|
||||
3 >
|
||||
4 > {
|
||||
1->Emitted(9, 1) Source(21, 1) + SourceIndex(0)
|
||||
2 >Emitted(9, 5) Source(21, 5) + SourceIndex(0)
|
||||
3 >Emitted(9, 6) Source(21, 6) + SourceIndex(0)
|
||||
4 >Emitted(9, 7) Source(21, 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(10, 5) Source(22, 5) + SourceIndex(0)
|
||||
2 >Emitted(10, 12) Source(22, 12) + SourceIndex(0)
|
||||
3 >Emitted(10, 13) Source(22, 13) + SourceIndex(0)
|
||||
4 >Emitted(10, 16) Source(22, 16) + SourceIndex(0)
|
||||
5 >Emitted(10, 17) Source(22, 17) + SourceIndex(0)
|
||||
6 >Emitted(10, 22) Source(22, 22) + SourceIndex(0)
|
||||
7 >Emitted(10, 23) Source(22, 23) + SourceIndex(0)
|
||||
8 >Emitted(10, 24) Source(22, 24) + SourceIndex(0)
|
||||
---
|
||||
>>>}
|
||||
1 >
|
||||
2 >^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 >}
|
||||
1 >Emitted(11, 1) Source(23, 1) + SourceIndex(0)
|
||||
2 >Emitted(11, 2) Source(23, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.js.map
|
||||
@@ -0,0 +1,89 @@
|
||||
=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts ===
|
||||
declare var console: {
|
||||
>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 0, 11))
|
||||
|
||||
log(msg: string): void;
|
||||
>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 0, 22))
|
||||
>msg : Symbol(msg, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 1, 8))
|
||||
}
|
||||
interface Robot {
|
||||
>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 2, 1))
|
||||
|
||||
name: string;
|
||||
>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 3, 17))
|
||||
|
||||
skills: {
|
||||
>skills : Symbol(skills, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 4, 17))
|
||||
|
||||
primary: string;
|
||||
>primary : Symbol(primary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 5, 13))
|
||||
|
||||
secondary: string;
|
||||
>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 6, 24))
|
||||
|
||||
};
|
||||
}
|
||||
var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } };
|
||||
>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 10, 3))
|
||||
>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 2, 1))
|
||||
>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 10, 21))
|
||||
>skills : Symbol(skills, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 10, 36))
|
||||
>primary : Symbol(primary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 10, 46))
|
||||
>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 10, 65))
|
||||
|
||||
var robotB: Robot = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } };
|
||||
>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 11, 3))
|
||||
>Robot : Symbol(Robot, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 2, 1))
|
||||
>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 11, 21))
|
||||
>skills : Symbol(skills, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 11, 38))
|
||||
>primary : Symbol(primary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 11, 48))
|
||||
>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 11, 69))
|
||||
|
||||
var { skills: { primary: primaryA, secondary: secondaryA } } = robotA;
|
||||
>skills : Symbol(Robot.skills, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 4, 17))
|
||||
>primary : Symbol(primary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 5, 13))
|
||||
>primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 13, 15))
|
||||
>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 6, 24))
|
||||
>secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 13, 34))
|
||||
>robotA : Symbol(robotA, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 10, 3))
|
||||
|
||||
var { name: nameB, skills: { primary: primaryB, secondary: secondaryB } } = robotB;
|
||||
>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 3, 17))
|
||||
>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 14, 5))
|
||||
>skills : Symbol(Robot.skills, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 4, 17))
|
||||
>primary : Symbol(primary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 5, 13))
|
||||
>primaryB : Symbol(primaryB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 14, 28), Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 28))
|
||||
>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 6, 24))
|
||||
>secondaryB : Symbol(secondaryB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 14, 47), Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 47))
|
||||
>robotB : Symbol(robotB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 11, 3))
|
||||
|
||||
var { name: nameC, skills: { primary: primaryB, secondary: secondaryB } } = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } };
|
||||
>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 77))
|
||||
>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 5))
|
||||
>skills : Symbol(skills, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 92))
|
||||
>primary : Symbol(primary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 102))
|
||||
>primaryB : Symbol(primaryB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 14, 28), Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 28))
|
||||
>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 121))
|
||||
>secondaryB : Symbol(secondaryB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 14, 47), Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 47))
|
||||
>name : Symbol(name, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 77))
|
||||
>skills : Symbol(skills, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 92))
|
||||
>primary : Symbol(primary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 102))
|
||||
>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 121))
|
||||
|
||||
if (nameB == nameB) {
|
||||
>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 14, 5))
|
||||
>nameB : Symbol(nameB, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 14, 5))
|
||||
|
||||
console.log(nameC);
|
||||
>console.log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 0, 22))
|
||||
>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 0, 11))
|
||||
>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 0, 22))
|
||||
>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 5))
|
||||
}
|
||||
else {
|
||||
console.log(nameC);
|
||||
>console.log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 0, 22))
|
||||
>console : Symbol(console, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 0, 11))
|
||||
>log : Symbol(log, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 0, 22))
|
||||
>nameC : Symbol(nameC, Decl(sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts, 15, 5))
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementNestedObjectBindingPattern.ts ===
|
||||
declare var console: {
|
||||
>console : { log(msg: string): void; }
|
||||
|
||||
log(msg: string): void;
|
||||
>log : (msg: string) => void
|
||||
>msg : string
|
||||
}
|
||||
interface Robot {
|
||||
>Robot : Robot
|
||||
|
||||
name: string;
|
||||
>name : string
|
||||
|
||||
skills: {
|
||||
>skills : { primary: string; secondary: string; }
|
||||
|
||||
primary: string;
|
||||
>primary : string
|
||||
|
||||
secondary: string;
|
||||
>secondary : string
|
||||
|
||||
};
|
||||
}
|
||||
var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } };
|
||||
>robotA : Robot
|
||||
>Robot : Robot
|
||||
>{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; }
|
||||
>name : string
|
||||
>"mower" : string
|
||||
>skills : { primary: string; secondary: string; }
|
||||
>{ primary: "mowing", secondary: "none" } : { primary: string; secondary: string; }
|
||||
>primary : string
|
||||
>"mowing" : string
|
||||
>secondary : string
|
||||
>"none" : string
|
||||
|
||||
var robotB: Robot = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } };
|
||||
>robotB : Robot
|
||||
>Robot : Robot
|
||||
>{ name: "trimmer", skills: { primary: "trimming", secondary: "edging" } } : { name: string; skills: { primary: string; secondary: string; }; }
|
||||
>name : string
|
||||
>"trimmer" : string
|
||||
>skills : { primary: string; secondary: string; }
|
||||
>{ primary: "trimming", secondary: "edging" } : { primary: string; secondary: string; }
|
||||
>primary : string
|
||||
>"trimming" : string
|
||||
>secondary : string
|
||||
>"edging" : string
|
||||
|
||||
var { skills: { primary: primaryA, secondary: secondaryA } } = robotA;
|
||||
>skills : any
|
||||
>primary : any
|
||||
>primaryA : string
|
||||
>secondary : any
|
||||
>secondaryA : string
|
||||
>robotA : Robot
|
||||
|
||||
var { name: nameB, skills: { primary: primaryB, secondary: secondaryB } } = robotB;
|
||||
>name : any
|
||||
>nameB : string
|
||||
>skills : any
|
||||
>primary : any
|
||||
>primaryB : string
|
||||
>secondary : any
|
||||
>secondaryB : string
|
||||
>robotB : Robot
|
||||
|
||||
var { name: nameC, skills: { primary: primaryB, secondary: secondaryB } } = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } };
|
||||
>name : any
|
||||
>nameC : string
|
||||
>skills : any
|
||||
>primary : any
|
||||
>primaryB : string
|
||||
>secondary : any
|
||||
>secondaryB : string
|
||||
>{ name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } } : { name: string; skills: { primary: string; secondary: string; }; }
|
||||
>name : string
|
||||
>"Edger" : string
|
||||
>skills : { primary: string; secondary: string; }
|
||||
>{ primary: "edging", secondary: "branch trimming" } : { primary: string; secondary: string; }
|
||||
>primary : string
|
||||
>"edging" : string
|
||||
>secondary : string
|
||||
>"branch trimming" : string
|
||||
|
||||
if (nameB == nameB) {
|
||||
>nameB == nameB : boolean
|
||||
>nameB : string
|
||||
>nameB : string
|
||||
|
||||
console.log(nameC);
|
||||
>console.log(nameC) : void
|
||||
>console.log : (msg: string) => void
|
||||
>console : { log(msg: string): void; }
|
||||
>log : (msg: string) => void
|
||||
>nameC : 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
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// @sourcemap: true
|
||||
declare var console: {
|
||||
log(msg: string): void;
|
||||
}
|
||||
interface Robot {
|
||||
name: string;
|
||||
skills: {
|
||||
primary: string;
|
||||
secondary: string;
|
||||
};
|
||||
}
|
||||
var robotA: Robot = { name: "mower", skills: { primary: "mowing", secondary: "none" } };
|
||||
var robotB: Robot = { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } };
|
||||
|
||||
var { skills: { primary: primaryA, secondary: secondaryA } } = robotA;
|
||||
var { name: nameB, skills: { primary: primaryB, secondary: secondaryB } } = robotB;
|
||||
var { name: nameC, skills: { primary: primaryB, secondary: secondaryB } } = { name: "Edger", skills: { primary: "edging", secondary: "branch trimming" } };
|
||||
|
||||
if (nameB == nameB) {
|
||||
console.log(nameC);
|
||||
}
|
||||
else {
|
||||
console.log(nameC);
|
||||
}
|
||||
Reference in New Issue
Block a user