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

Function visitClassLike

test/fixtures/snapshot/typescript.js:94886–94909  ·  view source on GitHub ↗

* Set up the environment for a class.

(node)

Source from the content-addressed store, hash-verified

94884 * Set up the environment for a class.
94885 */
94886 function visitClassLike(node) {
94887 if (!ts.forEach(node.members, doesClassElementNeedTransform)) {
94888 return ts.visitEachChild(node, visitor, context);
94889 }
94890 var savedPendingExpressions = pendingExpressions;
94891 pendingExpressions = undefined;
94892 startClassLexicalEnvironment();
94893 if (shouldTransformPrivateElementsOrClassStaticBlocks) {
94894 var name = ts.getNameOfDeclaration(node);
94895 if (name && ts.isIdentifier(name)) {
94896 getPrivateIdentifierEnvironment().className = ts.idText(name);
94897 }
94898 var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node);
94899 if (ts.some(privateInstanceMethodsAndAccessors)) {
94900 getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name);
94901 }
94902 }
94903 var result = ts.isClassDeclaration(node) ?
94904 visitClassDeclaration(node) :
94905 visitClassExpression(node);
94906 endClassLexicalEnvironment();
94907 pendingExpressions = savedPendingExpressions;
94908 return result;
94909 }
94910 function doesClassElementNeedTransform(node) {
94911 return ts.isPropertyDeclaration(node) || ts.isClassStaticBlockDeclaration(node) || (shouldTransformPrivateElementsOrClassStaticBlocks && node.name && ts.isPrivateIdentifier(node.name));
94912 }

Callers 1

visitorWorkerFunction · 0.85

Calls 9

visitClassDeclarationFunction · 0.85
visitClassExpressionFunction · 0.85
someMethod · 0.80
forEachMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…