code: function addRules(current, definition, byFilter) {
      var newFilters = definition.filters,
          newRules = definition.rules,
          updatedFilters, clone, previous;
  
      // The current definition might have been split up into
      // multiple definitions already.
      for (var k = 0; k < current.length; k++) {
          updatedFilters = current[k].filters.cloneWith(newFilters);
          if (updatedFilters) {
              previous = byFilter[updatedFilters];
              if (previous) {
                  // There's already a definition with those exact
                  // filters. Add the current definitions' rules
                  // and stop processing it as the existing rule
                  // has already gone down the inheritance chain.
                  previous.addRules(newRules);
              } else {
                  clone = current[k].clone(updatedFilters);
                  // Make sure that we're only maintaining the clone
                  // when we did actually add rules. If not, there's
                  // no need to keep the clone around.
                  if (clone.addRules(newRules)) {
                      // We inserted an element before this one, so we need
                      // to make sure that in the next loop iteration, we're
                      // not performing the same task for this element again,
                      // hence the k++.
                      byFilter[updatedFilters] = clone;
                      current.splice(k, 0, clone);
                      k++;
                  }
              }
          } else if (updatedFilters === null) {
              // if updatedFilters is null, then adding the filters doesn't
              // invalidate or split the selector, so we addRules to the
              // combined selector
  
              // Filters can be added, but they don't change the
              // filters. This means we don't have to split the
              // definition.
              //
              // this is cloned here because of shared classes, see
              // sharedclass.mss
              current[k] = current[k].clone();
              current[k].addRules(newRules);
          }
          // if updatedFeatures is false, then the filters split the rule,
          // so they aren't the same inheritance chain
      }
      return current;
  }
docs: This function currently modifies 'current'
  @param {Array}  current  current list of rules
  @param {Object} definition a Definition object to add to the rules
  @param {Object} byFilter an object/dictionary of existing filters. This is
  actually keyed `attachment->filter`