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

Function requiresScopeChangeWorker

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

Source from the content-addressed store, hash-verified

49599 || !!node.initializer && requiresScopeChangeWorker(node.initializer);
49600 }
49601 function requiresScopeChangeWorker(node) {
49602 switch (node.kind) {
49603 case 214 /* SyntaxKind.ArrowFunction */:
49604 case 213 /* SyntaxKind.FunctionExpression */:
49605 case 256 /* SyntaxKind.FunctionDeclaration */:
49606 case 171 /* SyntaxKind.Constructor */:
49607 // do not descend into these
49608 return false;
49609 case 169 /* SyntaxKind.MethodDeclaration */:
49610 case 172 /* SyntaxKind.GetAccessor */:
49611 case 173 /* SyntaxKind.SetAccessor */:
49612 case 296 /* SyntaxKind.PropertyAssignment */:
49613 return requiresScopeChangeWorker(node.name);
49614 case 167 /* SyntaxKind.PropertyDeclaration */:
49615 // static properties in classes introduce temporary variables
49616 if (ts.hasStaticModifier(node)) {
49617 return target < 99 /* ScriptTarget.ESNext */ || !useDefineForClassFields;
49618 }
49619 return requiresScopeChangeWorker(node.name);
49620 default:
49621 // null coalesce and optional chain pre-es2020 produce temporary variables
49622 if (ts.isNullishCoalesce(node) || ts.isOptionalChain(node)) {
49623 return target < 7 /* ScriptTarget.ES2020 */;
49624 }
49625 if (ts.isBindingElement(node) && node.dotDotDotToken && ts.isObjectBindingPattern(node.parent)) {
49626 return target < 4 /* ScriptTarget.ES2017 */;
49627 }
49628 if (ts.isTypeNode(node))
49629 return false;
49630 return ts.forEachChild(node, requiresScopeChangeWorker) || false;
49631 }
49632 }
49633 }
49634 function isConstAssertion(location) {
49635 return (ts.isAssertionExpression(location) && ts.isConstTypeReference(location.type))

Callers 1

requiresScopeChangeFunction · 0.85

Calls 1

forEachChildMethod · 0.80

Tested by

no test coverage detected