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

Function transformFunctionLikeToExpression

test/fixtures/snapshot/typescript.js:99797–99815  ·  view source on GitHub ↗

* Transforms a function-like node into a FunctionExpression. * * @param node The function-like node to transform. * @param location The source-map location for the new FunctionExpression. * @param name The name of the new FunctionExpression.

(node, location, name, container)

Source from the content-addressed store, hash-verified

99795 * @param name The name of the new FunctionExpression.
99796 */
99797 function transformFunctionLikeToExpression(node, location, name, container) {
99798 var savedConvertedLoopState = convertedLoopState;
99799 convertedLoopState = undefined;
99800 var ancestorFacts = container && ts.isClassLike(container) && !ts.isStatic(node)
99801 ? enterSubtree(32670 /* HierarchyFacts.FunctionExcludes */, 65 /* HierarchyFacts.FunctionIncludes */ | 8 /* HierarchyFacts.NonStaticClassElement */)
99802 : enterSubtree(32670 /* HierarchyFacts.FunctionExcludes */, 65 /* HierarchyFacts.FunctionIncludes */);
99803 var parameters = ts.visitParameterList(node.parameters, visitor, context);
99804 var body = transformFunctionBody(node);
99805 if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */ && !name && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */)) {
99806 name = factory.getGeneratedNameForNode(node);
99807 }
99808 exitSubtree(ancestorFacts, 98304 /* HierarchyFacts.FunctionSubtreeExcludes */, 0 /* HierarchyFacts.None */);
99809 convertedLoopState = savedConvertedLoopState;
99810 return ts.setOriginalNode(ts.setTextRange(factory.createFunctionExpression(
99811 /*modifiers*/ undefined, node.asteriskToken, name,
99812 /*typeParameters*/ undefined, parameters,
99813 /*type*/ undefined, body), location),
99814 /*original*/ node);
99815 }
99816 /**
99817 * Transforms the body of a function-like node.
99818 *

Calls 3

enterSubtreeFunction · 0.85
transformFunctionBodyFunction · 0.85
exitSubtreeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…