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

Function transformForOfStatementWithObjectRest

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

Source from the content-addressed store, hash-verified

96905 return result;
96906 }
96907 function transformForOfStatementWithObjectRest(node) {
96908 var initializerWithoutParens = ts.skipParentheses(node.initializer);
96909 if (ts.isVariableDeclarationList(initializerWithoutParens) || ts.isAssignmentPattern(initializerWithoutParens)) {
96910 var bodyLocation = void 0;
96911 var statementsLocation = void 0;
96912 var temp = factory.createTempVariable(/*recordTempVariable*/ undefined);
96913 var statements = [ts.createForOfBindingStatement(factory, initializerWithoutParens, temp)];
96914 if (ts.isBlock(node.statement)) {
96915 ts.addRange(statements, node.statement.statements);
96916 bodyLocation = node.statement;
96917 statementsLocation = node.statement.statements;
96918 }
96919 else if (node.statement) {
96920 ts.append(statements, node.statement);
96921 bodyLocation = node.statement;
96922 statementsLocation = node.statement;
96923 }
96924 return factory.updateForOfStatement(node, node.awaitModifier, ts.setTextRange(factory.createVariableDeclarationList([
96925 ts.setTextRange(factory.createVariableDeclaration(temp), node.initializer)
96926 ], 1 /* NodeFlags.Let */), node.initializer), node.expression, ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), statementsLocation),
96927 /*multiLine*/ true), bodyLocation));
96928 }
96929 return node;
96930 }
96931 function convertForOfStatementHead(node, boundValue) {
96932 var binding = ts.createForOfBindingStatement(factory, node.initializer, boundValue);
96933 var bodyLocation;

Callers 1

visitForOfStatementFunction · 0.85

Calls 2

addRangeMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…