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

Function isEvolvingArrayOperationTarget

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

Source from the content-addressed store, hash-verified

70030 // Return true if the given node is 'x' in an 'x.length', x.push(value)', 'x.unshift(value)' or
70031 // 'x[n] = value' operation, where 'n' is an expression of type any, undefined, or a number-like type.
70032 function isEvolvingArrayOperationTarget(node) {
70033 var root = getReferenceRoot(node);
70034 var parent = root.parent;
70035 var isLengthPushOrUnshift = ts.isPropertyAccessExpression(parent) && (parent.name.escapedText === "length" ||
70036 parent.parent.kind === 208 /* SyntaxKind.CallExpression */
70037 && ts.isIdentifier(parent.name)
70038 && ts.isPushOrUnshiftIdentifier(parent.name));
70039 var isElementAssignment = parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ &&
70040 parent.expression === root &&
70041 parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */ &&
70042 parent.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ &&
70043 parent.parent.left === parent &&
70044 !ts.isAssignmentTarget(parent.parent) &&
70045 isTypeAssignableToKind(getTypeOfExpression(parent.argumentExpression), 296 /* TypeFlags.NumberLike */);
70046 return isLengthPushOrUnshift || isElementAssignment;
70047 }
70048 function isDeclarationWithExplicitTypeAnnotation(node) {
70049 return (ts.isVariableDeclaration(node) || ts.isPropertyDeclaration(node) || ts.isPropertySignature(node) || ts.isParameter(node)) &&
70050 !!(ts.getEffectiveTypeAnnotationNode(node) ||

Callers 2

getFlowTypeOfReferenceFunction · 0.85
checkIdentifierFunction · 0.85

Calls 3

getReferenceRootFunction · 0.85
isTypeAssignableToKindFunction · 0.85
getTypeOfExpressionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…