From 4390e10dfd3069785c4353b4554aefbe11e87d52 Mon Sep 17 00:00:00 2001 From: Alex Rickabaugh Date: Mon, 19 Nov 2018 11:14:45 +0100 Subject: [PATCH] fix(ivy): don't update parent pointers in the ivy switch transform (#27170) Now that the Ivy switch transform uses ts.getMutableClone() to copy statements, there's no need to set .parent pointers on the resulting updated nodes. Doing this was causing assertion failures deep in TypeScript in some cases. PR Close #27170 --- packages/compiler-cli/src/ngtsc/switch/src/switch.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/packages/compiler-cli/src/ngtsc/switch/src/switch.ts b/packages/compiler-cli/src/ngtsc/switch/src/switch.ts index 5b8c1507d3..017458bcab 100644 --- a/packages/compiler-cli/src/ngtsc/switch/src/switch.ts +++ b/packages/compiler-cli/src/ngtsc/switch/src/switch.ts @@ -120,9 +120,6 @@ function flipIvySwitchesInVariableStatement( /* name */ decl.name, /* type */ decl.type, /* initializer */ newIdentifier); - - // Keeping parent pointers up to date is important for emit. - newIdentifier.parent = newDeclarations[i]; } const newDeclList = ts.updateVariableDeclarationList( @@ -134,12 +131,6 @@ function flipIvySwitchesInVariableStatement( /* modifiers */ stmt.modifiers, /* declarationList */ newDeclList); - // Keeping parent pointers up to date is important for emit. - for (const decl of newDeclarations) { - decl.parent = newDeclList; - } - newDeclList.parent = newStmt; - newStmt.parent = stmt.parent; return newStmt; }