fix(ivy): clone ts.SourceFile in ivy_switch when triggered (#27032)

Make a copy of the ts.SourceFile before modifying it in the ivy_switch
transform. It's suspected that the Bazel tsc_wrapped host's SourceFile
cache has issues when the ts.SourceFiles are mutated.

PR Close #27032
This commit is contained in:
Alex Rickabaugh 2018-11-09 20:31:05 +01:00 committed by Andrew Kushnir
parent c31e78f670
commit d97994b27f
1 changed files with 1 additions and 0 deletions

View File

@ -42,6 +42,7 @@ function flipIvySwitchInFile(sf: ts.SourceFile): ts.SourceFile {
// Only update the statements in the SourceFile if any have changed.
if (newStatements !== undefined) {
sf = ts.getMutableClone(sf);
sf.statements = ts.createNodeArray(newStatements);
}
return sf;