Projects away variables only for child construction nodes
971757
private IQTree projectAwayUnnecessaryVariables(IQTree child, IQProperties currentIQProperties) {
        if (child.getRootNode() instanceof ConstructionNode) {
            ConstructionNode constructionNode = (ConstructionNode) child.getRootNode();

            AscendingSubstitutionNormalization normalization = normalizeAscendingSubstitution(
                    constructionNode.getSubstitution(), projectedVariables);
            Optional<ConstructionNode> proposedConstructionNode = normalization.generateTopConstructionNode();

            if (proposedConstructionNode
                    .filter(c -> c.isSyntacticallyEquivalentTo(constructionNode))
                    .isPresent())
                return child;

            IQTree grandChild = normalization.normalizeChild(((UnaryIQTree) child).getChild());

            return proposedConstructionNode
                    .map(c -> (IQTree) iqFactory.createUnaryIQTree(c, grandChild, currentIQProperties.declareLifted()))
                    .orElse(grandChild);
        }
        else
            return child;
    }
677681
function child_nodes(node) {
  var properties = NODE_TYPES[node["type"]];

  if (properties === undefined) {
    console.error("FATAL".red + ": Unknown node type: " + node["type"]);
    console.trace();
    process.exit(1);
  }

   var x = properties.map(function(p) {
     return node[p];
   });

   return _.flatten(_.compact(x));
}
1264308
def each_node(node, indent)
      # Process named variables for each structure
      variables = node[@value][1].clone

      # The each structure accept missing arguments as well, therefore we need to
      # substitute them with our defaults
      #
      # each in iterable
      # each value in iterable
      # each key, value in iterable

      # Value argument name provided only
      if variables.length == 1
        variables.unshift Settings::DEFAULT_EACH_KEY

      # Missing key and value arguments
      elsif variables.empty?
        variables[0] = Settings::DEFAULT_EACH_KEY
        variables[1] = Settings::DEFAULT_EACH_VALUE
      end

      # Choose whether to apply each with index (Arrays) or each (Hashes) methods
      #buffer_eval "_opulent_send_method = (#{node[@value][1]}.is_a?(Array) ? :each_with_index : :each)"
      case node[@value][0][0]
      when '[]'
        buffer_eval "#{node[@value][0][1]}.each_with_index do |#{variables.reverse.join ', '}|"
      else
        buffer_eval "#{node[@value][0][1]}.each do |#{variables.join ', '}|"
      end

      # Evaluate child nodes
      node[@children].each do |child|
        root child, indent
      end

      # End
      buffer_eval 'end'
    end
863034
def _get_children(node, contexts=False, restrict=None, parent=None):
        """"""
        yield (parent, node) if contexts else node
        if restrict and isinstance(node, restrict):
            return
        for code in node.__children__():
            for child in code.nodes:
                sub = Wikicode._get_children(child, contexts, restrict, code)
                for result in sub:
                    yield result
1349399
private void addOnlyChildElements() {
		for (Node node : nodes) {
			Index index = helper.getIndexInParent(node, false);
			if (index.size==1)
				result.add(node);
		}
	}
750410
def end_nodes(self):
        
        for varname, reg in self._nodes_to_regs():
            # If this part goes until the end of the input string.
            if reg[1] == len(self.string):
                value = self._unescape(varname, self.string[reg[0]: reg[1]])
                yield MatchVariable(varname, value, (reg[0], reg[1]))
1192984
function _cleanUpTOCChildren(node) {

  if (!Array.isArray(node.children)) {
    return node;
  }

  if (_isExampleOrParameterLink(node)) {
    return null;
  }

  const filteredChildren = node.children.reduce((accu, nd) => {
    accu.push(_cleanUpTOCChildren(nd));
    return accu;
  }, []).filter(n => n);

  if (!filteredChildren.length) {
    return null;
  }

  return {
    ...node,
    children: filteredChildren
  };
}
302981
@Override
    public boolean isLeaf(Object nodeObj) {
        if (debugger == null) {
            return true;
        }
        VariableNode node = (VariableNode) nodeObj;
        return children(node).length == 0;
    }
172432
@Override
  public void process(Node externs, Node root) {
    ReferenceCollectingCallback callback =
      new ReferenceCollectingCallback(compiler,
          ReferenceCollectingCallback.DO_NOTHING_BEHAVIOR, new Es6SyntacticScopeCreator(compiler));

    callback.process(root);

    for (Var variable : callback.getAllSymbols()) {
      ReferenceCollection referenceCollection =
          callback.getReferences(variable);

      VariableVisibility visibility;

      if (variableIsParameter(variable)) {
        visibility = VariableVisibility.PARAMETER;
      } else if (variable.isLocal()) {
        if (referenceCollection.isEscaped()) {
          visibility = VariableVisibility.CAPTURED_LOCAL;
        } else {
          visibility = VariableVisibility.LOCAL;
        }
      } else if (variable.isGlobal()) {
        visibility = VariableVisibility.GLOBAL;
      } else {
        throw new IllegalStateException("Un-handled variable visibility for " + variable);
      }

      visibilityByDeclaringNameNode.put(variable.getNameNode(), visibility);
    }
  }
140035
private IQTree updateChild(UnaryIQTree liftedChildTree, ImmutableSubstitution<ImmutableTerm> mergedSubstitution,
                               ImmutableSet<Variable> projectedVariables) {
        ConstructionNode constructionNode = (ConstructionNode) liftedChildTree.getRootNode();

        ConstructionNodeTools.NewSubstitutionPair substitutionPair = constructionTools.traverseConstructionNode(
                mergedSubstitution, constructionNode.getSubstitution(),
                constructionNode.getVariables(), projectedVariables);

        // NB: this is expected to be ok given that the expected compatibility of the merged substitution with
        // this construction node
        ImmutableSubstitution<? extends VariableOrGroundTerm> descendingSubstitution =
                substitutionFactory.getSubstitution(
                        (ImmutableMap<Variable, ? extends VariableOrGroundTerm>)(ImmutableMap<Variable, ?>)
                                substitutionPair.propagatedSubstitution.getImmutableMap());

        IQTree newChild = liftedChildTree.getChild()
                .applyDescendingSubstitution(descendingSubstitution, Optional.empty());

        ConstructionNode newConstructionNode = iqFactory.createConstructionNode(projectedVariables,
                    substitutionPair.bindings);

        return substitutionPair.bindings.isEmpty()
                ? newChild
                : iqFactory.createUnaryIQTree(newConstructionNode, newChild);
    }
1238788
function removeChildren(node) {
    node = node.lastChild;
    while (node) {
      var next = node.previousSibling;
      recollectNodeTree(node, true);
      node = next;
    }
  }
1322438
private void updateGlobalNameDeclarationAtVariableNode(
      Name n, boolean canCollapseChildNames) {
    if (!canCollapseChildNames) {
      return;
    }

    Ref ref = n.getDeclaration();
    String name = ref.getNode().getString();
    Node rvalue = ref.getNode().getFirstChild();
    Node variableNode = ref.getNode().getParent();
    Node grandparent = variableNode.getParent();

    boolean isObjLit = rvalue.isObjectLit();

    if (isObjLit) {
      declareVariablesForObjLitValues(
          n, name, rvalue, variableNode, variableNode.getPrevious(), grandparent);
    }

    addStubsForUndeclaredProperties(n, name, grandparent, variableNode);

    if (isObjLit && canEliminate(n)) {
      variableNode.removeChild(ref.getNode());
      compiler.reportChangeToEnclosingScope(variableNode);
      if (!variableNode.hasChildren()) {
        grandparent.removeChild(variableNode);
      }

      // Clear out the object reference, since we've eliminated it from the
      // parse tree.
      n.updateRefNode(ref, null);
    }
  }
945493
function build(node, buildBody) {
  var self = node.blocks.shift();
  if (!self) return;

  var child = build(node, buildBody);
  if (!child) {
    // last item
    child = buildBody();

    // add a filter as this is our final stop
    if (node.filter) {
      child = t.ifStatement(node.filter, t.blockStatement([child]));
    }
  }

  return t.forOfStatement(t.variableDeclaration("let", [t.variableDeclarator(self.left)]), self.right, t.blockStatement([child]));
}
165500
private IQTree liftChildConstructionNode(ConstructionNode newChildRoot, UnaryIQTree newChild, IQProperties liftedProperties) {

        UnaryIQTree newOrderByTree = iqFactory.createUnaryIQTree(
                applySubstitution(newChildRoot.getSubstitution()),
                newChild.getChild(),
                liftedProperties);

        return iqFactory.createUnaryIQTree(newChildRoot, newOrderByTree, liftedProperties);
    }
627242
@Override
    public void makeBuildVariables(AbstractBuild build, Map<String, String> variables) {
        // global var/password pairs
        MaskPasswordsConfig config = MaskPasswordsConfig.getInstance();
        List<VarPasswordPair> globalVarPasswordPairs = config.getGlobalVarPasswordPairs();
        // we can't use variables.putAll() since passwords are ciphered when in varPasswordPairs
        for(VarPasswordPair globalVarPasswordPair: globalVarPasswordPairs) {
            variables.put(globalVarPasswordPair.getVar(), globalVarPasswordPair.getPassword());
        }

        // job's var/password pairs
        if(varPasswordPairs != null) {
            // cf. comment above
            for(VarPasswordPair varPasswordPair: varPasswordPairs) {
                if(StringUtils.isNotBlank(varPasswordPair.getVar())) {
                    variables.put(varPasswordPair.getVar(), varPasswordPair.getPassword());
                }
            }
        }
    }
226469
function detree(items, children, parent_id) {

		var item,
		    i;

		for (i = 0; i < children.length; i++) {

			item = children[i];

			if (parent_id) {
				item.parent = parent_id;
			}

			items.push(item);

			if (item.children) {
				detree(items, item.children, item.id);
			}

			delete item.children;
		}
	}
875701
private IQTree liftBindingFromLiftedChildren(ImmutableList<IQTree> liftedChildren, VariableGenerator variableGenerator,
                                                 IQProperties currentIQProperties) {

        /*
         * Cannot lift anything if some children do not have a construction node
         */
        if (liftedChildren.stream()
                .anyMatch(c -> !(c.getRootNode() instanceof ConstructionNode)))
            return iqFactory.createNaryIQTree(this, liftedChildren, currentIQProperties.declareLifted());

        ImmutableSubstitution<ImmutableTerm> mergedSubstitution = mergeChildSubstitutions(
                    projectedVariables,
                    liftedChildren.stream()
                            .map(c -> (ConstructionNode) c.getRootNode())
                            .map(ConstructionNode::getSubstitution)
                            .collect(ImmutableCollectors.toList()),
                    variableGenerator);

        if (mergedSubstitution.isEmpty()) {
            return iqFactory.createNaryIQTree(this, liftedChildren, currentIQProperties.declareLifted());
        }
        ConstructionNode newRootNode = iqFactory.createConstructionNode(projectedVariables, mergedSubstitution);

        ImmutableSet<Variable> unionVariables = newRootNode.getChildVariables();
        UnionNode newUnionNode = iqFactory.createUnionNode(unionVariables);

        NaryIQTree unionIQ = iqFactory.createNaryIQTree(newUnionNode,
                liftedChildren.stream()
                        .map(c -> (UnaryIQTree) c)
                        .map(c -> updateChild(c, mergedSubstitution, unionVariables))
                        .collect(ImmutableCollectors.toList()));

        return iqFactory.createUnaryIQTree(newRootNode, unionIQ);
    }