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
This commit is contained in:
parent
e56c8bf8d1
commit
4390e10dfd
|
@ -120,9 +120,6 @@ function flipIvySwitchesInVariableStatement(
|
||||||
/* name */ decl.name,
|
/* name */ decl.name,
|
||||||
/* type */ decl.type,
|
/* type */ decl.type,
|
||||||
/* initializer */ newIdentifier);
|
/* initializer */ newIdentifier);
|
||||||
|
|
||||||
// Keeping parent pointers up to date is important for emit.
|
|
||||||
newIdentifier.parent = newDeclarations[i];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const newDeclList = ts.updateVariableDeclarationList(
|
const newDeclList = ts.updateVariableDeclarationList(
|
||||||
|
@ -134,12 +131,6 @@ function flipIvySwitchesInVariableStatement(
|
||||||
/* modifiers */ stmt.modifiers,
|
/* modifiers */ stmt.modifiers,
|
||||||
/* declarationList */ newDeclList);
|
/* 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;
|
return newStmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue