function getContainingLoopNode(node) {
			for (
				let currentNode = node;
				currentNode.parent;
				currentNode = currentNode.parent
			) {
				const parent = currentNode.parent;

				switch (parent.type) {
					case "WhileStatement":
					case "DoWhileStatement":
						return parent;

					case "ForStatement":
						// `init` is outside of the loop.
						if (parent.init !== currentNode) {
							return parent;
						}
						break;

					case "ForInStatement":
					case "ForOfStatement":
						// `right` is outside of the loop.
						if (parent.right !== currentNode) {
							return parent;
						}
						break;

					case "ArrowFunctionExpression":
					case "FunctionExpression":
					case "FunctionDeclaration":
						// We need to check nested functions only in case of IIFE.
						if (SKIPPED_IIFE_NODES.has(parent)) {
							break;
						}

						return null;
					default:
						break;
				}
			}

			return null;
		}
Gets the containing loop node of a specified node.

We don't need to check nested functions, so this ignores those, with the exception of IIFE.
`Scope.through` contains references of nested functions.
@param {ASTNode} node An AST node to get.
@returns {ASTNode|null} The containing loop node of the specified node, or
     `null`.