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

Function isAssignedInBodyOfForStatement

test/fixtures/snapshot/typescript.js:71876–71897  ·  view source on GitHub ↗
(node, container)

Source from the content-addressed store, hash-verified

71874 return !!links && ts.contains(links.capturedBlockScopeBindings, getSymbolOfNode(decl));
71875 }
71876 function isAssignedInBodyOfForStatement(node, container) {
71877 // skip parenthesized nodes
71878 var current = node;
71879 while (current.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) {
71880 current = current.parent;
71881 }
71882 // check if node is used as LHS in some assignment expression
71883 var isAssigned = false;
71884 if (ts.isAssignmentTarget(current)) {
71885 isAssigned = true;
71886 }
71887 else if ((current.parent.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || current.parent.kind === 220 /* SyntaxKind.PostfixUnaryExpression */)) {
71888 var expr = current.parent;
71889 isAssigned = expr.operator === 45 /* SyntaxKind.PlusPlusToken */ || expr.operator === 46 /* SyntaxKind.MinusMinusToken */;
71890 }
71891 if (!isAssigned) {
71892 return false;
71893 }
71894 // at this point we know that node is the target of assignment
71895 // now check that modification happens inside the statement part of the ForStatement
71896 return !!ts.findAncestor(current, function (n) { return n === container ? "quit" : n === container.statement; });
71897 }
71898 function captureLexicalThis(node, container) {
71899 getNodeLinks(node).flags |= 2 /* NodeCheckFlags.LexicalThis */;
71900 if (container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || container.kind === 171 /* SyntaxKind.Constructor */) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected