Skip to content

Commit 323aa3a

Browse files
committed
add asserts for cases when containing list cannot be determined
1 parent 5775d27 commit 323aa3a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/services/textChanges.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ namespace ts.textChanges {
190190
public deleteNodeInList(sourceFile: SourceFile, node: Node) {
191191
const containingList = formatting.SmartIndenter.getContainingList(node, sourceFile);
192192
if (!containingList) {
193+
Debug.fail("node is not a list element");
193194
return this;
194195
}
195196
const index = containingList.indexOf(node);
@@ -260,6 +261,7 @@ namespace ts.textChanges {
260261
public insertNodeInListAfter(sourceFile: SourceFile, after: Node, newNode: Node) {
261262
const containingList = formatting.SmartIndenter.getContainingList(after, sourceFile);
262263
if (!containingList) {
264+
Debug.fail("node is not a list element");
263265
return this;
264266
}
265267
const index = containingList.indexOf(after);

0 commit comments

Comments
 (0)