From 323aa3a56c14d76c0ecd2d450572cd120269b41d Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Tue, 14 Mar 2017 17:17:16 -0700 Subject: [PATCH] add asserts for cases when containing list cannot be determined --- src/services/textChanges.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts index bb310657b60..4dcb0867d9a 100644 --- a/src/services/textChanges.ts +++ b/src/services/textChanges.ts @@ -190,6 +190,7 @@ namespace ts.textChanges { public deleteNodeInList(sourceFile: SourceFile, node: Node) { const containingList = formatting.SmartIndenter.getContainingList(node, sourceFile); if (!containingList) { + Debug.fail("node is not a list element"); return this; } const index = containingList.indexOf(node); @@ -260,6 +261,7 @@ namespace ts.textChanges { public insertNodeInListAfter(sourceFile: SourceFile, after: Node, newNode: Node) { const containingList = formatting.SmartIndenter.getContainingList(after, sourceFile); if (!containingList) { + Debug.fail("node is not a list element"); return this; } const index = containingList.indexOf(after);