function combineChildMatches(list1, list2) {
    var res = [];

    if (list1.length === 0 || list2.length === 0) {
      return res;
    }

    var merged;

    for (var i1 = 0; i1 < list1.length; i1++) {
      for (var i2 = 0; i2 < list2.length; i2++) {
        merged = mergeMatch(list1[i1], list2[i2]);

        if (merged) {
          res.push(merged);
        }
      }
    }

    return res;
  }
Combine two lists of matches by applying mergeMatch to the cartesian product of two lists of matches.
Each list represents matches found in one child of a node.