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

Function createClassFromVariableDeclaration

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

Source from the content-addressed store, hash-verified

151301 }
151302 }
151303 function createClassFromVariableDeclaration(node) {
151304 var initializer = node.initializer;
151305 if (!initializer || !ts.isFunctionExpression(initializer) || !ts.isIdentifier(node.name)) {
151306 return undefined;
151307 }
151308 var memberElements = createClassElementsFromSymbol(node.symbol);
151309 if (initializer.body) {
151310 memberElements.unshift(ts.factory.createConstructorDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, initializer.parameters, initializer.body));
151311 }
151312 var modifiers = getModifierKindFromSource(node.parent.parent, 93 /* SyntaxKind.ExportKeyword */);
151313 var cls = ts.factory.createClassDeclaration(/*decorators*/ undefined, modifiers, node.name,
151314 /*typeParameters*/ undefined, /*heritageClauses*/ undefined, memberElements);
151315 // Don't call copyComments here because we'll already leave them in place
151316 return cls;
151317 }
151318 function createClassFromFunctionDeclaration(node) {
151319 var memberElements = createClassElementsFromSymbol(ctorSymbol);
151320 if (node.body) {

Callers 1

doChangeFunction · 0.85

Calls 3

unshiftMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…