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

Function processLoopVariableDeclaration

test/fixtures/snapshot/typescript.js:100869–100900  ·  view source on GitHub ↗
(container, decl, loopParameters, loopOutParameters, hasCapturedBindingsInForHead)

Source from the content-addressed store, hash-verified

100867 });
100868 }
100869 function processLoopVariableDeclaration(container, decl, loopParameters, loopOutParameters, hasCapturedBindingsInForHead) {
100870 var name = decl.name;
100871 if (ts.isBindingPattern(name)) {
100872 for (var _i = 0, _a = name.elements; _i < _a.length; _i++) {
100873 var element = _a[_i];
100874 if (!ts.isOmittedExpression(element)) {
100875 processLoopVariableDeclaration(container, element, loopParameters, loopOutParameters, hasCapturedBindingsInForHead);
100876 }
100877 }
100878 }
100879 else {
100880 loopParameters.push(factory.createParameterDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, name));
100881 var checkFlags = resolver.getNodeCheckFlags(decl);
100882 if (checkFlags & 4194304 /* NodeCheckFlags.NeedsLoopOutParameter */ || hasCapturedBindingsInForHead) {
100883 var outParamName = factory.createUniqueName("out_" + ts.idText(name));
100884 var flags = 0;
100885 if (checkFlags & 4194304 /* NodeCheckFlags.NeedsLoopOutParameter */) {
100886 flags |= 1 /* LoopOutParameterFlags.Body */;
100887 }
100888 if (ts.isForStatement(container)) {
100889 if (container.initializer && resolver.isBindingCapturedByNode(container.initializer, decl)) {
100890 flags |= 2 /* LoopOutParameterFlags.Initializer */;
100891 }
100892 if (container.condition && resolver.isBindingCapturedByNode(container.condition, decl) ||
100893 container.incrementor && resolver.isBindingCapturedByNode(container.incrementor, decl)) {
100894 flags |= 1 /* LoopOutParameterFlags.Body */;
100895 }
100896 }
100897 loopOutParameters.push({ flags: flags, originalName: name, outParamName: outParamName });
100898 }
100899 }
100900 }
100901 /**
100902 * Adds the members of an object literal to an array of expressions.
100903 *

Callers 1

createConvertedLoopStateFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected