Commit c51e9b55 authored by André Bargull's avatar André Bargull
Browse files

Bug 1782273 - Part 15: Rewrap lines in js/src/builtin/{Set,Sorting,Tuple,Utilities}.js. r=tcampbell

Depends on D153248

Differential Revision: https://phabricator.services.mozilla.com/D153249
parent 6749e858
Loading
Loading
Loading
Loading
+7 −28
Original line number Diff line number Diff line
@@ -32,10 +32,7 @@ function SetUnion(iterable) {

  // Step 2. If Type(set) is not Object, throw a TypeError exception.
  if (!IsObject(set)) {
    ThrowTypeError(
        JSMSG_OBJECT_REQUIRED,
        set === null ? "null" : typeof set
    );
    ThrowTypeError(JSMSG_OBJECT_REQUIRED, set === null ? "null" : typeof set);
  }

  // Step 3. Let Ctr be ? SpeciesConstructor(set, %Set%).
@@ -67,10 +64,7 @@ function SetIntersection(iterable) {

  // Step 2. If Type(set) is not Object, throw a TypeError exception.
  if (!IsObject(set)) {
    ThrowTypeError(
        JSMSG_OBJECT_REQUIRED,
        set === null ? "null" : typeof set
    );
    ThrowTypeError(JSMSG_OBJECT_REQUIRED, set === null ? "null" : typeof set);
  }

  // Step 3. Let Ctr be ? SpeciesConstructor(set, %Set%).
@@ -152,10 +146,7 @@ function SetDifference(iterable) {

  // Step 2. If Type(set) is not Object, throw a TypeError exception.
  if (!IsObject(set)) {
    ThrowTypeError(
        JSMSG_OBJECT_REQUIRED,
        set === null ? "null" : typeof set
    );
    ThrowTypeError(JSMSG_OBJECT_REQUIRED, set === null ? "null" : typeof set);
  }

  // Step 3. Let Ctr be ? SpeciesConstructor(set, %Set%).
@@ -212,10 +203,7 @@ function SetSymmetricDifference(iterable) {

  // Step 2. If Type(set) is not Object, throw a TypeError exception.
  if (!IsObject(set)) {
    ThrowTypeError(
        JSMSG_OBJECT_REQUIRED,
        set === null ? "null" : typeof set
    );
    ThrowTypeError(JSMSG_OBJECT_REQUIRED, set === null ? "null" : typeof set);
  }

  // Step 3. Let Ctr be ? SpeciesConstructor(set, %Set%).
@@ -300,10 +288,7 @@ function SetIsSubsetOf(iterable) {

  // Step 3. If Type(iterable) is not Object, throw a TypeError exception.
  if (!IsObject(iterable)) {
    ThrowTypeError(
        JSMSG_OBJECT_REQUIRED,
        set === null ? "null" : typeof set
    );
    ThrowTypeError(JSMSG_OBJECT_REQUIRED, set === null ? "null" : typeof set);
  }

  // Step 4. Let otherSet be iterable.
@@ -370,10 +355,7 @@ function SetIsSupersetOf(iterable) {

  // Step 2. If Type(set) is not Object, throw a TypeError exception.
  if (!IsObject(set)) {
    ThrowTypeError(
        JSMSG_OBJECT_REQUIRED,
        set === null ? "null" : typeof set
    );
    ThrowTypeError(JSMSG_OBJECT_REQUIRED, set === null ? "null" : typeof set);
  }

  // Step 3. Let hasCheck be ? Get(set, "has").
@@ -430,10 +412,7 @@ function SetIsDisjointFrom(iterable) {

  // Step 2. If Type(set) is not Object, throw a TypeError exception.
  if (!IsObject(set)) {
    ThrowTypeError(
        JSMSG_OBJECT_REQUIRED,
        set === null ? "null" : typeof set
    );
    ThrowTypeError(JSMSG_OBJECT_REQUIRED, set === null ? "null" : typeof set);
  }

  // Step 3. Let hasCheck be ? Get(set, "has").
+3 −6
Original line number Diff line number Diff line
@@ -29,8 +29,7 @@ function InsertionSort(array, from, to, comparefn) {
function Merge(list, out, start, mid, end, comparefn) {
  // Skip lopsided runs to avoid doing useless work.
  // Skip calling the comparator if the sub-list is already sorted.
  if (mid >= end || callContentFunction(comparefn, undefined,
                                        list[mid], list[mid + 1]) <= 0) {
  if (mid >= end || callContentFunction(comparefn, undefined, list[mid], list[mid + 1]) <= 0) {
    for (var i = start; i <= end; i++) {
      DefineDataProperty(out, i, list[i]);
    }
@@ -135,8 +134,7 @@ function MergeSort(array, len, comparefn) {
function MergeTypedArray(list, out, start, mid, end, comparefn) {
  // Skip lopsided runs to avoid doing useless work.
  // Skip calling the comparator if the sub-list is already sorted.
  if (mid >= end || callContentFunction(comparefn, undefined,
                                        list[mid], list[mid + 1]) <= 0) {
  if (mid >= end || callContentFunction(comparefn, undefined, list[mid], list[mid + 1]) <= 0) {
    for (var i = start; i <= end; i++) {
      out[i] = list[i];
    }
@@ -169,8 +167,7 @@ function MergeTypedArray(list, out, start, mid, end, comparefn) {

// Iterative, bottom up, mergesort. Optimized version for TypedArrays.
function MergeSortTypedArray(array, len, comparefn) {
  assert(IsPossiblyWrappedTypedArray(array),
         "MergeSortTypedArray works only with typed arrays.");
  assert(IsPossiblyWrappedTypedArray(array), "MergeSortTypedArray works only with typed arrays.");

  // Use the same TypedArray kind for the buffer.
  var C = ConstructorForTypedArray(array);
+18 −30
Original line number Diff line number Diff line
@@ -222,16 +222,14 @@ function TupleConcat() {
// Tuple.prototype.includes()
function TupleIncludes(valueToFind /* , fromIndex */) {
  var fromIndex = arguments.length > 1 ? arguments[1] : undefined;
  return callFunction(std_Array_includes, ThisTupleValue(this), valueToFind,
                      fromIndex);
  return callFunction(std_Array_includes, ThisTupleValue(this), valueToFind, fromIndex);
}

// proposal-record-tuple
// Tuple.prototype.indexOf()
function TupleIndexOf(valueToFind /* , fromIndex */) {
  var fromIndex = arguments.length > 1 ? arguments[1] : undefined;
  return callFunction(std_Array_indexOf, ThisTupleValue(this),
                      valueToFind, fromIndex);
  return callFunction(std_Array_indexOf, ThisTupleValue(this), valueToFind, fromIndex);
}

// proposal-record-tuple
@@ -282,11 +280,9 @@ function TupleJoin(separator) {
// Tuple.prototype.lastIndexOf()
function TupleLastIndexOf(valueToFind /* , fromIndex */) {
  if (arguments.length < 2) {
    return callFunction(std_Array_lastIndexOf, ThisTupleValue(this),
                        valueToFind);
    return callFunction(std_Array_lastIndexOf, ThisTupleValue(this), valueToFind);
  }
  return callFunction(std_Array_lastIndexOf, ThisTupleValue(this),
                      valueToFind, arguments[1]);
  return callFunction(std_Array_lastIndexOf, ThisTupleValue(this), valueToFind, arguments[1]);
}

// proposal-record-tuple
@@ -307,8 +303,7 @@ function TupleToString() {
// Tuple.prototype.toLocaleString()
function TupleToLocaleString(locales, options) {
  var T = ThisTupleValue(this);
  return callContentFunction(ArrayToLocaleString, TupleToArray(T),
                             locales, options);
  return callContentFunction(ArrayToLocaleString, TupleToArray(T), locales, options);
}

// proposal-record-tuple
@@ -334,8 +329,7 @@ SetCanonicalName($TupleValues, "values");
// proposal-record-tuple
// Tuple.prototype.every()
function TupleEvery(callbackfn) {
  return callContentFunction(ArrayEvery, ThisTupleValue(this),
                             callbackfn);
  return callContentFunction(ArrayEvery, ThisTupleValue(this), callbackfn);
}

// proposal-record-tuple
@@ -385,22 +379,19 @@ function TupleFilter(callbackfn) {
// proposal-record-tuple
// Tuple.prototype.find()
function TupleFind(predicate) {
  return callContentFunction(ArrayFind, ThisTupleValue(this),
                             predicate);
  return callContentFunction(ArrayFind, ThisTupleValue(this), predicate);
}

// proposal-record-tuple
// Tuple.prototype.findIndex()
function TupleFindIndex(predicate) {
  return callContentFunction(ArrayFindIndex, ThisTupleValue(this),
                             predicate);
  return callContentFunction(ArrayFindIndex, ThisTupleValue(this), predicate);
}

// proposal-record-tuple
// Tuple.prototype.forEach()
function TupleForEach(callbackfn) {
  return callContentFunction(ArrayForEach, ThisTupleValue(this),
                             callbackfn);
  return callContentFunction(ArrayForEach, ThisTupleValue(this), callbackfn);
}

// proposal-record-tuple
@@ -443,29 +434,24 @@ function TupleMap(callbackfn) {
// Tuple.prototype.reduce()
function TupleReduce(callbackfn /*, initialVal */) {
  if (arguments.length < 2) {
    return callContentFunction(ArrayReduce, ThisTupleValue(this),
                               callbackfn);
    return callContentFunction(ArrayReduce, ThisTupleValue(this), callbackfn);
  }
  return callContentFunction(ArrayReduce, ThisTupleValue(this),
                                 callbackfn, arguments[1]);
  return callContentFunction(ArrayReduce, ThisTupleValue(this), callbackfn, arguments[1]);
}

// proposal-record-tuple
// Tuple.prototype.reduceRight()
function TupleReduceRight(callbackfn /*, initialVal*/) {
  if (arguments.length < 2) {
    return callContentFunction(ArrayReduceRight, ThisTupleValue(this),
                               callbackfn);
    return callContentFunction(ArrayReduceRight, ThisTupleValue(this), callbackfn);
  }
  return callContentFunction(ArrayReduceRight, ThisTupleValue(this),
                                 callbackfn, arguments[1]);
  return callContentFunction(ArrayReduceRight, ThisTupleValue(this), callbackfn, arguments[1]);
}

// proposal-record-tuple
// Tuple.prototype.some()
function TupleSome(callbackfn) {
  return callContentFunction(ArraySome, ThisTupleValue(this),
                             callbackfn);
  return callContentFunction(ArraySome, ThisTupleValue(this), callbackfn);
}

function FlattenIntoTuple(target, source, depth) {
@@ -483,8 +469,10 @@ function FlattenIntoTuple(target, source, depth) {
  var mapperIsPresent = arguments.length > 3;
  if (mapperIsPresent) {
    mapperFunction = arguments[3];
    assert(IsCallable(mapperFunction) && arguments.length > 4 && depth === 1,
           "FlattenIntoTuple: mapper function must be callable, thisArg present, and depth === 1");
    assert(
      IsCallable(mapperFunction) && arguments.length > 4 && depth === 1,
      "FlattenIntoTuple: mapper function must be callable, thisArg present, and depth === 1"
    );
    thisArg = arguments[4];
  }

+1 −3
Original line number Diff line number Diff line
@@ -182,9 +182,7 @@ function CopyDataProperties(target, source, excludedItems) {

    // We abbreviate this by calling propertyIsEnumerable which is faster
    // and returns false for not defined properties.
    if (!hasOwn(key, excludedItems) &&
        callFunction(std_Object_propertyIsEnumerable, from, key))
    {
    if (!hasOwn(key, excludedItems) && callFunction(std_Object_propertyIsEnumerable, from, key)) {
      DefineDataProperty(target, key, from[key]);
    }
  }