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

Function getAssignmentDeclarationKindWorker

test/fixtures/snapshot/typescript.js:16617–16639  ·  view source on GitHub ↗
(expr)

Source from the content-addressed store, hash-verified

16615 }
16616 ts.getNameOrArgument = getNameOrArgument;
16617 function getAssignmentDeclarationKindWorker(expr) {
16618 if (ts.isCallExpression(expr)) {
16619 if (!isBindableObjectDefinePropertyCall(expr)) {
16620 return 0 /* AssignmentDeclarationKind.None */;
16621 }
16622 var entityName = expr.arguments[0];
16623 if (isExportsIdentifier(entityName) || isModuleExportsAccessExpression(entityName)) {
16624 return 8 /* AssignmentDeclarationKind.ObjectDefinePropertyExports */;
16625 }
16626 if (isBindableStaticAccessExpression(entityName) && getElementOrPropertyAccessName(entityName) === "prototype") {
16627 return 9 /* AssignmentDeclarationKind.ObjectDefinePrototypeProperty */;
16628 }
16629 return 7 /* AssignmentDeclarationKind.ObjectDefinePropertyValue */;
16630 }
16631 if (expr.operatorToken.kind !== 63 /* SyntaxKind.EqualsToken */ || !isAccessExpression(expr.left) || isVoidZero(getRightMostAssignedExpression(expr))) {
16632 return 0 /* AssignmentDeclarationKind.None */;
16633 }
16634 if (isBindableStaticNameExpression(expr.left.expression, /*excludeThisKeyword*/ true) && getElementOrPropertyAccessName(expr.left) === "prototype" && ts.isObjectLiteralExpression(getInitializerOfBinaryExpression(expr))) {
16635 // F.prototype = { ... }
16636 return 6 /* AssignmentDeclarationKind.Prototype */;
16637 }
16638 return getAssignmentDeclarationPropertyAccessKind(expr.left);
16639 }
16640 function isVoidZero(node) {
16641 return ts.isVoidExpression(node) && ts.isNumericLiteral(node.expression) && node.expression.text === "0";
16642 }

Callers 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…