Bug 1520370 - Fix BigInt literal matching in Reflect.parse tests. r=jandem
authorRobin Templeton <robin@igalia.com>
Thu, 17 Jan 2019 08:08:00 +0000
changeset 454288 b179bb22821b9311b1824e725abdc945ab3f57f4
parent 454287 17af08445298eac6597da43c2610d06f4b6a3dc0
child 454289 cbb4720dc4d5c4f782943a888a4e4ed05320134c
push id35392
push userncsoregi@mozilla.com
push dateThu, 17 Jan 2019 21:53:28 +0000
treeherdermozilla-central@24982570fc83 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1520370
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1520370 - Fix BigInt literal matching in Reflect.parse tests. r=jandem Differential Revision: https://phabricator.services.mozilla.com/D16641
js/src/tests/non262/reflect-parse/Match.js
--- a/js/src/tests/non262/reflect-parse/Match.js
+++ b/js/src/tests/non262/reflect-parse/Match.js
@@ -73,17 +73,18 @@ var Match =
     };
 
     function isAtom(x) {
         return (typeof x === "number") ||
             (typeof x === "string") ||
             (typeof x === "boolean") ||
             (x === null) ||
             (x === undefined) ||
-            (typeof x === "object" && x instanceof RegExp);
+            (typeof x === "object" && x instanceof RegExp) ||
+            (typeof x === "bigint");
     }
 
     function isObject(x) {
         return (x !== null) && (typeof x === "object");
     }
 
     function isFunction(x) {
         return typeof x === "function";
@@ -115,16 +116,17 @@ var Match =
         switch (typeof exp) {
         case "string":
         case "undefined":
             if (act !== exp)
                 throw new MatchError("expected " + quote(exp) + ", got " + quote(act));
             return true;
         case "boolean":
         case "number":
+        case "bigint":
             if (exp !== act)
                 throw new MatchError("expected " + exp + ", got " + quote(act));
             return true;
         }
 
         throw new Error("bad pattern: " + exp.toSource());
     }
 
@@ -180,16 +182,19 @@ var Match =
             return matchAtom(act, exp);
 
         if (isArrayLike(exp))
             return matchArray(act, exp);
 
         if (isFunction(exp))
             return matchFunction(act, exp);
 
-        return matchObject(act, exp);
+        if (isObject(exp))
+            return matchObject(act, exp);
+
+        throw new Error("bad pattern: " + exp.toSource());
     }
 
     return { Pattern: Pattern,
              MatchError: MatchError };
 
 })();