From 380b8df13f3ff9deaf36c6a7aa3ae0c7fd4ce960 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Thu, 5 Oct 2017 15:38:02 -0700 Subject: [PATCH] Introduce getSynthesizedDeepClone --- src/compiler/factory.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index fe183c5e806..84c28abe1a5 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -71,6 +71,15 @@ namespace ts { return clone; } + /** + * Creates a deep, memberwise clone of a node with no source map location. + */ + 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;