From b692ea9b661aa8b0fe8a07e3a30f7bd2c6580abd Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 11 Dec 2014 14:40:25 -0800 Subject: [PATCH] Remove TryBlock and FinallyBlock. They break the rule that syntactically identical constructs use the same syntax kind. This prevents node reuse in incremental parsing. --- src/compiler/binder.ts | 2 - src/compiler/checker.ts | 4 -- src/compiler/emitter.ts | 2 - src/compiler/parser.ts | 38 +++++++---------- src/compiler/types.ts | 2 - src/services/breakpoints.ts | 4 -- src/services/formatting.ts | 5 --- src/services/formatting/rules.ts | 5 --- src/services/outliningElementsCollector.ts | 42 +++++++++++++------ src/services/services.ts | 15 +++++-- src/services/smartIndenter.ts | 3 -- tests/baselines/reference/noCatchBlock.js.map | 2 +- .../reference/noCatchBlock.sourcemap.txt | 20 ++++----- .../reference/sourceMap-SkippedNode.js.map | 2 +- .../sourceMap-SkippedNode.sourcemap.txt | 20 ++++----- .../sourceMapValidationStatements.js.map | 2 +- ...ourceMapValidationStatements.sourcemap.txt | 30 ++++++------- .../sourceMapValidationTryCatchFinally.js.map | 2 +- ...MapValidationTryCatchFinally.sourcemap.txt | 42 +++++++++---------- .../getOccurrencesTryCatchFinally.ts | 2 +- 20 files changed, 117 insertions(+), 127 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index dfb5482b09c..01a08a7e43b 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -493,9 +493,7 @@ module ts { break; } case SyntaxKind.Block: - case SyntaxKind.TryBlock: case SyntaxKind.CatchClause: - case SyntaxKind.FinallyBlock: case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: case SyntaxKind.SwitchStatement: diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7bc8a28a795..e0ff03fa00f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4569,9 +4569,7 @@ module ts { case SyntaxKind.LabeledStatement: case SyntaxKind.ThrowStatement: case SyntaxKind.TryStatement: - case SyntaxKind.TryBlock: case SyntaxKind.CatchClause: - case SyntaxKind.FinallyBlock: return forEachChild(node, isAssignedIn); } return false; @@ -8894,9 +8892,7 @@ module ts { case SyntaxKind.LabeledStatement: case SyntaxKind.ThrowStatement: case SyntaxKind.TryStatement: - case SyntaxKind.TryBlock: case SyntaxKind.CatchClause: - case SyntaxKind.FinallyBlock: case SyntaxKind.VariableDeclaration: case SyntaxKind.ClassDeclaration: case SyntaxKind.EnumDeclaration: diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 24890799706..13766f01996 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3907,8 +3907,6 @@ module ts { case SyntaxKind.OmittedExpression: return; case SyntaxKind.Block: - case SyntaxKind.TryBlock: - case SyntaxKind.FinallyBlock: case SyntaxKind.ModuleBlock: return emitBlock(node); case SyntaxKind.VariableStatement: diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index f9ffba74d0c..483090f3538 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -361,8 +361,6 @@ module ts { child((node).whenTrue) || child((node).whenFalse); case SyntaxKind.Block: - case SyntaxKind.TryBlock: - case SyntaxKind.FinallyBlock: case SyntaxKind.ModuleBlock: return children((node).statements); case SyntaxKind.SourceFile: @@ -492,9 +490,7 @@ module ts { case SyntaxKind.DefaultClause: case SyntaxKind.LabeledStatement: case SyntaxKind.TryStatement: - case SyntaxKind.TryBlock: case SyntaxKind.CatchClause: - case SyntaxKind.FinallyBlock: return forEachChild(node, traverse); } } @@ -3529,8 +3525,8 @@ module ts { } // STATEMENTS - function parseBlock(kind: SyntaxKind, ignoreMissingOpenBrace: boolean, checkForStrictMode: boolean, diagnosticMessage?: DiagnosticMessage): Block { - var node = createNode(kind); + function parseBlock(ignoreMissingOpenBrace: boolean, checkForStrictMode: boolean, diagnosticMessage?: DiagnosticMessage): Block { + var node = createNode(SyntaxKind.Block); if (parseExpected(SyntaxKind.OpenBraceToken, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(ParsingContext.BlockStatements, checkForStrictMode, parseStatement); parseExpected(SyntaxKind.CloseBraceToken); @@ -3545,7 +3541,7 @@ module ts { var savedYieldContext = inYieldContext(); setYieldContext(allowYield); - var block = parseBlock(SyntaxKind.Block, ignoreMissingOpenBrace, /*checkForStrictMode*/ true, diagnosticMessage); + var block = parseBlock(ignoreMissingOpenBrace, /*checkForStrictMode*/ true, diagnosticMessage); setYieldContext(savedYieldContext); @@ -3739,25 +3735,19 @@ module ts { // TODO: Review for error recovery function parseTryStatement(): TryStatement { var node = createNode(SyntaxKind.TryStatement); - node.tryBlock = parseTokenAndBlock(SyntaxKind.TryKeyword); + + parseExpected(SyntaxKind.TryKeyword); + node.tryBlock = parseBlock(/*ignoreMissingOpenBrace:*/ false, /*checkForStrictMode*/ false); node.catchClause = token === SyntaxKind.CatchKeyword ? parseCatchClause() : undefined; // If we don't have a catch clause, then we must have a finally clause. Try to parse // one out no matter what. - node.finallyBlock = !node.catchClause || token === SyntaxKind.FinallyKeyword - ? parseTokenAndBlock(SyntaxKind.FinallyKeyword) - : undefined; - return finishNode(node); - } + if (!node.catchClause || token === SyntaxKind.FinallyKeyword) { + parseExpected(SyntaxKind.FinallyKeyword); + node.finallyBlock = parseBlock(/*ignoreMissingOpenBrace:*/ false, /*checkForStrictMode*/ false); + } - function parseTokenAndBlock(token: SyntaxKind): Block { - var pos = getNodePos(); - parseExpected(token); - var result = parseBlock( - token === SyntaxKind.TryKeyword ? SyntaxKind.TryBlock : SyntaxKind.FinallyBlock, - /* ignoreMissingOpenBrace */ false, /*checkForStrictMode*/ false); - result.pos = pos; - return result; + return finishNode(node); } function parseCatchClause(): CatchClause { @@ -3767,7 +3757,7 @@ module ts { result.name = parseIdentifier(); result.type = parseTypeAnnotation(); parseExpected(SyntaxKind.CloseParenToken); - result.block = parseBlock(SyntaxKind.Block, /* ignoreMissingOpenBrace */ false, /*checkForStrictMode*/ false); + result.block = parseBlock(/*ignoreMissingOpenBrace:*/ false, /*checkForStrictMode:*/ false); return finishNode(result); } @@ -3876,7 +3866,7 @@ module ts { function parseStatement(): Statement { switch (token) { case SyntaxKind.OpenBraceToken: - return parseBlock(SyntaxKind.Block, /* ignoreMissingOpenBrace */ false, /*checkForStrictMode*/ false); + return parseBlock(/*ignoreMissingOpenBrace:*/ false, /*checkForStrictMode:*/ false); case SyntaxKind.VarKeyword: case SyntaxKind.ConstKeyword: // const here should always be parsed as const declaration because of check in 'isStatement' @@ -4715,7 +4705,7 @@ module ts { inFunctionBlock = true; } var savedInBlock = inBlock; - if (node.kind === SyntaxKind.Block || node.kind === SyntaxKind.TryBlock || node.kind === SyntaxKind.FinallyBlock) { + if (node.kind === SyntaxKind.Block) { inBlock = true; } var savedInObjectLiteralExpression = inObjectLiteralExpression; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index ab4571bfb9a..43680e235ff 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -213,8 +213,6 @@ module ts { LabeledStatement, ThrowStatement, TryStatement, - TryBlock, - FinallyBlock, DebuggerStatement, VariableDeclaration, FunctionDeclaration, diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index 3a2cc2ad7e7..8c3dda08d22 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -108,8 +108,6 @@ module ts.BreakpointResolver { return spanInFunctionBlock(node); } // Fall through - case SyntaxKind.TryBlock: - case SyntaxKind.FinallyBlock: case SyntaxKind.ModuleBlock: return spanInBlock(node); @@ -429,9 +427,7 @@ module ts.BreakpointResolver { } // fall through. - case SyntaxKind.TryBlock: case SyntaxKind.CatchClause: - case SyntaxKind.FinallyBlock: return spanInNode((node.parent).statements[(node.parent).statements.length - 1]);; case SyntaxKind.SwitchStatement: diff --git a/src/services/formatting.ts b/src/services/formatting.ts index 0c2dd4c51dc..c8d3d1bb52f 100644 --- a/src/services/formatting.ts +++ b/src/services/formatting.ts @@ -154,8 +154,6 @@ module ts.formatting { return body && body.kind === SyntaxKind.Block && rangeContainsRange((body).statements, node); case SyntaxKind.SourceFile: case SyntaxKind.Block: - case SyntaxKind.TryBlock: - case SyntaxKind.FinallyBlock: case SyntaxKind.ModuleBlock: return rangeContainsRange((parent).statements, node); case SyntaxKind.CatchClause: @@ -932,9 +930,6 @@ module ts.formatting { function isSomeBlock(kind: SyntaxKind): boolean { switch (kind) { case SyntaxKind.Block: - case SyntaxKind.Block: - case SyntaxKind.TryBlock: - case SyntaxKind.FinallyBlock: case SyntaxKind.ModuleBlock: return true; } diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index bea74e529ff..9fcc787030d 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -525,8 +525,6 @@ module ts.formatting { case SyntaxKind.Block: case SyntaxKind.SwitchStatement: case SyntaxKind.ObjectLiteralExpression: - case SyntaxKind.TryBlock: - case SyntaxKind.FinallyBlock: case SyntaxKind.ModuleBlock: return true; } @@ -580,9 +578,7 @@ module ts.formatting { case SyntaxKind.ModuleDeclaration: case SyntaxKind.EnumDeclaration: case SyntaxKind.Block: - case SyntaxKind.TryBlock: case SyntaxKind.CatchClause: - case SyntaxKind.FinallyBlock: case SyntaxKind.ModuleBlock: case SyntaxKind.SwitchStatement: return true; @@ -603,7 +599,6 @@ module ts.formatting { // TODO // case SyntaxKind.ElseClause: case SyntaxKind.CatchClause: - case SyntaxKind.FinallyBlock: return true; default: diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts index 83eef2f4378..649266f1f88 100644 --- a/src/services/outliningElementsCollector.ts +++ b/src/services/outliningElementsCollector.ts @@ -84,25 +84,43 @@ module ts { parent.kind === SyntaxKind.CatchClause) { addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); + break; } - else { - // Block was a standalone block. In this case we want to only collapse - // the span of the block, independent of any parent span. - var span = TextSpan.fromBounds(n.getStart(), n.end); - elements.push({ - textSpan: span, - hintSpan: span, - bannerText: collapseText, - autoCollapse: autoCollapse(n) - }); + + if (parent.kind === SyntaxKind.TryStatement) { + // Could be the try-block, or the finally-block. + var tryStatement = parent; + if (tryStatement.tryBlock === n) { + addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); + break; + } + else if (tryStatement.finallyBlock === n) { + var children = tryStatement.getChildren(); + for (var i = 0, m = children.length; i < m; i++) { + if (children[i].kind === SyntaxKind.FinallyKeyword) { + addOutliningSpan(children[i], openBrace, closeBrace, autoCollapse(n)); + break; + } + } + } + + // fall through. } + + // Block was a standalone block. In this case we want to only collapse + // the span of the block, independent of any parent span. + var span = TextSpan.fromBounds(n.getStart(), n.end); + elements.push({ + textSpan: span, + hintSpan: span, + bannerText: collapseText, + autoCollapse: autoCollapse(n) + }); break; } // Fallthrough. case SyntaxKind.ModuleBlock: - case SyntaxKind.TryBlock: - case SyntaxKind.FinallyBlock: var openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile); var closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); diff --git a/src/services/services.ts b/src/services/services.ts index 74e7f924a20..ccf29d600b6 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -3418,13 +3418,17 @@ module ts { return getThrowOccurrences(node.parent); } break; - case SyntaxKind.TryKeyword: case SyntaxKind.CatchKeyword: - case SyntaxKind.FinallyKeyword: if (hasKind(parent(parent(node)), SyntaxKind.TryStatement)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; + case SyntaxKind.TryKeyword: + case SyntaxKind.FinallyKeyword: + if (hasKind(parent(node), SyntaxKind.TryStatement)) { + return getTryCatchFinallyOccurrences(node.parent); + } + break; case SyntaxKind.SwitchKeyword: if (hasKind(node.parent, SyntaxKind.SwitchStatement)) { return getSwitchCaseDefaultOccurrences(node.parent); @@ -3658,7 +3662,12 @@ module ts { } if (tryStatement.finallyBlock) { - pushKeywordIf(keywords, tryStatement.finallyBlock.getFirstToken(), SyntaxKind.FinallyKeyword); + var children = tryStatement.getChildren(); + for (var i = 0, n = children.length; i < n; i++) { + if (pushKeywordIf(keywords, children[i], SyntaxKind.FinallyKeyword)) { + break; + } + } } return map(keywords, getReferenceEntryFromNode); diff --git a/src/services/smartIndenter.ts b/src/services/smartIndenter.ts index cafd92a7551..c6b92310c2e 100644 --- a/src/services/smartIndenter.ts +++ b/src/services/smartIndenter.ts @@ -327,8 +327,6 @@ module ts.formatting { case SyntaxKind.EnumDeclaration: case SyntaxKind.ArrayLiteralExpression: case SyntaxKind.Block: - case SyntaxKind.TryBlock: - case SyntaxKind.FinallyBlock: case SyntaxKind.ModuleBlock: case SyntaxKind.ObjectLiteralExpression: case SyntaxKind.TypeLiteral: @@ -403,7 +401,6 @@ module ts.formatting { case SyntaxKind.EnumDeclaration: case SyntaxKind.ObjectLiteralExpression: case SyntaxKind.Block: - case SyntaxKind.FinallyBlock: case SyntaxKind.ModuleBlock: case SyntaxKind.SwitchStatement: return nodeEndsWith(n, SyntaxKind.CloseBraceToken, sourceFile); diff --git a/tests/baselines/reference/noCatchBlock.js.map b/tests/baselines/reference/noCatchBlock.js.map index dccc7798c92..149a2167f46 100644 --- a/tests/baselines/reference/noCatchBlock.js.map +++ b/tests/baselines/reference/noCatchBlock.js.map @@ -1,2 +1,2 @@ //// [noCatchBlock.js.map] -{"version":3,"file":"noCatchBlock.js","sourceRoot":"","sources":["noCatchBlock.ts"],"names":[],"mappings":"AACA,IAAA,CAAC;AAED,CAAC;QAAC,CAAC;AAEH,CAAC"} \ No newline at end of file +{"version":3,"file":"noCatchBlock.js","sourceRoot":"","sources":["noCatchBlock.ts"],"names":[],"mappings":"AACA,IAAI,CAAC;AAEL,CAAC;QAAS,CAAC;AAEX,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/noCatchBlock.sourcemap.txt b/tests/baselines/reference/noCatchBlock.sourcemap.txt index 8d5a67339f6..18cb0d5a479 100644 --- a/tests/baselines/reference/noCatchBlock.sourcemap.txt +++ b/tests/baselines/reference/noCatchBlock.sourcemap.txt @@ -14,17 +14,17 @@ sourceFile:noCatchBlock.ts 3 > ^ 1 > > -2 > -3 > t +2 >try +3 > { 1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(2, 1) + SourceIndex(0) -3 >Emitted(1, 6) Source(2, 2) + SourceIndex(0) +2 >Emitted(1, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(1, 6) Source(2, 6) + SourceIndex(0) --- >>>} 1 > 2 >^ 3 > ^^^^^^^^^-> -1 >ry { +1 > > // ... > 2 >} @@ -34,16 +34,16 @@ sourceFile:noCatchBlock.ts >>>finally { 1->^^^^^^^^ 2 > ^ -1-> -2 > f -1->Emitted(3, 9) Source(4, 3) + SourceIndex(0) -2 >Emitted(3, 10) Source(4, 4) + SourceIndex(0) +1-> finally +2 > { +1->Emitted(3, 9) Source(4, 11) + SourceIndex(0) +2 >Emitted(3, 10) Source(4, 12) + SourceIndex(0) --- >>>} 1 > 2 >^ 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >inally { +1 > > // N.B. No 'catch' block > 2 >} diff --git a/tests/baselines/reference/sourceMap-SkippedNode.js.map b/tests/baselines/reference/sourceMap-SkippedNode.js.map index cdcdc804634..77340424640 100644 --- a/tests/baselines/reference/sourceMap-SkippedNode.js.map +++ b/tests/baselines/reference/sourceMap-SkippedNode.js.map @@ -1,2 +1,2 @@ //// [sourceMap-SkippedNode.js.map] -{"version":3,"file":"sourceMap-SkippedNode.js","sourceRoot":"","sources":["sourceMap-SkippedNode.ts"],"names":[],"mappings":"AAAA,IAAA,CAAC;AAED,CAAC;QAAC,CAAC;AAEH,CAAC"} \ No newline at end of file +{"version":3,"file":"sourceMap-SkippedNode.js","sourceRoot":"","sources":["sourceMap-SkippedNode.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC;AAEL,CAAC;QAAS,CAAC;AAEX,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMap-SkippedNode.sourcemap.txt b/tests/baselines/reference/sourceMap-SkippedNode.sourcemap.txt index 531a666ade0..f68320a531f 100644 --- a/tests/baselines/reference/sourceMap-SkippedNode.sourcemap.txt +++ b/tests/baselines/reference/sourceMap-SkippedNode.sourcemap.txt @@ -13,17 +13,17 @@ sourceFile:sourceMap-SkippedNode.ts 2 >^^^^ 3 > ^ 1 > -2 > -3 > t +2 >try +3 > { 1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 5) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 6) Source(1, 2) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) --- >>>} 1 > 2 >^ 3 > ^^^^^^^^^-> -1 >ry { +1 > >// ... > 2 >} @@ -33,16 +33,16 @@ sourceFile:sourceMap-SkippedNode.ts >>>finally { 1->^^^^^^^^ 2 > ^ -1-> -2 > f -1->Emitted(3, 9) Source(3, 3) + SourceIndex(0) -2 >Emitted(3, 10) Source(3, 4) + SourceIndex(0) +1-> finally +2 > { +1->Emitted(3, 9) Source(3, 11) + SourceIndex(0) +2 >Emitted(3, 10) Source(3, 12) + SourceIndex(0) --- >>>} 1 > 2 >^ 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >inally { +1 > >// N.B. No 'catch' block > 2 >} diff --git a/tests/baselines/reference/sourceMapValidationStatements.js.map b/tests/baselines/reference/sourceMapValidationStatements.js.map index 8eb99944914..7bf883de6c3 100644 --- a/tests/baselines/reference/sourceMapValidationStatements.js.map +++ b/tests/baselines/reference/sourceMapValidationStatements.js.map @@ -1,2 +1,2 @@ //// [sourceMapValidationStatements.js.map] -{"version":3,"file":"sourceMapValidationStatements.js","sourceRoot":"","sources":["sourceMapValidationStatements.ts"],"names":["f"],"mappings":"AAAA,SAAS,CAAC;IACNA,IAAIA,CAACA,CAACA;IACNA,IAAIA,CAACA,GAAGA,CAACA,CAACA;IACVA,GAAGA,CAACA,CAACA,GAAGA,CAACA,CAACA,GAAGA,CAACA,EAAEA,CAACA,GAAGA,EAAEA,EAAEA,CAACA,EAAEA,EAAEA,CAACA;QAC1BA,CAACA,IAAIA,CAACA,CAACA;QACPA,CAACA,IAAIA,CAACA,CAACA;IACXA,CAACA;IACDA,EAAEA,CAACA,CAACA,CAACA,GAAGA,EAAEA,CAACA,CAACA,CAACA;QACTA,CAACA,IAAIA,CAACA,CAACA;IACXA,CAACA;IAACA,IAAIA,CAACA,CAACA;QACJA,CAACA,IAAIA,EAAEA,CAACA;QACRA,CAACA,EAAEA,CAACA;IACRA,CAACA;IACDA,IAAIA,CAACA,GAAGA;QACJA,CAACA;QACDA,CAACA;QACDA,CAACA;KACJA,CAACA;IACFA,IAAIA,GAAGA,GAAGA;QACNA,CAACA,EAAEA,CAACA;QACJA,CAACA,EAAEA,OAAOA;KACbA,CAACA;IACFA,GAAGA,CAACA,CAACA,GAAGA,CAACA,CAACA,IAAIA,CAACA,CAACA,CAACA,CAACA;QACdA,GAAGA,CAACA,CAACA,GAAGA,CAACA,CAACA,CAACA,CAACA,CAACA;QACbA,IAAIA,CAACA,GAAGA,EAAEA,CAACA;IACfA,CAACA;IACDA,IAAAA,CAACA;QACGA,GAAGA,CAACA,CAACA,GAAGA,MAAMA,CAACA;IACnBA,CAAEA;IAAAA,KAAKA,CAACA,CAACA,CAACA,CAACA,CAACA,CAACA;QACTA,EAAEA,CAACA,CAACA,GAAGA,CAACA,CAACA,GAAGA,EAAEA,CAACA,CAACA,CAACA;YACbA,GAAGA,CAACA,CAACA,GAAGA,EAAEA,CAACA;QACfA,CAACA;QAACA,IAAIA,CAACA,CAACA;YACJA,GAAGA,CAACA,CAACA,GAAGA,KAAKA,CAACA;QAClBA,CAACA;IACLA,CAACA;IACDA,IAAAA,CAACA;QACGA,MAAMA,IAAIA,KAAKA,EAAEA,CAACA;IACtBA,CAAEA;IAAAA,KAAKA,CAACA,CAACA,EAAEA,CAACA,CAACA,CAACA;QACVA,IAAIA,CAACA,GAAGA,EAAEA,CAACA;IACfA,CAACA;YAACA,CAACA;QACCA,CAACA,GAAGA,EAAEA,CAACA;IACXA,CAACA;IACDA,MAAMA,GAAGA,EAAEA,CAACA;QACRA,CAACA,GAAGA,CAACA,CAACA;QACNA,CAACA,GAAGA,EAAEA,CAACA;IACXA,CAACA;IACDA,MAAMA,CAACA,CAACA,GAAGA,CAACA,CAACA,CAACA,CAACA,CAACA;QACZA,KAAKA,CAACA,EAAEA,CAACA;YACLA,CAACA,EAAEA,CAACA;YACJA,KAAKA,CAACA;QAEVA,CAACA;QACDA,KAAKA,CAACA,EAAEA,CAACA;YACLA,CAACA,EAAEA,CAACA;YACJA,KAAKA,CAACA;QAEVA,CAACA;QACDA,SAASA,CAACA;YACNA,CAACA,IAAIA,CAACA,CAACA;YACPA,CAACA,GAAGA,EAAEA,CAACA;YACPA,KAAKA,CAACA;QAEVA,CAACA;IACLA,CAACA;IACDA,OAAOA,CAACA,GAAGA,EAAEA,EAAEA,CAACA;QACZA,CAACA,EAAEA,CAACA;IACRA,CAACA;IACDA,GAAGA,CAACA;QACAA,CAACA,EAAEA,CAACA;IACRA,CAACA,QAAQA,CAACA,GAAGA,CAACA,EAACA;IACfA,CAACA,GAAGA,CAACA,CAACA;IACNA,IAAIA,CAACA,GAAGA,CAACA,CAACA,IAAIA,CAACA,CAACA,GAAGA,CAACA,GAAGA,CAACA,GAAGA,CAACA,GAAGA,CAACA,CAACA;IACjCA,CAACA,CAACA,IAAIA,CAACA,CAACA,GAAGA,CAACA,GAAGA,CAACA,GAAGA,CAACA,GAAGA,CAACA,CAACA;IACzBA,CAACA,KAAKA,CAACA,CAACA;IACRA,CAACA,GAAGA,CAACA,GAAGA,EAAEA,CAACA;IACXA,IAAIA,CAACA,GAAGA,CAACA,CAACA;IACVA,MAAMA,CAACA;AACXA,CAACA;AACD,IAAI,CAAC,GAAG;IACJ,IAAI,CAAC,GAAG,EAAE,CAAC;IACX,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC,CAAC;AACF,CAAC,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"sourceMapValidationStatements.js","sourceRoot":"","sources":["sourceMapValidationStatements.ts"],"names":["f"],"mappings":"AAAA,SAAS,CAAC;IACNA,IAAIA,CAACA,CAACA;IACNA,IAAIA,CAACA,GAAGA,CAACA,CAACA;IACVA,GAAGA,CAACA,CAACA,GAAGA,CAACA,CAACA,GAAGA,CAACA,EAAEA,CAACA,GAAGA,EAAEA,EAAEA,CAACA,EAAEA,EAAEA,CAACA;QAC1BA,CAACA,IAAIA,CAACA,CAACA;QACPA,CAACA,IAAIA,CAACA,CAACA;IACXA,CAACA;IACDA,EAAEA,CAACA,CAACA,CAACA,GAAGA,EAAEA,CAACA,CAACA,CAACA;QACTA,CAACA,IAAIA,CAACA,CAACA;IACXA,CAACA;IAACA,IAAIA,CAACA,CAACA;QACJA,CAACA,IAAIA,EAAEA,CAACA;QACRA,CAACA,EAAEA,CAACA;IACRA,CAACA;IACDA,IAAIA,CAACA,GAAGA;QACJA,CAACA;QACDA,CAACA;QACDA,CAACA;KACJA,CAACA;IACFA,IAAIA,GAAGA,GAAGA;QACNA,CAACA,EAAEA,CAACA;QACJA,CAACA,EAAEA,OAAOA;KACbA,CAACA;IACFA,GAAGA,CAACA,CAACA,GAAGA,CAACA,CAACA,IAAIA,CAACA,CAACA,CAACA,CAACA;QACdA,GAAGA,CAACA,CAACA,GAAGA,CAACA,CAACA,CAACA,CAACA,CAACA;QACbA,IAAIA,CAACA,GAAGA,EAAEA,CAACA;IACfA,CAACA;IACDA,IAAIA,CAACA;QACDA,GAAGA,CAACA,CAACA,GAAGA,MAAMA,CAACA;IACnBA,CAAEA;IAAAA,KAAKA,CAACA,CAACA,CAACA,CAACA,CAACA,CAACA;QACTA,EAAEA,CAACA,CAACA,GAAGA,CAACA,CAACA,GAAGA,EAAEA,CAACA,CAACA,CAACA;YACbA,GAAGA,CAACA,CAACA,GAAGA,EAAEA,CAACA;QACfA,CAACA;QAACA,IAAIA,CAACA,CAACA;YACJA,GAAGA,CAACA,CAACA,GAAGA,KAAKA,CAACA;QAClBA,CAACA;IACLA,CAACA;IACDA,IAAIA,CAACA;QACDA,MAAMA,IAAIA,KAAKA,EAAEA,CAACA;IACtBA,CAAEA;IAAAA,KAAKA,CAACA,CAACA,EAAEA,CAACA,CAACA,CAACA;QACVA,IAAIA,CAACA,GAAGA,EAAEA,CAACA;IACfA,CAACA;YAASA,CAACA;QACPA,CAACA,GAAGA,EAAEA,CAACA;IACXA,CAACA;IACDA,MAAMA,GAAGA,EAAEA,CAACA;QACRA,CAACA,GAAGA,CAACA,CAACA;QACNA,CAACA,GAAGA,EAAEA,CAACA;IACXA,CAACA;IACDA,MAAMA,CAACA,CAACA,GAAGA,CAACA,CAACA,CAACA,CAACA,CAACA;QACZA,KAAKA,CAACA,EAAEA,CAACA;YACLA,CAACA,EAAEA,CAACA;YACJA,KAAKA,CAACA;QAEVA,CAACA;QACDA,KAAKA,CAACA,EAAEA,CAACA;YACLA,CAACA,EAAEA,CAACA;YACJA,KAAKA,CAACA;QAEVA,CAACA;QACDA,SAASA,CAACA;YACNA,CAACA,IAAIA,CAACA,CAACA;YACPA,CAACA,GAAGA,EAAEA,CAACA;YACPA,KAAKA,CAACA;QAEVA,CAACA;IACLA,CAACA;IACDA,OAAOA,CAACA,GAAGA,EAAEA,EAAEA,CAACA;QACZA,CAACA,EAAEA,CAACA;IACRA,CAACA;IACDA,GAAGA,CAACA;QACAA,CAACA,EAAEA,CAACA;IACRA,CAACA,QAAQA,CAACA,GAAGA,CAACA,EAACA;IACfA,CAACA,GAAGA,CAACA,CAACA;IACNA,IAAIA,CAACA,GAAGA,CAACA,CAACA,IAAIA,CAACA,CAACA,GAAGA,CAACA,GAAGA,CAACA,GAAGA,CAACA,GAAGA,CAACA,CAACA;IACjCA,CAACA,CAACA,IAAIA,CAACA,CAACA,GAAGA,CAACA,GAAGA,CAACA,GAAGA,CAACA,GAAGA,CAACA,CAACA;IACzBA,CAACA,KAAKA,CAACA,CAACA;IACRA,CAACA,GAAGA,CAACA,GAAGA,EAAEA,CAACA;IACXA,IAAIA,CAACA,GAAGA,CAACA,CAACA;IACVA,MAAMA,CAACA;AACXA,CAACA;AACD,IAAI,CAAC,GAAG;IACJ,IAAI,CAAC,GAAG,EAAE,CAAC;IACX,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC,CAAC;AACF,CAAC,EAAE,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationStatements.sourcemap.txt b/tests/baselines/reference/sourceMapValidationStatements.sourcemap.txt index ef7aef275c0..586063c7c12 100644 --- a/tests/baselines/reference/sourceMapValidationStatements.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationStatements.sourcemap.txt @@ -501,11 +501,11 @@ sourceFile:sourceMapValidationStatements.ts 4 > ^^^^^^^^^^^^^^^-> 1-> > -2 > -3 > t +2 > try +3 > { 1->Emitted(28, 5) Source(27, 5) + SourceIndex(0) name (f) -2 >Emitted(28, 9) Source(27, 5) + SourceIndex(0) name (f) -3 >Emitted(28, 10) Source(27, 6) + SourceIndex(0) name (f) +2 >Emitted(28, 9) Source(27, 9) + SourceIndex(0) name (f) +3 >Emitted(28, 10) Source(27, 10) + SourceIndex(0) name (f) --- >>> obj.q = "ohhh"; 1->^^^^^^^^ @@ -515,7 +515,7 @@ sourceFile:sourceMapValidationStatements.ts 5 > ^^^ 6 > ^^^^^^ 7 > ^ -1->ry { +1-> > 2 > obj 3 > . @@ -706,11 +706,11 @@ sourceFile:sourceMapValidationStatements.ts 4 > ^^^^^^^^^^^^^^^^^^-> 1-> > -2 > -3 > t +2 > try +3 > { 1->Emitted(39, 5) Source(36, 5) + SourceIndex(0) name (f) -2 >Emitted(39, 9) Source(36, 5) + SourceIndex(0) name (f) -3 >Emitted(39, 10) Source(36, 6) + SourceIndex(0) name (f) +2 >Emitted(39, 9) Source(36, 9) + SourceIndex(0) name (f) +3 >Emitted(39, 10) Source(36, 10) + SourceIndex(0) name (f) --- >>> throw new Error(); 1->^^^^^^^^ @@ -719,7 +719,7 @@ sourceFile:sourceMapValidationStatements.ts 4 > ^^^^^ 5 > ^^ 6 > ^ -1->ry { +1-> > 2 > throw 3 > new @@ -805,10 +805,10 @@ sourceFile:sourceMapValidationStatements.ts 1->^^^^^^^^^^^^ 2 > ^ 3 > ^^^-> -1-> -2 > f -1->Emitted(45, 13) Source(40, 7) + SourceIndex(0) name (f) -2 >Emitted(45, 14) Source(40, 8) + SourceIndex(0) name (f) +1-> finally +2 > { +1->Emitted(45, 13) Source(40, 15) + SourceIndex(0) name (f) +2 >Emitted(45, 14) Source(40, 16) + SourceIndex(0) name (f) --- >>> y = 70; 1->^^^^^^^^ @@ -816,7 +816,7 @@ sourceFile:sourceMapValidationStatements.ts 3 > ^^^ 4 > ^^ 5 > ^ -1->inally { +1-> > 2 > y 3 > = diff --git a/tests/baselines/reference/sourceMapValidationTryCatchFinally.js.map b/tests/baselines/reference/sourceMapValidationTryCatchFinally.js.map index 89716807538..46506410856 100644 --- a/tests/baselines/reference/sourceMapValidationTryCatchFinally.js.map +++ b/tests/baselines/reference/sourceMapValidationTryCatchFinally.js.map @@ -1,2 +1,2 @@ //// [sourceMapValidationTryCatchFinally.js.map] -{"version":3,"file":"sourceMapValidationTryCatchFinally.js","sourceRoot":"","sources":["sourceMapValidationTryCatchFinally.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,EAAE,CAAC;AACX,IAAA,CAAC;IACG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAE;AAAA,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACT,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;QAAC,CAAC;IACC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;AACf,CAAC;AACD,IAAA,CAAC;IAEG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACV,MAAM,IAAI,KAAK,EAAE,CAAC;AACtB,CACA;AAAA,KAAK,CAAC,CAAC,CAAC,CAAC,CACT,CAAC;IACG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;QACD,CAAC;IAEG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;AACf,CAAC"} \ No newline at end of file +{"version":3,"file":"sourceMapValidationTryCatchFinally.js","sourceRoot":"","sources":["sourceMapValidationTryCatchFinally.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,EAAE,CAAC;AACX,IAAI,CAAC;IACD,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAE;AAAA,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACT,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;QAAS,CAAC;IACP,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;AACf,CAAC;AACD,IACA,CAAC;IACG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACV,MAAM,IAAI,KAAK,EAAE,CAAC;AACtB,CACA;AAAA,KAAK,CAAC,CAAC,CAAC,CAAC,CACT,CAAC;IACG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;QAED,CAAC;IACG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;AACf,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationTryCatchFinally.sourcemap.txt b/tests/baselines/reference/sourceMapValidationTryCatchFinally.sourcemap.txt index 25dee4fbc45..d625e74c262 100644 --- a/tests/baselines/reference/sourceMapValidationTryCatchFinally.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationTryCatchFinally.sourcemap.txt @@ -35,11 +35,11 @@ sourceFile:sourceMapValidationTryCatchFinally.ts 4 > ^^^^^^^^^^-> 1 > > -2 > -3 > t +2 >try +3 > { 1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(2, 5) Source(2, 1) + SourceIndex(0) -3 >Emitted(2, 6) Source(2, 2) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 6) Source(2, 6) + SourceIndex(0) --- >>> x = x + 1; 1->^^^^ @@ -49,7 +49,7 @@ sourceFile:sourceMapValidationTryCatchFinally.ts 5 > ^^^ 6 > ^ 7 > ^ -1->ry { +1-> > 2 > x 3 > = @@ -140,10 +140,10 @@ sourceFile:sourceMapValidationTryCatchFinally.ts 1->^^^^^^^^ 2 > ^ 3 > ^^^^^^^-> -1-> -2 > f -1->Emitted(8, 9) Source(6, 3) + SourceIndex(0) -2 >Emitted(8, 10) Source(6, 4) + SourceIndex(0) +1-> finally +2 > { +1->Emitted(8, 9) Source(6, 11) + SourceIndex(0) +2 >Emitted(8, 10) Source(6, 12) + SourceIndex(0) --- >>> x = x * 10; 1->^^^^ @@ -153,7 +153,7 @@ sourceFile:sourceMapValidationTryCatchFinally.ts 5 > ^^^ 6 > ^^ 7 > ^ -1->inally { +1-> > 2 > x 3 > = @@ -186,11 +186,12 @@ sourceFile:sourceMapValidationTryCatchFinally.ts 4 > ^^^^^^^^^^-> 1-> > -2 > -3 > t +2 >try + > +3 > { 1->Emitted(11, 1) Source(9, 1) + SourceIndex(0) -2 >Emitted(11, 5) Source(9, 1) + SourceIndex(0) -3 >Emitted(11, 6) Source(9, 2) + SourceIndex(0) +2 >Emitted(11, 5) Source(10, 1) + SourceIndex(0) +3 >Emitted(11, 6) Source(10, 2) + SourceIndex(0) --- >>> x = x + 1; 1->^^^^ @@ -201,8 +202,7 @@ sourceFile:sourceMapValidationTryCatchFinally.ts 6 > ^ 7 > ^ 8 > ^^^^^^^^^-> -1->ry - >{ +1-> > 2 > x 3 > = @@ -317,10 +317,11 @@ sourceFile:sourceMapValidationTryCatchFinally.ts 2 > ^ 3 > ^^^^^^^-> 1-> + >finally > -2 > f -1->Emitted(18, 9) Source(18, 1) + SourceIndex(0) -2 >Emitted(18, 10) Source(18, 2) + SourceIndex(0) +2 > { +1->Emitted(18, 9) Source(19, 1) + SourceIndex(0) +2 >Emitted(18, 10) Source(19, 2) + SourceIndex(0) --- >>> x = x * 10; 1->^^^^ @@ -330,8 +331,7 @@ sourceFile:sourceMapValidationTryCatchFinally.ts 5 > ^^^ 6 > ^^ 7 > ^ -1->inally - >{ +1-> > 2 > x 3 > = diff --git a/tests/cases/fourslash/getOccurrencesTryCatchFinally.ts b/tests/cases/fourslash/getOccurrencesTryCatchFinally.ts index 9037b6f8029..db0f792880e 100644 --- a/tests/cases/fourslash/getOccurrencesTryCatchFinally.ts +++ b/tests/cases/fourslash/getOccurrencesTryCatchFinally.ts @@ -16,7 +16,7 @@ ////[|fina/*3*/lly|] { ////} - +debugger; for (var i = 1; i <= test.markers().length; i++) { goTo.marker("" + i); verify.occurrencesAtPositionCount(3);