From bcf22157d8934ca31836a75c6c00e8ddb78125b8 Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Fri, 29 Jan 2016 18:20:05 -0800 Subject: [PATCH 01/15] Fix lastEncodedSourceMapSpan from being set to undefined --- src/compiler/sourcemap.ts | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/compiler/sourcemap.ts b/src/compiler/sourcemap.ts index 8abf1432b0c..86bad38cb6e 100644 --- a/src/compiler/sourcemap.ts +++ b/src/compiler/sourcemap.ts @@ -16,6 +16,14 @@ namespace ts { } let nullSourceMapWriter: SourceMapWriter; + // Used for initialize lastEncodedSourceMapSpan and reset lastEncodedSourceMapSpan when updateLastEncodedAndRecordedSpans + const defaultLastEncodedSourceMapSpan: SourceMapSpan = { + emittedLine: 1, + emittedColumn: 1, + sourceLine: 1, + sourceColumn: 1, + sourceIndex: 0 + }; export function getNullSourceMapWriter(): SourceMapWriter { if (nullSourceMapWriter === undefined) { @@ -79,13 +87,7 @@ namespace ts { // Last recorded and encoded spans lastRecordedSourceMapSpan = undefined; - lastEncodedSourceMapSpan = { - emittedLine: 1, - emittedColumn: 1, - sourceLine: 1, - sourceColumn: 1, - sourceIndex: 0 - }; + lastEncodedSourceMapSpan = defaultLastEncodedSourceMapSpan; lastEncodedNameIndex = 0; // Initialize source map data @@ -159,10 +161,12 @@ namespace ts { // Pop sourceMapDecodedMappings to remove last entry sourceMapData.sourceMapDecodedMappings.pop(); - // Change the last encoded source map + // Point the lastEncodedSourceMapSpace to the previous encoded sourceMapSpan + // If the list is empty which indicates that we are at the beginning of the file, + // we have to reset it to default value (same value when we first initialize sourceMapWriter) lastEncodedSourceMapSpan = sourceMapData.sourceMapDecodedMappings.length ? sourceMapData.sourceMapDecodedMappings[sourceMapData.sourceMapDecodedMappings.length - 1] : - undefined; + defaultLastEncodedSourceMapSpan; // TODO: Update lastEncodedNameIndex // Since we dont support this any more, lets not worry about it right now. From 8ce886c4369e0289a61a2a261308e3e2e5872c5e Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Fri, 29 Jan 2016 18:20:17 -0800 Subject: [PATCH 02/15] Update baselines --- ...ationDestructuringObjectBindingPattern1.js | 7 +++ ...nDestructuringObjectBindingPattern1.js.map | 2 + ...cturingObjectBindingPattern1.sourcemap.txt | 24 +++++++++ ...DestructuringObjectBindingPattern1.symbols | 6 +++ ...onDestructuringObjectBindingPattern1.types | 8 +++ ...ationDestructuringObjectBindingPattern2.js | 9 ++++ ...nDestructuringObjectBindingPattern2.js.map | 2 + ...cturingObjectBindingPattern2.sourcemap.txt | 52 +++++++++++++++++++ ...DestructuringObjectBindingPattern2.symbols | 12 +++++ ...onDestructuringObjectBindingPattern2.types | 17 ++++++ 10 files changed, 139 insertions(+) create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.js create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.js.map create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.sourcemap.txt create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.symbols create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.types create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.js create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.js.map create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.sourcemap.txt create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.symbols create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.types diff --git a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.js b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.js new file mode 100644 index 00000000000..c4e56eefe1e --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.js @@ -0,0 +1,7 @@ +//// [sourceMapValidationDestructuringObjectBindingPattern1.ts] + +var {x} = { x: 20 }; + +//// [sourceMapValidationDestructuringObjectBindingPattern1.js] +var x = { x: 20 }.x; +//# sourceMappingURL=sourceMapValidationDestructuringObjectBindingPattern1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.js.map b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.js.map new file mode 100644 index 00000000000..c428ab3f5fc --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringObjectBindingPattern1.js.map] +{"version":3,"file":"sourceMapValidationDestructuringObjectBindingPattern1.js","sourceRoot":"","sources":["sourceMapValidationDestructuringObjectBindingPattern1.ts"],"names":[],"mappings":"AACK,mBAAC,CAAc"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.sourcemap.txt new file mode 100644 index 00000000000..5dd6c7410dd --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.sourcemap.txt @@ -0,0 +1,24 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringObjectBindingPattern1.js +mapUrl: sourceMapValidationDestructuringObjectBindingPattern1.js.map +sourceRoot: +sources: sourceMapValidationDestructuringObjectBindingPattern1.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringObjectBindingPattern1.js +sourceFile:sourceMapValidationDestructuringObjectBindingPattern1.ts +------------------------------------------------------------------- +>>>var x = { x: 20 }.x; +1 > +2 >^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >var { +2 >x +3 > } = { x: 20 }; +1 >Emitted(1, 1) Source(2, 6) + SourceIndex(0) +2 >Emitted(1, 20) Source(2, 7) + SourceIndex(0) +3 >Emitted(1, 21) Source(2, 21) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringObjectBindingPattern1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.symbols b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.symbols new file mode 100644 index 00000000000..b504acdb9b0 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.symbols @@ -0,0 +1,6 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringObjectBindingPattern1.ts === + +var {x} = { x: 20 }; +>x : Symbol(x, Decl(sourceMapValidationDestructuringObjectBindingPattern1.ts, 1, 5)) +>x : Symbol(x, Decl(sourceMapValidationDestructuringObjectBindingPattern1.ts, 1, 11)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.types b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.types new file mode 100644 index 00000000000..0c051f80c45 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringObjectBindingPattern1.ts === + +var {x} = { x: 20 }; +>x : number +>{ x: 20 } : { x: number; } +>x : number +>20 : number + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.js b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.js new file mode 100644 index 00000000000..38cc7985925 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.js @@ -0,0 +1,9 @@ +//// [sourceMapValidationDestructuringObjectBindingPattern2.ts] + +var {x} = { x: 20 }; +var { a, b } = { a: 30, b: 40 }; + +//// [sourceMapValidationDestructuringObjectBindingPattern2.js] +var x = { x: 20 }.x; +var _a = { a: 30, b: 40 }, a = _a.a, b = _a.b; +//# sourceMappingURL=sourceMapValidationDestructuringObjectBindingPattern2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.js.map b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.js.map new file mode 100644 index 00000000000..af59ee6fae0 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringObjectBindingPattern2.js.map] +{"version":3,"file":"sourceMapValidationDestructuringObjectBindingPattern2.js","sourceRoot":"","sources":["sourceMapValidationDestructuringObjectBindingPattern2.ts"],"names":[],"mappings":"AACK,mBAAC,CAAc;AACpB,IAAA,qBAA+B,EAAzB,QAAC,EAAE,QAAC,CAAsB"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.sourcemap.txt new file mode 100644 index 00000000000..38dc23ba462 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.sourcemap.txt @@ -0,0 +1,52 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringObjectBindingPattern2.js +mapUrl: sourceMapValidationDestructuringObjectBindingPattern2.js.map +sourceRoot: +sources: sourceMapValidationDestructuringObjectBindingPattern2.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringObjectBindingPattern2.js +sourceFile:sourceMapValidationDestructuringObjectBindingPattern2.ts +------------------------------------------------------------------- +>>>var x = { x: 20 }.x; +1 > +2 >^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >var { +2 >x +3 > } = { x: 20 }; +1 >Emitted(1, 1) Source(2, 6) + SourceIndex(0) +2 >Emitted(1, 20) Source(2, 7) + SourceIndex(0) +3 >Emitted(1, 21) Source(2, 21) + SourceIndex(0) +--- +>>>var _a = { a: 30, b: 40 }, a = _a.a, b = _a.b; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^ +8 > ^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 > +3 > var { a, b } = { a: 30, b: 40 } +4 > +5 > a +6 > , +7 > b +8 > } = { a: 30, b: 40 }; +1->Emitted(2, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(3, 1) + SourceIndex(0) +3 >Emitted(2, 26) Source(3, 32) + SourceIndex(0) +4 >Emitted(2, 28) Source(3, 7) + SourceIndex(0) +5 >Emitted(2, 36) Source(3, 8) + SourceIndex(0) +6 >Emitted(2, 38) Source(3, 10) + SourceIndex(0) +7 >Emitted(2, 46) Source(3, 11) + SourceIndex(0) +8 >Emitted(2, 47) Source(3, 33) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringObjectBindingPattern2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.symbols b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.symbols new file mode 100644 index 00000000000..dcc213f135c --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.symbols @@ -0,0 +1,12 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringObjectBindingPattern2.ts === + +var {x} = { x: 20 }; +>x : Symbol(x, Decl(sourceMapValidationDestructuringObjectBindingPattern2.ts, 1, 5)) +>x : Symbol(x, Decl(sourceMapValidationDestructuringObjectBindingPattern2.ts, 1, 11)) + +var { a, b } = { a: 30, b: 40 }; +>a : Symbol(a, Decl(sourceMapValidationDestructuringObjectBindingPattern2.ts, 2, 5)) +>b : Symbol(b, Decl(sourceMapValidationDestructuringObjectBindingPattern2.ts, 2, 8)) +>a : Symbol(a, Decl(sourceMapValidationDestructuringObjectBindingPattern2.ts, 2, 16)) +>b : Symbol(b, Decl(sourceMapValidationDestructuringObjectBindingPattern2.ts, 2, 23)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.types b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.types new file mode 100644 index 00000000000..bbec608f686 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.types @@ -0,0 +1,17 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringObjectBindingPattern2.ts === + +var {x} = { x: 20 }; +>x : number +>{ x: 20 } : { x: number; } +>x : number +>20 : number + +var { a, b } = { a: 30, b: 40 }; +>a : number +>b : number +>{ a: 30, b: 40 } : { a: number; b: number; } +>a : number +>30 : number +>b : number +>40 : number + From d81565398801e83e41e4392d8f8f325e099611b0 Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Mon, 1 Feb 2016 09:45:27 -0800 Subject: [PATCH 03/15] Rename test cases so they are consistent with the rest --- ...tionDestructuringVariableStatementObjectBindingPattern1.ts | 3 +++ ...tionDestructuringVariableStatementObjectBindingPattern2.ts | 4 ++++ 2 files changed, 7 insertions(+) create mode 100644 tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.ts create mode 100644 tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.ts new file mode 100644 index 00000000000..80adb1cf0c1 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.ts @@ -0,0 +1,3 @@ +// @sourcemap: true + +var {x} = { x: 20 }; \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts new file mode 100644 index 00000000000..93465864cd6 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts @@ -0,0 +1,4 @@ +// @sourcemap: true + +var {x} = { x: 20 }; +var { a, b } = { a: 30, b: 40 }; \ No newline at end of file From c7bbda8a3e23c35c76d748b74d2136671ea88ed2 Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Mon, 1 Feb 2016 11:23:03 -0800 Subject: [PATCH 04/15] Remove old baselines --- ...ationDestructuringObjectBindingPattern1.js | 7 --- ...nDestructuringObjectBindingPattern1.js.map | 2 - ...cturingObjectBindingPattern1.sourcemap.txt | 24 --------- ...DestructuringObjectBindingPattern1.symbols | 6 --- ...onDestructuringObjectBindingPattern1.types | 8 --- ...ationDestructuringObjectBindingPattern2.js | 9 ---- ...nDestructuringObjectBindingPattern2.js.map | 2 - ...cturingObjectBindingPattern2.sourcemap.txt | 52 ------------------- ...DestructuringObjectBindingPattern2.symbols | 12 ----- ...onDestructuringObjectBindingPattern2.types | 17 ------ 10 files changed, 139 deletions(-) delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.js delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.js.map delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.sourcemap.txt delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.symbols delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.types delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.js delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.js.map delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.sourcemap.txt delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.symbols delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.types diff --git a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.js b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.js deleted file mode 100644 index c4e56eefe1e..00000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.js +++ /dev/null @@ -1,7 +0,0 @@ -//// [sourceMapValidationDestructuringObjectBindingPattern1.ts] - -var {x} = { x: 20 }; - -//// [sourceMapValidationDestructuringObjectBindingPattern1.js] -var x = { x: 20 }.x; -//# sourceMappingURL=sourceMapValidationDestructuringObjectBindingPattern1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.js.map b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.js.map deleted file mode 100644 index c428ab3f5fc..00000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.js.map +++ /dev/null @@ -1,2 +0,0 @@ -//// [sourceMapValidationDestructuringObjectBindingPattern1.js.map] -{"version":3,"file":"sourceMapValidationDestructuringObjectBindingPattern1.js","sourceRoot":"","sources":["sourceMapValidationDestructuringObjectBindingPattern1.ts"],"names":[],"mappings":"AACK,mBAAC,CAAc"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.sourcemap.txt deleted file mode 100644 index 5dd6c7410dd..00000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.sourcemap.txt +++ /dev/null @@ -1,24 +0,0 @@ -=================================================================== -JsFile: sourceMapValidationDestructuringObjectBindingPattern1.js -mapUrl: sourceMapValidationDestructuringObjectBindingPattern1.js.map -sourceRoot: -sources: sourceMapValidationDestructuringObjectBindingPattern1.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/sourceMapValidationDestructuringObjectBindingPattern1.js -sourceFile:sourceMapValidationDestructuringObjectBindingPattern1.ts -------------------------------------------------------------------- ->>>var x = { x: 20 }.x; -1 > -2 >^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - >var { -2 >x -3 > } = { x: 20 }; -1 >Emitted(1, 1) Source(2, 6) + SourceIndex(0) -2 >Emitted(1, 20) Source(2, 7) + SourceIndex(0) -3 >Emitted(1, 21) Source(2, 21) + SourceIndex(0) ---- ->>>//# sourceMappingURL=sourceMapValidationDestructuringObjectBindingPattern1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.symbols b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.symbols deleted file mode 100644 index b504acdb9b0..00000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.symbols +++ /dev/null @@ -1,6 +0,0 @@ -=== tests/cases/compiler/sourceMapValidationDestructuringObjectBindingPattern1.ts === - -var {x} = { x: 20 }; ->x : Symbol(x, Decl(sourceMapValidationDestructuringObjectBindingPattern1.ts, 1, 5)) ->x : Symbol(x, Decl(sourceMapValidationDestructuringObjectBindingPattern1.ts, 1, 11)) - diff --git a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.types b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.types deleted file mode 100644 index 0c051f80c45..00000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern1.types +++ /dev/null @@ -1,8 +0,0 @@ -=== tests/cases/compiler/sourceMapValidationDestructuringObjectBindingPattern1.ts === - -var {x} = { x: 20 }; ->x : number ->{ x: 20 } : { x: number; } ->x : number ->20 : number - diff --git a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.js b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.js deleted file mode 100644 index 38cc7985925..00000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.js +++ /dev/null @@ -1,9 +0,0 @@ -//// [sourceMapValidationDestructuringObjectBindingPattern2.ts] - -var {x} = { x: 20 }; -var { a, b } = { a: 30, b: 40 }; - -//// [sourceMapValidationDestructuringObjectBindingPattern2.js] -var x = { x: 20 }.x; -var _a = { a: 30, b: 40 }, a = _a.a, b = _a.b; -//# sourceMappingURL=sourceMapValidationDestructuringObjectBindingPattern2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.js.map b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.js.map deleted file mode 100644 index af59ee6fae0..00000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.js.map +++ /dev/null @@ -1,2 +0,0 @@ -//// [sourceMapValidationDestructuringObjectBindingPattern2.js.map] -{"version":3,"file":"sourceMapValidationDestructuringObjectBindingPattern2.js","sourceRoot":"","sources":["sourceMapValidationDestructuringObjectBindingPattern2.ts"],"names":[],"mappings":"AACK,mBAAC,CAAc;AACpB,IAAA,qBAA+B,EAAzB,QAAC,EAAE,QAAC,CAAsB"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.sourcemap.txt deleted file mode 100644 index 38dc23ba462..00000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.sourcemap.txt +++ /dev/null @@ -1,52 +0,0 @@ -=================================================================== -JsFile: sourceMapValidationDestructuringObjectBindingPattern2.js -mapUrl: sourceMapValidationDestructuringObjectBindingPattern2.js.map -sourceRoot: -sources: sourceMapValidationDestructuringObjectBindingPattern2.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:tests/cases/compiler/sourceMapValidationDestructuringObjectBindingPattern2.js -sourceFile:sourceMapValidationDestructuringObjectBindingPattern2.ts -------------------------------------------------------------------- ->>>var x = { x: 20 }.x; -1 > -2 >^^^^^^^^^^^^^^^^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - >var { -2 >x -3 > } = { x: 20 }; -1 >Emitted(1, 1) Source(2, 6) + SourceIndex(0) -2 >Emitted(1, 20) Source(2, 7) + SourceIndex(0) -3 >Emitted(1, 21) Source(2, 21) + SourceIndex(0) ---- ->>>var _a = { a: 30, b: 40 }, a = _a.a, b = _a.b; -1-> -2 >^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^ -4 > ^^ -5 > ^^^^^^^^ -6 > ^^ -7 > ^^^^^^^^ -8 > ^ -9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> - > -2 > -3 > var { a, b } = { a: 30, b: 40 } -4 > -5 > a -6 > , -7 > b -8 > } = { a: 30, b: 40 }; -1->Emitted(2, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(2, 5) Source(3, 1) + SourceIndex(0) -3 >Emitted(2, 26) Source(3, 32) + SourceIndex(0) -4 >Emitted(2, 28) Source(3, 7) + SourceIndex(0) -5 >Emitted(2, 36) Source(3, 8) + SourceIndex(0) -6 >Emitted(2, 38) Source(3, 10) + SourceIndex(0) -7 >Emitted(2, 46) Source(3, 11) + SourceIndex(0) -8 >Emitted(2, 47) Source(3, 33) + SourceIndex(0) ---- ->>>//# sourceMappingURL=sourceMapValidationDestructuringObjectBindingPattern2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.symbols b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.symbols deleted file mode 100644 index dcc213f135c..00000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.symbols +++ /dev/null @@ -1,12 +0,0 @@ -=== tests/cases/compiler/sourceMapValidationDestructuringObjectBindingPattern2.ts === - -var {x} = { x: 20 }; ->x : Symbol(x, Decl(sourceMapValidationDestructuringObjectBindingPattern2.ts, 1, 5)) ->x : Symbol(x, Decl(sourceMapValidationDestructuringObjectBindingPattern2.ts, 1, 11)) - -var { a, b } = { a: 30, b: 40 }; ->a : Symbol(a, Decl(sourceMapValidationDestructuringObjectBindingPattern2.ts, 2, 5)) ->b : Symbol(b, Decl(sourceMapValidationDestructuringObjectBindingPattern2.ts, 2, 8)) ->a : Symbol(a, Decl(sourceMapValidationDestructuringObjectBindingPattern2.ts, 2, 16)) ->b : Symbol(b, Decl(sourceMapValidationDestructuringObjectBindingPattern2.ts, 2, 23)) - diff --git a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.types b/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.types deleted file mode 100644 index bbec608f686..00000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringObjectBindingPattern2.types +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/compiler/sourceMapValidationDestructuringObjectBindingPattern2.ts === - -var {x} = { x: 20 }; ->x : number ->{ x: 20 } : { x: number; } ->x : number ->20 : number - -var { a, b } = { a: 30, b: 40 }; ->a : number ->b : number ->{ a: 30, b: 40 } : { a: number; b: number; } ->a : number ->30 : number ->b : number ->40 : number - From 0db90b786986c99770b35a280547f967153a7daa Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Mon, 1 Feb 2016 11:23:17 -0800 Subject: [PATCH 05/15] Add more tests and baselines --- ...ngVariableStatementArrayBindingPattern4.js | 7 +++ ...riableStatementArrayBindingPattern4.js.map | 2 + ...tatementArrayBindingPattern4.sourcemap.txt | 24 +++++++++ ...iableStatementArrayBindingPattern4.symbols | 5 ++ ...ariableStatementArrayBindingPattern4.types | 8 +++ ...ngVariableStatementArrayBindingPattern5.js | 9 ++++ ...riableStatementArrayBindingPattern5.js.map | 2 + ...tatementArrayBindingPattern5.sourcemap.txt | 52 +++++++++++++++++++ ...iableStatementArrayBindingPattern5.symbols | 9 ++++ ...ariableStatementArrayBindingPattern5.types | 15 ++++++ ...ngVariableStatementArrayBindingPattern6.js | 7 +++ ...riableStatementArrayBindingPattern6.js.map | 2 + ...tatementArrayBindingPattern6.sourcemap.txt | 30 +++++++++++ ...iableStatementArrayBindingPattern6.symbols | 5 ++ ...ariableStatementArrayBindingPattern6.types | 9 ++++ ...ngVariableStatementArrayBindingPattern7.js | 7 +++ ...riableStatementArrayBindingPattern7.js.map | 2 + ...tatementArrayBindingPattern7.sourcemap.txt | 45 ++++++++++++++++ ...iableStatementArrayBindingPattern7.symbols | 6 +++ ...ariableStatementArrayBindingPattern7.types | 10 ++++ ...gVariableStatementObjectBindingPattern1.js | 7 +++ ...iableStatementObjectBindingPattern1.js.map | 2 + ...atementObjectBindingPattern1.sourcemap.txt | 24 +++++++++ ...ableStatementObjectBindingPattern1.symbols | 6 +++ ...riableStatementObjectBindingPattern1.types | 8 +++ ...gVariableStatementObjectBindingPattern2.js | 9 ++++ ...iableStatementObjectBindingPattern2.js.map | 2 + ...atementObjectBindingPattern2.sourcemap.txt | 52 +++++++++++++++++++ ...ableStatementObjectBindingPattern2.symbols | 12 +++++ ...riableStatementObjectBindingPattern2.types | 17 ++++++ ...gVariableStatementObjectBindingPattern3.js | 7 +++ ...iableStatementObjectBindingPattern3.js.map | 2 + ...atementObjectBindingPattern3.sourcemap.txt | 30 +++++++++++ ...ableStatementObjectBindingPattern3.symbols | 6 +++ ...riableStatementObjectBindingPattern3.types | 9 ++++ ...gVariableStatementObjectBindingPattern4.js | 8 +++ ...iableStatementObjectBindingPattern4.js.map | 2 + ...atementObjectBindingPattern4.sourcemap.txt | 47 +++++++++++++++++ ...ableStatementObjectBindingPattern4.symbols | 10 ++++ ...riableStatementObjectBindingPattern4.types | 14 +++++ ...ngVariableStatementArrayBindingPattern4.ts | 3 ++ ...ngVariableStatementArrayBindingPattern5.ts | 4 ++ ...ngVariableStatementArrayBindingPattern6.ts | 3 ++ ...ngVariableStatementArrayBindingPattern7.ts | 3 ++ ...gVariableStatementObjectBindingPattern3.ts | 3 ++ ...gVariableStatementObjectBindingPattern4.ts | 4 ++ 46 files changed, 550 insertions(+) create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js.map create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.sourcemap.txt create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.symbols create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.types create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js.map create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.sourcemap.txt create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.symbols create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.types create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js.map create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.sourcemap.txt create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.symbols create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.types create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js.map create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.sourcemap.txt create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.symbols create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.types create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js.map create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.sourcemap.txt create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.symbols create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.types create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js.map create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.sourcemap.txt create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.symbols create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.types create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js.map create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.sourcemap.txt create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.symbols create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.types create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js.map create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.sourcemap.txt create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.symbols create mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.types create mode 100644 tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.ts create mode 100644 tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.ts create mode 100644 tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.ts create mode 100644 tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.ts create mode 100644 tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.ts create mode 100644 tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js new file mode 100644 index 00000000000..d4c419278c7 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js @@ -0,0 +1,7 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.ts] + +var [x] = [1, 2]; + +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js] +var x = [1, 2][0]; +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js.map new file mode 100644 index 00000000000..96fd86faa4e --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.ts"],"names":[],"mappings":"AACK,iBAAC,CAAW"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.sourcemap.txt new file mode 100644 index 00000000000..a52c7701db2 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.sourcemap.txt @@ -0,0 +1,24 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js +mapUrl: sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js +sourceFile:sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.ts +------------------------------------------------------------------- +>>>var x = [1, 2][0]; +1 > +2 >^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >var [ +2 >x +3 > ] = [1, 2]; +1 >Emitted(1, 1) Source(2, 6) + SourceIndex(0) +2 >Emitted(1, 18) Source(2, 7) + SourceIndex(0) +3 >Emitted(1, 19) Source(2, 18) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.symbols new file mode 100644 index 00000000000..4695a8cd598 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.symbols @@ -0,0 +1,5 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.ts === + +var [x] = [1, 2]; +>x : Symbol(x, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.ts, 1, 5)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.types new file mode 100644 index 00000000000..461939a11aa --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.ts === + +var [x] = [1, 2]; +>x : number +>[1, 2] : [number, number] +>1 : number +>2 : number + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js new file mode 100644 index 00000000000..10df853c220 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js @@ -0,0 +1,9 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.ts] + +var [x] = [1, 2]; +var [y, z] = [1, 2]; + +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js] +var x = [1, 2][0]; +var _a = [1, 2], y = _a[0], z = _a[1]; +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js.map new file mode 100644 index 00000000000..337a73240b9 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.ts"],"names":[],"mappings":"AACK,iBAAC,CAAW;AACjB,IAAA,WAAmB,EAAd,SAAC,EAAE,SAAC,CAAW"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.sourcemap.txt new file mode 100644 index 00000000000..338b6424185 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.sourcemap.txt @@ -0,0 +1,52 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js +mapUrl: sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js +sourceFile:sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.ts +------------------------------------------------------------------- +>>>var x = [1, 2][0]; +1 > +2 >^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^-> +1 > + >var [ +2 >x +3 > ] = [1, 2]; +1 >Emitted(1, 1) Source(2, 6) + SourceIndex(0) +2 >Emitted(1, 18) Source(2, 7) + SourceIndex(0) +3 >Emitted(1, 19) Source(2, 18) + SourceIndex(0) +--- +>>>var _a = [1, 2], y = _a[0], z = _a[1]; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^ +8 > ^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 > +3 > var [y, z] = [1, 2] +4 > +5 > y +6 > , +7 > z +8 > ] = [1, 2]; +1->Emitted(2, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(3, 1) + SourceIndex(0) +3 >Emitted(2, 16) Source(3, 20) + SourceIndex(0) +4 >Emitted(2, 18) Source(3, 6) + SourceIndex(0) +5 >Emitted(2, 27) Source(3, 7) + SourceIndex(0) +6 >Emitted(2, 29) Source(3, 9) + SourceIndex(0) +7 >Emitted(2, 38) Source(3, 10) + SourceIndex(0) +8 >Emitted(2, 39) Source(3, 21) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.symbols new file mode 100644 index 00000000000..59543290772 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.symbols @@ -0,0 +1,9 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.ts === + +var [x] = [1, 2]; +>x : Symbol(x, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.ts, 1, 5)) + +var [y, z] = [1, 2]; +>y : Symbol(y, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.ts, 2, 5)) +>z : Symbol(z, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.ts, 2, 7)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.types new file mode 100644 index 00000000000..1ef747517e4 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.ts === + +var [x] = [1, 2]; +>x : number +>[1, 2] : [number, number] +>1 : number +>2 : number + +var [y, z] = [1, 2]; +>y : number +>z : number +>[1, 2] : [number, number] +>1 : number +>2 : number + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js new file mode 100644 index 00000000000..d4baadb6562 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js @@ -0,0 +1,7 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.ts] + +var [x = 20] = [1, 2]; + +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js] +var _a = [1, 2][0], x = _a === void 0 ? 20 : _a; +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js.map new file mode 100644 index 00000000000..9594cc22809 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.ts"],"names":[],"mappings":"AACK,kBAAM,EAAN,2BAAM,CAAW"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.sourcemap.txt new file mode 100644 index 00000000000..90ebe4dc9ac --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.sourcemap.txt @@ -0,0 +1,30 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js +mapUrl: sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js +sourceFile:sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.ts +------------------------------------------------------------------- +>>>var _a = [1, 2][0], x = _a === void 0 ? 20 : _a; +1 > +2 >^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >var [ +2 >x = 20 +3 > +4 > x = 20 +5 > ] = [1, 2]; +1 >Emitted(1, 1) Source(2, 6) + SourceIndex(0) +2 >Emitted(1, 19) Source(2, 12) + SourceIndex(0) +3 >Emitted(1, 21) Source(2, 6) + SourceIndex(0) +4 >Emitted(1, 48) Source(2, 12) + SourceIndex(0) +5 >Emitted(1, 49) Source(2, 23) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.symbols new file mode 100644 index 00000000000..6c368f4996e --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.symbols @@ -0,0 +1,5 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.ts === + +var [x = 20] = [1, 2]; +>x : Symbol(x, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.ts, 1, 5)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.types new file mode 100644 index 00000000000..1b94874ae7c --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.ts === + +var [x = 20] = [1, 2]; +>x : number +>20 : number +>[1, 2] : [number, number] +>1 : number +>2 : number + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js new file mode 100644 index 00000000000..73d2e85e9da --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js @@ -0,0 +1,7 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.ts] + +var [x = 20, j] = [1, 2]; + +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js] +var _a = [1, 2], _b = _a[0], x = _b === void 0 ? 20 : _b, j = _a[1]; +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js.map new file mode 100644 index 00000000000..0def6b1a730 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.ts"],"names":[],"mappings":"AACA,IAAA,WAAwB,EAAnB,UAAM,EAAN,2BAAM,EAAE,SAAC,CAAW"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.sourcemap.txt new file mode 100644 index 00000000000..f2a95375f2a --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.sourcemap.txt @@ -0,0 +1,45 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js +mapUrl: sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js +sourceFile:sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.ts +------------------------------------------------------------------- +>>>var _a = [1, 2], _b = _a[0], x = _b === void 0 ? 20 : _b, j = _a[1]; +1 > +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^ +10> ^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > +3 > var [x = 20, j] = [1, 2] +4 > +5 > x = 20 +6 > +7 > x = 20 +8 > , +9 > j +10> ] = [1, 2]; +1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(2, 1) + SourceIndex(0) +3 >Emitted(1, 16) Source(2, 25) + SourceIndex(0) +4 >Emitted(1, 18) Source(2, 6) + SourceIndex(0) +5 >Emitted(1, 28) Source(2, 12) + SourceIndex(0) +6 >Emitted(1, 30) Source(2, 6) + SourceIndex(0) +7 >Emitted(1, 57) Source(2, 12) + SourceIndex(0) +8 >Emitted(1, 59) Source(2, 14) + SourceIndex(0) +9 >Emitted(1, 68) Source(2, 15) + SourceIndex(0) +10>Emitted(1, 69) Source(2, 26) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.symbols new file mode 100644 index 00000000000..4f57dffff26 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.symbols @@ -0,0 +1,6 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.ts === + +var [x = 20, j] = [1, 2]; +>x : Symbol(x, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.ts, 1, 5)) +>j : Symbol(j, Decl(sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.ts, 1, 12)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.types new file mode 100644 index 00000000000..9b369e410a4 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.ts === + +var [x = 20, j] = [1, 2]; +>x : number +>20 : number +>j : number +>[1, 2] : [number, number] +>1 : number +>2 : number + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js new file mode 100644 index 00000000000..8259981857c --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js @@ -0,0 +1,7 @@ +//// [sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.ts] + +var {x} = { x: 20 }; + +//// [sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js] +var x = { x: 20 }.x; +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js.map new file mode 100644 index 00000000000..5ecd5985927 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.ts"],"names":[],"mappings":"AACK,mBAAC,CAAc"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.sourcemap.txt new file mode 100644 index 00000000000..8e5860c7a77 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.sourcemap.txt @@ -0,0 +1,24 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js +mapUrl: sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js +sourceFile:sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.ts +------------------------------------------------------------------- +>>>var x = { x: 20 }.x; +1 > +2 >^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >var { +2 >x +3 > } = { x: 20 }; +1 >Emitted(1, 1) Source(2, 6) + SourceIndex(0) +2 >Emitted(1, 20) Source(2, 7) + SourceIndex(0) +3 >Emitted(1, 21) Source(2, 21) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.symbols new file mode 100644 index 00000000000..950fca4eb00 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.symbols @@ -0,0 +1,6 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.ts === + +var {x} = { x: 20 }; +>x : Symbol(x, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.ts, 1, 5)) +>x : Symbol(x, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.ts, 1, 11)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.types new file mode 100644 index 00000000000..c975a9eaae5 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern1.ts === + +var {x} = { x: 20 }; +>x : number +>{ x: 20 } : { x: number; } +>x : number +>20 : number + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js new file mode 100644 index 00000000000..d4d52e5e8d9 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js @@ -0,0 +1,9 @@ +//// [sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts] + +var {x} = { x: 20 }; +var { a, b } = { a: 30, b: 40 }; + +//// [sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js] +var x = { x: 20 }.x; +var _a = { a: 30, b: 40 }, a = _a.a, b = _a.b; +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js.map new file mode 100644 index 00000000000..6d3a8b40d22 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts"],"names":[],"mappings":"AACK,mBAAC,CAAc;AACpB,IAAA,qBAA+B,EAAzB,QAAC,EAAE,QAAC,CAAsB"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.sourcemap.txt new file mode 100644 index 00000000000..e9454cb2bfa --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.sourcemap.txt @@ -0,0 +1,52 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js +mapUrl: sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js +sourceFile:sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts +------------------------------------------------------------------- +>>>var x = { x: 20 }.x; +1 > +2 >^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >var { +2 >x +3 > } = { x: 20 }; +1 >Emitted(1, 1) Source(2, 6) + SourceIndex(0) +2 >Emitted(1, 20) Source(2, 7) + SourceIndex(0) +3 >Emitted(1, 21) Source(2, 21) + SourceIndex(0) +--- +>>>var _a = { a: 30, b: 40 }, a = _a.a, b = _a.b; +1-> +2 >^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^ +8 > ^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 > +3 > var { a, b } = { a: 30, b: 40 } +4 > +5 > a +6 > , +7 > b +8 > } = { a: 30, b: 40 }; +1->Emitted(2, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(3, 1) + SourceIndex(0) +3 >Emitted(2, 26) Source(3, 32) + SourceIndex(0) +4 >Emitted(2, 28) Source(3, 7) + SourceIndex(0) +5 >Emitted(2, 36) Source(3, 8) + SourceIndex(0) +6 >Emitted(2, 38) Source(3, 10) + SourceIndex(0) +7 >Emitted(2, 46) Source(3, 11) + SourceIndex(0) +8 >Emitted(2, 47) Source(3, 33) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.symbols new file mode 100644 index 00000000000..4fa80ecf05e --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.symbols @@ -0,0 +1,12 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts === + +var {x} = { x: 20 }; +>x : Symbol(x, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts, 1, 5)) +>x : Symbol(x, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts, 1, 11)) + +var { a, b } = { a: 30, b: 40 }; +>a : Symbol(a, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts, 2, 5)) +>b : Symbol(b, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts, 2, 8)) +>a : Symbol(a, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts, 2, 16)) +>b : Symbol(b, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts, 2, 23)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.types new file mode 100644 index 00000000000..a694d4ecd29 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.types @@ -0,0 +1,17 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern2.ts === + +var {x} = { x: 20 }; +>x : number +>{ x: 20 } : { x: number; } +>x : number +>20 : number + +var { a, b } = { a: 30, b: 40 }; +>a : number +>b : number +>{ a: 30, b: 40 } : { a: number; b: number; } +>a : number +>30 : number +>b : number +>40 : number + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js new file mode 100644 index 00000000000..f146e4bb8a7 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js @@ -0,0 +1,7 @@ +//// [sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.ts] + +var {x = 500} = { x: 20 }; + +//// [sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js] +var _a = { x: 20 }.x, x = _a === void 0 ? 500 : _a; +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js.map new file mode 100644 index 00000000000..975a48aa0ee --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.ts"],"names":[],"mappings":"AACK,oBAAO,EAAP,4BAAO,CAAc"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.sourcemap.txt new file mode 100644 index 00000000000..2fa0c81199b --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.sourcemap.txt @@ -0,0 +1,30 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js +mapUrl: sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js +sourceFile:sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.ts +------------------------------------------------------------------- +>>>var _a = { x: 20 }.x, x = _a === void 0 ? 500 : _a; +1 > +2 >^^^^^^^^^^^^^^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >var { +2 >x = 500 +3 > +4 > x = 500 +5 > } = { x: 20 }; +1 >Emitted(1, 1) Source(2, 6) + SourceIndex(0) +2 >Emitted(1, 21) Source(2, 13) + SourceIndex(0) +3 >Emitted(1, 23) Source(2, 6) + SourceIndex(0) +4 >Emitted(1, 51) Source(2, 13) + SourceIndex(0) +5 >Emitted(1, 52) Source(2, 27) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.symbols new file mode 100644 index 00000000000..a668ab8e733 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.symbols @@ -0,0 +1,6 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.ts === + +var {x = 500} = { x: 20 }; +>x : Symbol(x, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.ts, 1, 5)) +>x : Symbol(x, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.ts, 1, 17)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.types new file mode 100644 index 00000000000..bec1b195c98 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.ts === + +var {x = 500} = { x: 20 }; +>x : number +>500 : number +>{ x: 20 } : { x?: number; } +>x : number +>20 : number + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js new file mode 100644 index 00000000000..d785d2dd1fd --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js @@ -0,0 +1,8 @@ +//// [sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts] + +var {x = 500, + y} = { x: 20, y: "hi" }; + +//// [sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js] +var _a = { x: 20, y: "hi" }, _b = _a.x, x = _b === void 0 ? 500 : _b, y = _a.y; +//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js.map b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js.map new file mode 100644 index 00000000000..e0b108863b0 --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js.map @@ -0,0 +1,2 @@ +//// [sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js.map] +{"version":3,"file":"sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js","sourceRoot":"","sources":["sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts"],"names":[],"mappings":"AACA,IAAA,uBAC4B,EADvB,SAAO,EAAP,4BAAO,EACP,QAAC,CAAuB"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.sourcemap.txt new file mode 100644 index 00000000000..6ae979f8ade --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.sourcemap.txt @@ -0,0 +1,47 @@ +=================================================================== +JsFile: sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js +mapUrl: sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js.map +sourceRoot: +sources: sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js +sourceFile:sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts +------------------------------------------------------------------- +>>>var _a = { x: 20, y: "hi" }, _b = _a.x, x = _b === void 0 ? 500 : _b, y = _a.y; +1 > +2 >^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^ +10> ^ +11> ^^^^^^^^^^^^^^^^^^-> +1 > + > +2 > +3 > var {x = 500, + > y} = { x: 20, y: "hi" } +4 > +5 > x = 500 +6 > +7 > x = 500 +8 > , + > +9 > y +10> } = { x: 20, y: "hi" }; +1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(2, 1) + SourceIndex(0) +3 >Emitted(1, 28) Source(3, 29) + SourceIndex(0) +4 >Emitted(1, 30) Source(2, 6) + SourceIndex(0) +5 >Emitted(1, 39) Source(2, 13) + SourceIndex(0) +6 >Emitted(1, 41) Source(2, 6) + SourceIndex(0) +7 >Emitted(1, 69) Source(2, 13) + SourceIndex(0) +8 >Emitted(1, 71) Source(3, 6) + SourceIndex(0) +9 >Emitted(1, 79) Source(3, 7) + SourceIndex(0) +10>Emitted(1, 80) Source(3, 30) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.symbols b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.symbols new file mode 100644 index 00000000000..8404c342c0b --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.symbols @@ -0,0 +1,10 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts === + +var {x = 500, +>x : Symbol(x, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts, 1, 5)) + + y} = { x: 20, y: "hi" }; +>y : Symbol(y, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts, 1, 13)) +>x : Symbol(x, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts, 2, 11)) +>y : Symbol(y, Decl(sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts, 2, 18)) + diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.types new file mode 100644 index 00000000000..1d00ac2d56b --- /dev/null +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.types @@ -0,0 +1,14 @@ +=== tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts === + +var {x = 500, +>x : number +>500 : number + + y} = { x: 20, y: "hi" }; +>y : string +>{ x: 20, y: "hi" } : { x?: number; y: string; } +>x : number +>20 : number +>y : string +>"hi" : string + diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.ts new file mode 100644 index 00000000000..da41b8ca49f --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern4.ts @@ -0,0 +1,3 @@ +// @sourcemap: true + +var [x] = [1, 2]; \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.ts new file mode 100644 index 00000000000..8e9d05fadd5 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern5.ts @@ -0,0 +1,4 @@ +// @sourcemap: true + +var [x] = [1, 2]; +var [y, z] = [1, 2]; \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.ts new file mode 100644 index 00000000000..6c3ea7bedd7 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern6.ts @@ -0,0 +1,3 @@ +// @sourcemap: true + +var [x = 20] = [1, 2]; \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.ts new file mode 100644 index 00000000000..d9d91eb578b --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementArrayBindingPattern7.ts @@ -0,0 +1,3 @@ +// @sourcemap: true + +var [x = 20, j] = [1, 2]; \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.ts new file mode 100644 index 00000000000..5af6b55272f --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern3.ts @@ -0,0 +1,3 @@ +// @sourcemap: true + +var {x = 500} = { x: 20 }; \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts new file mode 100644 index 00000000000..e0afcb60c27 --- /dev/null +++ b/tests/cases/compiler/sourceMapValidationDestructuringVariableStatementObjectBindingPattern4.ts @@ -0,0 +1,4 @@ +// @sourcemap: true + +var {x = 500, + y} = { x: 20, y: "hi" }; \ No newline at end of file From c89f2b75ad7e7557a6df33918b62ede8b149fce4 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 2 Feb 2016 14:14:37 -0800 Subject: [PATCH 06/15] Properly parse function/constructor types with destructuring parameters --- src/compiler/parser.ts | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 4ec83277e3e..77f50a9bd87 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2450,10 +2450,27 @@ namespace ts { if (token === SyntaxKind.LessThanToken) { return true; } - return token === SyntaxKind.OpenParenToken && lookAhead(isUnambiguouslyStartOfFunctionType); } + function skipParameterStart(): boolean { + if (isModifierKind(token)) { + // Skip modifiers + parseModifiers(); + } + if (isIdentifier()) { + nextToken(); + return true; + } + if (token === SyntaxKind.OpenBracketToken || token === SyntaxKind.OpenBraceToken) { + // Return true if we can parse an array or object binding pattern with no errors + const count = parseDiagnostics.length; + parseIdentifierOrPattern(); + return count === parseDiagnostics.length; + } + return false; + } + function isUnambiguouslyStartOfFunctionType() { nextToken(); if (token === SyntaxKind.CloseParenToken || token === SyntaxKind.DotDotDotToken) { @@ -2461,16 +2478,15 @@ namespace ts { // ( ... return true; } - if (isIdentifier() || isModifierKind(token)) { - nextToken(); + if (skipParameterStart()) { + // We successfully skipped modifiers (if any) and an identifier or binding pattern, + // now see if we have something that indicates a parameter declaration if (token === SyntaxKind.ColonToken || token === SyntaxKind.CommaToken || - token === SyntaxKind.QuestionToken || token === SyntaxKind.EqualsToken || - isIdentifier() || isModifierKind(token)) { - // ( id : - // ( id , - // ( id ? - // ( id = - // ( modifier id + token === SyntaxKind.QuestionToken || token === SyntaxKind.EqualsToken) { + // ( xxx : + // ( xxx , + // ( xxx ? + // ( xxx = return true; } if (token === SyntaxKind.CloseParenToken) { From 5643f911c7a63be09cb574840d444fea1e3f9a4f Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 2 Feb 2016 14:14:55 -0800 Subject: [PATCH 07/15] Adding test --- .../destructuringInFunctionType.ts | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/cases/conformance/es6/destructuring/destructuringInFunctionType.ts diff --git a/tests/cases/conformance/es6/destructuring/destructuringInFunctionType.ts b/tests/cases/conformance/es6/destructuring/destructuringInFunctionType.ts new file mode 100644 index 00000000000..51333b1ca53 --- /dev/null +++ b/tests/cases/conformance/es6/destructuring/destructuringInFunctionType.ts @@ -0,0 +1,22 @@ +// @declaration: true + +interface a { a } +interface b { b } +interface c { c } + +type T1 = ([a, b, c]); +type F1 = ([a, b, c]) => void; + +type T2 = ({ a }); +type F2 = ({ a }) => void; + +type T3 = ([{ a: b }, { b: a }]); +type F3 = ([{ a: b }, { b: a }]) => void; + +type T4 = ([{ a: [b, c] }]); +type F4 = ([{ a: [b, c] }]) => void; + +type C1 = new ([{ a: [b, c] }]) => void; + +var v1 = ([a, b, c]) => "hello"; +var v2: ([a, b, c]) => string; From 979186fad9a6e28a4f1fb8446621a0e88343e9fa Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 2 Feb 2016 14:15:26 -0800 Subject: [PATCH 08/15] Accepting new baselines --- .../reference/destructuringInFunctionType.js | 61 ++++++++++++++ .../destructuringInFunctionType.symbols | 78 ++++++++++++++++++ .../destructuringInFunctionType.types | 80 +++++++++++++++++++ 3 files changed, 219 insertions(+) create mode 100644 tests/baselines/reference/destructuringInFunctionType.js create mode 100644 tests/baselines/reference/destructuringInFunctionType.symbols create mode 100644 tests/baselines/reference/destructuringInFunctionType.types diff --git a/tests/baselines/reference/destructuringInFunctionType.js b/tests/baselines/reference/destructuringInFunctionType.js new file mode 100644 index 00000000000..ac187f5b43d --- /dev/null +++ b/tests/baselines/reference/destructuringInFunctionType.js @@ -0,0 +1,61 @@ +//// [destructuringInFunctionType.ts] + +interface a { a } +interface b { b } +interface c { c } + +type T1 = ([a, b, c]); +type F1 = ([a, b, c]) => void; + +type T2 = ({ a }); +type F2 = ({ a }) => void; + +type T3 = ([{ a: b }, { b: a }]); +type F3 = ([{ a: b }, { b: a }]) => void; + +type T4 = ([{ a: [b, c] }]); +type F4 = ([{ a: [b, c] }]) => void; + +type C1 = new ([{ a: [b, c] }]) => void; + +var v1 = ([a, b, c]) => "hello"; +var v2: ([a, b, c]) => string; + + +//// [destructuringInFunctionType.js] +var v1 = function (_a) { + var a = _a[0], b = _a[1], c = _a[2]; + return "hello"; +}; +var v2; + + +//// [destructuringInFunctionType.d.ts] +interface a { + a: any; +} +interface b { + b: any; +} +interface c { + c: any; +} +declare type T1 = ([a, b, c]); +declare type F1 = ([a, b, c]) => void; +declare type T2 = ({ + a; +}); +declare type F2 = ({a}) => void; +declare type T3 = ([{ + a: b; +}, { + b: a; +}]); +declare type F3 = ([{a: b}, {b: a}]) => void; +declare type T4 = ([{ + a: [b, c]; +}]); +declare type F4 = ([{a: [b, c]}]) => void; +declare type C1 = new ([{a: [b, c]}]) => void; +declare var v1: ([a, b, c]: [any, any, any]) => string; +declare var v2: ([a, b, c]) => string; diff --git a/tests/baselines/reference/destructuringInFunctionType.symbols b/tests/baselines/reference/destructuringInFunctionType.symbols new file mode 100644 index 00000000000..8b573905b76 --- /dev/null +++ b/tests/baselines/reference/destructuringInFunctionType.symbols @@ -0,0 +1,78 @@ +=== tests/cases/conformance/es6/destructuring/destructuringInFunctionType.ts === + +interface a { a } +>a : Symbol(a, Decl(destructuringInFunctionType.ts, 0, 0)) +>a : Symbol(a, Decl(destructuringInFunctionType.ts, 1, 13)) + +interface b { b } +>b : Symbol(b, Decl(destructuringInFunctionType.ts, 1, 17)) +>b : Symbol(b, Decl(destructuringInFunctionType.ts, 2, 13)) + +interface c { c } +>c : Symbol(c, Decl(destructuringInFunctionType.ts, 2, 17)) +>c : Symbol(c, Decl(destructuringInFunctionType.ts, 3, 13)) + +type T1 = ([a, b, c]); +>T1 : Symbol(T1, Decl(destructuringInFunctionType.ts, 3, 17)) +>a : Symbol(a, Decl(destructuringInFunctionType.ts, 0, 0)) +>b : Symbol(b, Decl(destructuringInFunctionType.ts, 1, 17)) +>c : Symbol(c, Decl(destructuringInFunctionType.ts, 2, 17)) + +type F1 = ([a, b, c]) => void; +>F1 : Symbol(F1, Decl(destructuringInFunctionType.ts, 5, 22)) +>a : Symbol(a, Decl(destructuringInFunctionType.ts, 6, 12)) +>b : Symbol(b, Decl(destructuringInFunctionType.ts, 6, 14)) +>c : Symbol(c, Decl(destructuringInFunctionType.ts, 6, 17)) + +type T2 = ({ a }); +>T2 : Symbol(T2, Decl(destructuringInFunctionType.ts, 6, 30)) +>a : Symbol(a, Decl(destructuringInFunctionType.ts, 8, 12)) + +type F2 = ({ a }) => void; +>F2 : Symbol(F2, Decl(destructuringInFunctionType.ts, 8, 18)) +>a : Symbol(a, Decl(destructuringInFunctionType.ts, 9, 12)) + +type T3 = ([{ a: b }, { b: a }]); +>T3 : Symbol(T3, Decl(destructuringInFunctionType.ts, 9, 26)) +>a : Symbol(a, Decl(destructuringInFunctionType.ts, 11, 13)) +>b : Symbol(b, Decl(destructuringInFunctionType.ts, 1, 17)) +>b : Symbol(b, Decl(destructuringInFunctionType.ts, 11, 23)) +>a : Symbol(a, Decl(destructuringInFunctionType.ts, 0, 0)) + +type F3 = ([{ a: b }, { b: a }]) => void; +>F3 : Symbol(F3, Decl(destructuringInFunctionType.ts, 11, 33)) +>a : Symbol(a) +>b : Symbol(b, Decl(destructuringInFunctionType.ts, 12, 13)) +>b : Symbol(b) +>a : Symbol(a, Decl(destructuringInFunctionType.ts, 12, 23)) + +type T4 = ([{ a: [b, c] }]); +>T4 : Symbol(T4, Decl(destructuringInFunctionType.ts, 12, 41)) +>a : Symbol(a, Decl(destructuringInFunctionType.ts, 14, 13)) +>b : Symbol(b, Decl(destructuringInFunctionType.ts, 1, 17)) +>c : Symbol(c, Decl(destructuringInFunctionType.ts, 2, 17)) + +type F4 = ([{ a: [b, c] }]) => void; +>F4 : Symbol(F4, Decl(destructuringInFunctionType.ts, 14, 28)) +>a : Symbol(a) +>b : Symbol(b, Decl(destructuringInFunctionType.ts, 15, 18)) +>c : Symbol(c, Decl(destructuringInFunctionType.ts, 15, 20)) + +type C1 = new ([{ a: [b, c] }]) => void; +>C1 : Symbol(C1, Decl(destructuringInFunctionType.ts, 15, 36)) +>a : Symbol(a) +>b : Symbol(b, Decl(destructuringInFunctionType.ts, 17, 22)) +>c : Symbol(c, Decl(destructuringInFunctionType.ts, 17, 24)) + +var v1 = ([a, b, c]) => "hello"; +>v1 : Symbol(v1, Decl(destructuringInFunctionType.ts, 19, 3)) +>a : Symbol(a, Decl(destructuringInFunctionType.ts, 19, 11)) +>b : Symbol(b, Decl(destructuringInFunctionType.ts, 19, 13)) +>c : Symbol(c, Decl(destructuringInFunctionType.ts, 19, 16)) + +var v2: ([a, b, c]) => string; +>v2 : Symbol(v2, Decl(destructuringInFunctionType.ts, 20, 3)) +>a : Symbol(a, Decl(destructuringInFunctionType.ts, 20, 10)) +>b : Symbol(b, Decl(destructuringInFunctionType.ts, 20, 12)) +>c : Symbol(c, Decl(destructuringInFunctionType.ts, 20, 15)) + diff --git a/tests/baselines/reference/destructuringInFunctionType.types b/tests/baselines/reference/destructuringInFunctionType.types new file mode 100644 index 00000000000..8786bbd0bb9 --- /dev/null +++ b/tests/baselines/reference/destructuringInFunctionType.types @@ -0,0 +1,80 @@ +=== tests/cases/conformance/es6/destructuring/destructuringInFunctionType.ts === + +interface a { a } +>a : a +>a : any + +interface b { b } +>b : b +>b : any + +interface c { c } +>c : c +>c : any + +type T1 = ([a, b, c]); +>T1 : [a, b, c] +>a : a +>b : b +>c : c + +type F1 = ([a, b, c]) => void; +>F1 : ([a, b, c]: [any, any, any]) => void +>a : any +>b : any +>c : any + +type T2 = ({ a }); +>T2 : { a: any; } +>a : any + +type F2 = ({ a }) => void; +>F2 : ({ a }: { a: any; }) => void +>a : any + +type T3 = ([{ a: b }, { b: a }]); +>T3 : [{ a: b; }, { b: a; }] +>a : b +>b : b +>b : a +>a : a + +type F3 = ([{ a: b }, { b: a }]) => void; +>F3 : ([{ a: b }, { b: a }]: [{ a: any; }, { b: any; }]) => void +>a : any +>b : any +>b : any +>a : any + +type T4 = ([{ a: [b, c] }]); +>T4 : [{ a: [b, c]; }] +>a : [b, c] +>b : b +>c : c + +type F4 = ([{ a: [b, c] }]) => void; +>F4 : ([{ a: [b, c] }]: [{ a: [any, any]; }]) => void +>a : any +>b : any +>c : any + +type C1 = new ([{ a: [b, c] }]) => void; +>C1 : new ([{ a: [b, c] }]: [{ a: [any, any]; }]) => void +>a : any +>b : any +>c : any + +var v1 = ([a, b, c]) => "hello"; +>v1 : ([a, b, c]: [any, any, any]) => string +>([a, b, c]) => "hello" : ([a, b, c]: [any, any, any]) => string +>a : any +>b : any +>c : any +>"hello" : string + +var v2: ([a, b, c]) => string; +>v2 : ([a, b, c]: [any, any, any]) => string +>a : any +>b : any +>c : any + From 9582342b9035229f0c248340158613d54841d340 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 2 Feb 2016 17:53:42 -0800 Subject: [PATCH 09/15] Remove unused error message --- src/compiler/diagnosticMessages.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index c848ebc3a10..93872e35aae 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1279,10 +1279,6 @@ "category": "Error", "code": 2417 }, - "Type name '{0}' in extends clause does not reference constructor function for '{0}'.": { - "category": "Error", - "code": 2419 - }, "Class '{0}' incorrectly implements interface '{1}'.": { "category": "Error", "code": 2420 From a0782d91ac4e771dc8d24c9eeed795a79a0066bf Mon Sep 17 00:00:00 2001 From: york yao Date: Wed, 3 Feb 2016 10:02:59 +0800 Subject: [PATCH 10/15] fix error message with public class inside namespace --- src/compiler/checker.ts | 4 +- src/compiler/diagnosticMessages.json | 2 +- .../baselines/reference/Protected1.errors.txt | 4 +- .../baselines/reference/Protected2.errors.txt | 4 +- .../importDeclWithClassModifiers.errors.txt | 12 +-- ...ModuleWithStatementsOfEveryKind.errors.txt | 84 +++++++++---------- .../invalidModuleWithVarStatements.errors.txt | 24 +++--- .../parserInterfaceDeclaration3.errors.txt | 4 +- .../parserInterfaceDeclaration4.errors.txt | 4 +- 9 files changed, 71 insertions(+), 71 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 07ec5023d5b..0628e7fd522 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -16214,7 +16214,7 @@ namespace ts { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } else if (node.parent.kind === SyntaxKind.ModuleBlock || node.parent.kind === SyntaxKind.SourceFile) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & NodeFlags.Abstract) { if (modifier.kind === SyntaxKind.PrivateKeyword) { @@ -16238,7 +16238,7 @@ namespace ts { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } else if (node.parent.kind === SyntaxKind.ModuleBlock || node.parent.kind === SyntaxKind.SourceFile) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } else if (node.kind === SyntaxKind.Parameter) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index c848ebc3a10..c9329af6494 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -123,7 +123,7 @@ "category": "Error", "code": 1043 }, - "'{0}' modifier cannot appear on a module element.": { + "'{0}' modifier cannot appear on a module or namespace element.": { "category": "Error", "code": 1044 }, diff --git a/tests/baselines/reference/Protected1.errors.txt b/tests/baselines/reference/Protected1.errors.txt index 561e4cfd001..157c9b3263e 100644 --- a/tests/baselines/reference/Protected1.errors.txt +++ b/tests/baselines/reference/Protected1.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Protected/Protected1.ts(1,1): error TS1044: 'protected' modifier cannot appear on a module element. +tests/cases/conformance/parser/ecmascript5/Protected/Protected1.ts(1,1): error TS1044: 'protected' modifier cannot appear on a module or namespace element. ==== tests/cases/conformance/parser/ecmascript5/Protected/Protected1.ts (1 errors) ==== protected class C { ~~~~~~~~~ -!!! error TS1044: 'protected' modifier cannot appear on a module element. +!!! error TS1044: 'protected' modifier cannot appear on a module or namespace element. } \ No newline at end of file diff --git a/tests/baselines/reference/Protected2.errors.txt b/tests/baselines/reference/Protected2.errors.txt index 0f6de4d49ed..7779cb55348 100644 --- a/tests/baselines/reference/Protected2.errors.txt +++ b/tests/baselines/reference/Protected2.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Protected/Protected2.ts(1,1): error TS1044: 'protected' modifier cannot appear on a module element. +tests/cases/conformance/parser/ecmascript5/Protected/Protected2.ts(1,1): error TS1044: 'protected' modifier cannot appear on a module or namespace element. ==== tests/cases/conformance/parser/ecmascript5/Protected/Protected2.ts (1 errors) ==== protected module M { ~~~~~~~~~ -!!! error TS1044: 'protected' modifier cannot appear on a module element. +!!! error TS1044: 'protected' modifier cannot appear on a module or namespace element. } \ No newline at end of file diff --git a/tests/baselines/reference/importDeclWithClassModifiers.errors.txt b/tests/baselines/reference/importDeclWithClassModifiers.errors.txt index b7f60881e6e..586eac79b12 100644 --- a/tests/baselines/reference/importDeclWithClassModifiers.errors.txt +++ b/tests/baselines/reference/importDeclWithClassModifiers.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/importDeclWithClassModifiers.ts(5,8): error TS1044: 'public' modifier cannot appear on a module element. +tests/cases/compiler/importDeclWithClassModifiers.ts(5,8): error TS1044: 'public' modifier cannot appear on a module or namespace element. tests/cases/compiler/importDeclWithClassModifiers.ts(5,28): error TS2305: Module 'x' has no exported member 'c'. -tests/cases/compiler/importDeclWithClassModifiers.ts(6,8): error TS1044: 'private' modifier cannot appear on a module element. +tests/cases/compiler/importDeclWithClassModifiers.ts(6,8): error TS1044: 'private' modifier cannot appear on a module or namespace element. tests/cases/compiler/importDeclWithClassModifiers.ts(6,29): error TS2305: Module 'x' has no exported member 'c'. -tests/cases/compiler/importDeclWithClassModifiers.ts(7,8): error TS1044: 'static' modifier cannot appear on a module element. +tests/cases/compiler/importDeclWithClassModifiers.ts(7,8): error TS1044: 'static' modifier cannot appear on a module or namespace element. tests/cases/compiler/importDeclWithClassModifiers.ts(7,28): error TS2305: Module 'x' has no exported member 'c'. @@ -13,17 +13,17 @@ tests/cases/compiler/importDeclWithClassModifiers.ts(7,28): error TS2305: Module } export public import a = x.c; ~~~~~~ -!!! error TS1044: 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module or namespace element. ~ !!! error TS2305: Module 'x' has no exported member 'c'. export private import b = x.c; ~~~~~~~ -!!! error TS1044: 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module or namespace element. ~ !!! error TS2305: Module 'x' has no exported member 'c'. export static import c = x.c; ~~~~~~ -!!! error TS1044: 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module or namespace element. ~ !!! error TS2305: Module 'x' has no exported member 'c'. var b: a; diff --git a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt index 101ee0124cc..797f3b1fe9a 100644 --- a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt +++ b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt @@ -1,24 +1,24 @@ -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(4,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(6,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(12,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(13,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(15,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(19,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(25,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(29,5): error TS1044: 'private' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(31,5): error TS1044: 'private' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(37,5): error TS1044: 'private' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(38,5): error TS1044: 'private' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(40,5): error TS1044: 'private' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(44,5): error TS1044: 'private' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(50,5): error TS1044: 'private' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(55,5): error TS1044: 'static' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(57,5): error TS1044: 'static' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(63,5): error TS1044: 'static' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(64,5): error TS1044: 'static' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(66,5): error TS1044: 'static' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(70,5): error TS1044: 'static' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(76,5): error TS1044: 'static' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(4,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(6,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(12,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(13,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(15,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(19,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(25,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(29,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(31,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(37,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(38,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(40,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(44,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(50,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(55,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(57,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(63,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(64,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(66,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(70,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(76,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. ==== tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts (21 errors) ==== @@ -27,11 +27,11 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOf module Y { public class A { s: string } ~~~~~~ -!!! error TS1044: 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module or namespace element. public class BB extends A { ~~~~~~ -!!! error TS1044: 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module or namespace element. id: number; } } @@ -39,20 +39,20 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOf module Y2 { public class AA { s: T } ~~~~~~ -!!! error TS1044: 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module or namespace element. public interface I { id: number } ~~~~~~ -!!! error TS1044: 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module or namespace element. public class B extends AA implements I { id: number } ~~~~~~ -!!! error TS1044: 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module or namespace element. } module Y3 { public module Module { ~~~~~~ -!!! error TS1044: 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module or namespace element. class A { s: string } } } @@ -60,17 +60,17 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOf module Y4 { public enum Color { Blue, Red } ~~~~~~ -!!! error TS1044: 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module or namespace element. } module YY { private class A { s: string } ~~~~~~~ -!!! error TS1044: 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module or namespace element. private class BB extends A { ~~~~~~~ -!!! error TS1044: 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module or namespace element. id: number; } } @@ -78,20 +78,20 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOf module YY2 { private class AA { s: T } ~~~~~~~ -!!! error TS1044: 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module or namespace element. private interface I { id: number } ~~~~~~~ -!!! error TS1044: 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module or namespace element. private class B extends AA implements I { id: number } ~~~~~~~ -!!! error TS1044: 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module or namespace element. } module YY3 { private module Module { ~~~~~~~ -!!! error TS1044: 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module or namespace element. class A { s: string } } } @@ -99,18 +99,18 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOf module YY4 { private enum Color { Blue, Red } ~~~~~~~ -!!! error TS1044: 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module or namespace element. } module YYY { static class A { s: string } ~~~~~~ -!!! error TS1044: 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module or namespace element. static class BB extends A { ~~~~~~ -!!! error TS1044: 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module or namespace element. id: number; } } @@ -118,20 +118,20 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOf module YYY2 { static class AA { s: T } ~~~~~~ -!!! error TS1044: 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module or namespace element. static interface I { id: number } ~~~~~~ -!!! error TS1044: 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module or namespace element. static class B extends AA implements I { id: number } ~~~~~~ -!!! error TS1044: 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module or namespace element. } module YYY3 { static module Module { ~~~~~~ -!!! error TS1044: 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module or namespace element. class A { s: string } } } @@ -139,6 +139,6 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOf module YYY4 { static enum Color { Blue, Red } ~~~~~~ -!!! error TS1044: 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module or namespace element. } \ No newline at end of file diff --git a/tests/baselines/reference/invalidModuleWithVarStatements.errors.txt b/tests/baselines/reference/invalidModuleWithVarStatements.errors.txt index ad8d457670a..347e558eddd 100644 --- a/tests/baselines/reference/invalidModuleWithVarStatements.errors.txt +++ b/tests/baselines/reference/invalidModuleWithVarStatements.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(4,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(8,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(12,5): error TS1044: 'static' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(16,5): error TS1044: 'static' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(20,5): error TS1044: 'private' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(25,5): error TS1044: 'private' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(4,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(8,5): error TS1044: 'public' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(12,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(16,5): error TS1044: 'static' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(20,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(25,5): error TS1044: 'private' modifier cannot appear on a module or namespace element. ==== tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts (6 errors) ==== @@ -12,37 +12,37 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatement module Y { public var x: number = 0; ~~~~~~ -!!! error TS1044: 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module or namespace element. } module Y2 { public function fn(x: string) { } ~~~~~~ -!!! error TS1044: 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module or namespace element. } module Y4 { static var x: number = 0; ~~~~~~ -!!! error TS1044: 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module or namespace element. } module YY { static function fn(x: string) { } ~~~~~~ -!!! error TS1044: 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module or namespace element. } module YY2 { private var x: number = 0; ~~~~~~~ -!!! error TS1044: 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module or namespace element. } module YY3 { private function fn(x: string) { } ~~~~~~~ -!!! error TS1044: 'private' modifier cannot appear on a module element. +!!! error TS1044: 'private' modifier cannot appear on a module or namespace element. } \ No newline at end of file diff --git a/tests/baselines/reference/parserInterfaceDeclaration3.errors.txt b/tests/baselines/reference/parserInterfaceDeclaration3.errors.txt index 8e84ca940a4..f074a38bd79 100644 --- a/tests/baselines/reference/parserInterfaceDeclaration3.errors.txt +++ b/tests/baselines/reference/parserInterfaceDeclaration3.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration3.ts(1,1): error TS1044: 'public' modifier cannot appear on a module element. +tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration3.ts(1,1): error TS1044: 'public' modifier cannot appear on a module or namespace element. ==== tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration3.ts (1 errors) ==== public interface I { ~~~~~~ -!!! error TS1044: 'public' modifier cannot appear on a module element. +!!! error TS1044: 'public' modifier cannot appear on a module or namespace element. } \ No newline at end of file diff --git a/tests/baselines/reference/parserInterfaceDeclaration4.errors.txt b/tests/baselines/reference/parserInterfaceDeclaration4.errors.txt index 97a691a5230..aa1fe1aa6e7 100644 --- a/tests/baselines/reference/parserInterfaceDeclaration4.errors.txt +++ b/tests/baselines/reference/parserInterfaceDeclaration4.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration4.ts(1,1): error TS1044: 'static' modifier cannot appear on a module element. +tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration4.ts(1,1): error TS1044: 'static' modifier cannot appear on a module or namespace element. ==== tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration4.ts (1 errors) ==== static interface I { ~~~~~~ -!!! error TS1044: 'static' modifier cannot appear on a module element. +!!! error TS1044: 'static' modifier cannot appear on a module or namespace element. } \ No newline at end of file From 96d82b576c1bcbb72224abb8ac84157d7a2137ed Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 3 Feb 2016 00:03:59 -0800 Subject: [PATCH 11/15] Update README.md --- doc/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/README.md b/doc/README.md index 164fb69ee20..8d7eb3449fa 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,7 +1,9 @@ +# Read This! + This directory contains miscellaneous documentation such as the TypeScript language specification and logo. If you are looking for more introductory material, you might want to take a look at the [TypeScript Handbook](https://github.com/Microsoft/TypeScript-Handbook). # Spec Contributions The specification is first authored as a Microsoft Word (docx) file and then generated into Markdown and PDF formats. -Due to the binary format of docx files, and the merging difficulties that may come with it, it is preferred that any suggestions or problems found in the spec should be [filed as issues](https://github.com/Microsoft/TypeScript/issues/new) rather than sent as pull requests. \ No newline at end of file +Due to the binary format of docx files, and the merging difficulties that may come with it, it is preferred that any suggestions or problems found in the spec should be [filed as issues](https://github.com/Microsoft/TypeScript/issues/new) rather than sent as pull requests. From c69a9d1a5c6ea3854b333f689135e88d996a2608 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 3 Feb 2016 00:05:09 -0800 Subject: [PATCH 12/15] Update README.md --- lib/README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/README.md b/lib/README.md index 583ddf91156..852d449f1e5 100644 --- a/lib/README.md +++ b/lib/README.md @@ -1,4 +1,5 @@ -# Read this! +# Read This! -These files are not meant to be edited by hand. -If you need to make modifications, the respective files should be changed within the repository's top-level `src` directory. Running `jake LKG` will then appropriately update the files in this directory. +**These files are not meant to be edited by hand.** +If you need to make modifications, the respective files should be changed within the repository's top-level `src` directory. +Running `jake LKG` will then appropriately update the files in this directory. From 98e8a25d1e5525cd7a9ae6d5b12f620ab658f34a Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 3 Feb 2016 06:52:53 -0800 Subject: [PATCH 13/15] Addressing CR feedback --- src/compiler/parser.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 77f50a9bd87..fa17864166d 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2464,9 +2464,9 @@ namespace ts { } if (token === SyntaxKind.OpenBracketToken || token === SyntaxKind.OpenBraceToken) { // Return true if we can parse an array or object binding pattern with no errors - const count = parseDiagnostics.length; + const previousErrorCount = parseDiagnostics.length; parseIdentifierOrPattern(); - return count === parseDiagnostics.length; + return previousErrorCount === parseDiagnostics.length; } return false; } @@ -2492,7 +2492,7 @@ namespace ts { if (token === SyntaxKind.CloseParenToken) { nextToken(); if (token === SyntaxKind.EqualsGreaterThanToken) { - // ( id ) => + // ( xxx ) => return true; } } From 98b8af62e7f2afd42f70de286c8a45eb00651428 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 3 Feb 2016 13:45:36 -0800 Subject: [PATCH 14/15] Update README.md --- doc/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/README.md b/doc/README.md index 8d7eb3449fa..cfc97fedbe9 100644 --- a/doc/README.md +++ b/doc/README.md @@ -6,4 +6,4 @@ If you are looking for more introductory material, you might want to take a look # Spec Contributions The specification is first authored as a Microsoft Word (docx) file and then generated into Markdown and PDF formats. -Due to the binary format of docx files, and the merging difficulties that may come with it, it is preferred that any suggestions or problems found in the spec should be [filed as issues](https://github.com/Microsoft/TypeScript/issues/new) rather than sent as pull requests. +Due to the binary format of docx files, and the merging difficulties that may come with it, it is preferred that **any suggestions or problems found in the spec should be [filed as issues](https://github.com/Microsoft/TypeScript/issues/new)** rather than sent as pull requests. From daa70e3f23ee9ad91129b4e71ba8dc0007db0962 Mon Sep 17 00:00:00 2001 From: Jesse Schalken Date: Thu, 4 Feb 2016 11:38:21 +1100 Subject: [PATCH 15/15] Fix Stack Overflow and Gitter links in CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1dba1281dd7..7a99bf318d2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,7 +13,7 @@ Issues that ask questions answered in the FAQ will be closed without elaboration ## 3. Do you have a question? The issue tracker is for **issues**, in other words, bugs and suggestions. -If you have a *question*, please use [http://stackoverflow.com/questions/tagged/typescript](Stack Overflow), [https://gitter.im/Microsoft/TypeScript](Gitter), your favorite search engine, or other resources. +If you have a *question*, please use [Stack Overflow](http://stackoverflow.com/questions/tagged/typescript), [Gitter](https://gitter.im/Microsoft/TypeScript), your favorite search engine, or other resources. Due to increased traffic, we can no longer answer questions in the issue tracker. ## 4. Did you find a bug?