MCPcopy Create free account
hub / github.com/nodejs/node / addPropertyDeclaration

Function addPropertyDeclaration

test/fixtures/snapshot/typescript.js:154915–154927  ·  view source on GitHub ↗
(changeTracker, sourceFile, node, tokenName, typeNode, modifierFlags)

Source from the content-addressed store, hash-verified

154913 return typeNode || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */);
154914 }
154915 function addPropertyDeclaration(changeTracker, sourceFile, node, tokenName, typeNode, modifierFlags) {
154916 var modifiers = modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined;
154917 var property = ts.isClassLike(node)
154918 ? ts.factory.createPropertyDeclaration(/*decorators*/ undefined, modifiers, tokenName, /*questionToken*/ undefined, typeNode, /*initializer*/ undefined)
154919 : ts.factory.createPropertySignature(/*modifiers*/ undefined, tokenName, /*questionToken*/ undefined, typeNode);
154920 var lastProp = getNodeToInsertPropertyAfter(node);
154921 if (lastProp) {
154922 changeTracker.insertNodeAfter(sourceFile, lastProp, property);
154923 }
154924 else {
154925 changeTracker.insertMemberAtStart(sourceFile, node, property);
154926 }
154927 }
154928 // Gets the last of the first run of PropertyDeclarations, or undefined if the class does not start with a PropertyDeclaration.
154929 function getNodeToInsertPropertyAfter(node) {
154930 var res;

Callers 2

_loop_15Function · 0.85

Calls 1

Tested by

no test coverage detected