MCPcopy Index your code
hub / github.com/nodejs/node / cloneNode

Function cloneNode

test/fixtures/snapshot/typescript.js:26618–26640  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

26616 : node;
26617 }
26618 function cloneNode(node) {
26619 // We don't use "clone" from core.ts here, as we need to preserve the prototype chain of
26620 // the original node. We also need to exclude specific properties and only include own-
26621 // properties (to skip members already defined on the shared prototype).
26622 if (node === undefined) {
26623 return node;
26624 }
26625 var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */) :
26626 ts.isIdentifier(node) ? baseFactory.createBaseIdentifierNode(79 /* SyntaxKind.Identifier */) :
26627 ts.isPrivateIdentifier(node) ? baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */) :
26628 !ts.isNodeKind(node.kind) ? baseFactory.createBaseTokenNode(node.kind) :
26629 baseFactory.createBaseNode(node.kind);
26630 clone.flags |= (node.flags & ~8 /* NodeFlags.Synthesized */);
26631 clone.transformFlags = node.transformFlags;
26632 setOriginalNode(clone, node);
26633 for (var key in node) {
26634 if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) {
26635 continue;
26636 }
26637 clone[key] = node[key];
26638 }
26639 return clone;
26640 }
26641 function createImmediatelyInvokedFunctionExpression(statements, param, paramValue) {
26642 return createCallExpression(createFunctionExpression(
26643 /*modifiers*/ undefined,

Callers 2

getNameFunction · 0.85
getNamespaceMemberNameFunction · 0.85

Calls 2

setOriginalNodeFunction · 0.85
hasOwnPropertyMethod · 0.45

Tested by

no test coverage detected