From 9ece0cc956215ca1d82bf3f531a98ca44cdf5d66 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Tue, 10 Oct 2017 13:01:06 -0700 Subject: [PATCH] Move getSynthesizedDeepClone to services/utilities.ts --- src/compiler/factory.ts | 10 ---------- src/services/utilities.ts | 12 ++++++++++++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 7d703ffe062..fe183c5e806 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -71,16 +71,6 @@ namespace ts { return clone; } - /** - * Creates a deep, memberwise clone of a node with no source map location. - */ - /* @internal */ - export function getSynthesizedDeepClone(node: T | undefined): T | undefined { - return node - ? getSynthesizedClone(visitEachChild(node, child => getSynthesizedDeepClone(child), nullTransformationContext)) - : undefined; - } - // Literals export function createLiteral(value: string): StringLiteral; diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 6166ceea28c..c22b981b4ff 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1334,4 +1334,16 @@ namespace ts { } return position; } + + /** + * Creates a deep, memberwise clone of a node with no source map location. + * + * WARNING: This is an expensive operation and is only intended to be used in refactorings + * and code fixes (because those are triggered by explicit user actions). + */ + export function getSynthesizedDeepClone(node: T | undefined): T | undefined { + return node + ? getSynthesizedClone(visitEachChild(node, child => getSynthesizedDeepClone(child), nullTransformationContext)) + : undefined; + } }