[Pkg-javascript-commits] [node-recast] 01/03: New upstream version 0.13.2

Julien Puydt julien.puydt at laposte.net
Mon Feb 19 22:48:59 UTC 2018


This is an automated email from the git hooks/post-receive script.

jpuydt-guest pushed a commit to branch master
in repository node-recast.

commit 96dfc583a0ec3e6529173a7a39f042ccd63fcff4
Author: Julien Puydt <julien.puydt at laposte.net>
Date:   Mon Feb 19 23:45:41 2018 +0100

    New upstream version 0.13.2
---
 lib/printer.js    |  59 ++++++++++++++++++++++----
 package-lock.json | 122 +++++++++++++++++++++++++++---------------------------
 package.json      |  10 ++---
 test/babylon.js   |  13 ++++++
 test/jsx.js       |  19 ++++++++-
 test/lines.js     |  36 ++++++++--------
 test/printer.js   |  27 ++++++++++++
 yarn.lock         |  28 +++++++------
 8 files changed, 208 insertions(+), 106 deletions(-)

diff --git a/lib/printer.js b/lib/printer.js
index 9c9787b..9bc2a58 100644
--- a/lib/printer.js
+++ b/lib/printer.js
@@ -771,12 +771,31 @@ function genericPrintNoParens(path, options, print) {
     case "BigIntLiteral": // Babel 7 Literal split
         return fromString(n.value + "n");
 
+    case "NumericLiteral": // Babel 6 Literal Split
+        // Keep original representation for numeric values not in base 10.
+        if (n.extra &&
+            typeof n.extra.raw === "string" &&
+            Number(n.extra.raw) === n.value) {
+            return fromString(n.extra.raw, options);
+        }
+
+        return fromString(n.value, options);
+
     case "BooleanLiteral": // Babel 6 Literal split
-    case "NumericLiteral": // Babel 6 Literal split
+
     case "StringLiteral": // Babel 6 Literal split
     case "Literal":
-        if (typeof n.value !== "string")
+        // Numeric values may be in bases other than 10. Use their raw
+        // representation if equivalent.
+        if (typeof n.value === "number" &&
+            typeof n.raw === "string" &&
+            Number(n.raw) === n.value) {
+            return fromString(n.raw, options);
+        }
+
+        if (typeof n.value !== "string") {
             return fromString(n.value, options);
+        }
 
         return fromString(nodeStr(n.value, options), options);
 
@@ -1019,13 +1038,22 @@ function genericPrintNoParens(path, options, print) {
         return concat(parts);
 
     case "CatchClause":
-        parts.push("catch (", path.call(print, "param"));
+        parts.push("catch ");
 
-        if (n.guard)
+        if (n.param) {
+            parts.push("(", path.call(print, "param"));
+        }
+
+        if (n.guard) {
             // Note: esprima does not recognize conditional catch clauses.
             parts.push(" if ", path.call(print, "guard"));
+        }
+
+        if (n.param) {
+            parts.push(") ");
+        }
 
-        parts.push(") ", path.call(print, "body"));
+        parts.push(path.call(print, "body"));
 
         return concat(parts);
 
@@ -1093,10 +1121,17 @@ function genericPrintNoParens(path, options, print) {
         return concat(["{", path.call(print, "expression"), "}"]);
 
     case "JSXElement":
-        var openingLines = path.call(print, "openingElement");
+    case "JSXFragment":
+        var openingPropName = "opening" + (
+            n.type === "JSXElement" ? "Element" : "Fragment");
 
-        if (n.openingElement.selfClosing) {
-            assert.ok(!n.closingElement);
+        var closingPropName = "closing" + (
+            n.type === "JSXElement" ? "Element" : "Fragment");
+
+        var openingLines = path.call(print, openingPropName);
+
+        if (n[openingPropName].selfClosing) {
+            assert.ok(!n[closingPropName]);
             return openingLines;
         }
 
@@ -1117,7 +1152,7 @@ function genericPrintNoParens(path, options, print) {
             }, "children")
         ).indentTail(options.tabWidth);
 
-        var closingLines = path.call(print, "closingElement");
+        var closingLines = path.call(print, closingPropName);
 
         return concat([
             openingLines,
@@ -1158,6 +1193,12 @@ function genericPrintNoParens(path, options, print) {
     case "JSXClosingElement":
         return concat(["</", path.call(print, "name"), ">"]);
 
+    case "JSXOpeningFragment":
+        return fromString("<>");
+
+    case "JSXClosingFragment":
+        return fromString("</>")
+
     case "JSXText":
         return fromString(n.value, options);
 
diff --git a/package-lock.json b/package-lock.json
index 47cfc3e..495abc6 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,13 +1,13 @@
 {
   "name": "recast",
-  "version": "0.13.0",
+  "version": "0.13.2",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
     "acorn": {
-      "version": "5.1.2",
-      "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.1.2.tgz",
-      "integrity": "sha512-o96FZLJBPY1lvTuJylGA9Bk3t/GKPPJG8H0ydQQl01crzwJgspa4AEIq/pVTXigmK0PHVQhiAtn8WMBLL9D2WA==",
+      "version": "5.4.1",
+      "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.4.1.tgz",
+      "integrity": "sha512-XLmq3H/BVvW6/GbxKryGxWORz1ebilSsUDlyC27bXhWGWAZWkGwS6FLHjOlwFXNFoWFQEO/Df4u0YYd0K3BQgQ==",
       "dev": true
     },
     "ansi-regex": {
@@ -23,9 +23,9 @@
       "dev": true
     },
     "ast-types": {
-      "version": "0.10.1",
-      "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.10.1.tgz",
-      "integrity": "sha512-UY7+9DPzlJ9VM8eY0b2TUZcZvF+1pO0hzMtAyjBYKhOmnvRlqYNYnWdtsMj0V16CGaMlpL0G1jnLbLo4AyotuQ=="
+      "version": "0.10.2",
+      "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.10.2.tgz",
+      "integrity": "sha512-ufWX953VU1eIuWqxS0nRDMYlGyFH+yxln5CsmIHlpzEt3fdYqUnRtsFt0XAsQot8OaVCwFqxT1RiwvtzYjeYeg=="
     },
     "babel-code-frame": {
       "version": "6.26.0",
@@ -45,7 +45,7 @@
       "dev": true,
       "requires": {
         "babel-code-frame": "6.26.0",
-        "babel-generator": "6.26.0",
+        "babel-generator": "6.26.1",
         "babel-helpers": "6.24.1",
         "babel-messages": "6.23.0",
         "babel-register": "6.26.0",
@@ -54,10 +54,10 @@
         "babel-traverse": "6.26.0",
         "babel-types": "6.26.0",
         "babylon": "6.18.0",
-        "convert-source-map": "1.5.0",
+        "convert-source-map": "1.5.1",
         "debug": "2.6.9",
         "json5": "0.5.1",
-        "lodash": "4.17.4",
+        "lodash": "4.17.5",
         "minimatch": "3.0.4",
         "path-is-absolute": "1.0.1",
         "private": "0.1.8",
@@ -80,9 +80,9 @@
       }
     },
     "babel-generator": {
-      "version": "6.26.0",
-      "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.0.tgz",
-      "integrity": "sha1-rBriAHC3n248odMmlhMFN3TyDcU=",
+      "version": "6.26.1",
+      "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz",
+      "integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==",
       "dev": true,
       "requires": {
         "babel-messages": "6.23.0",
@@ -90,7 +90,7 @@
         "babel-types": "6.26.0",
         "detect-indent": "4.0.0",
         "jsesc": "1.3.0",
-        "lodash": "4.17.4",
+        "lodash": "4.17.5",
         "source-map": "0.5.7",
         "trim-right": "1.0.1"
       },
@@ -124,7 +124,7 @@
         "babel-helper-function-name": "6.24.1",
         "babel-runtime": "6.26.0",
         "babel-types": "6.26.0",
-        "lodash": "4.17.4"
+        "lodash": "4.17.5"
       }
     },
     "babel-helper-function-name": {
@@ -178,7 +178,7 @@
       "requires": {
         "babel-runtime": "6.26.0",
         "babel-types": "6.26.0",
-        "lodash": "4.17.4"
+        "lodash": "4.17.5"
       }
     },
     "babel-helper-replace-supers": {
@@ -251,7 +251,7 @@
         "babel-template": "6.26.0",
         "babel-traverse": "6.26.0",
         "babel-types": "6.26.0",
-        "lodash": "4.17.4"
+        "lodash": "4.17.5"
       }
     },
     "babel-plugin-transform-es2015-classes": {
@@ -516,9 +516,9 @@
       "requires": {
         "babel-core": "6.26.0",
         "babel-runtime": "6.26.0",
-        "core-js": "2.5.1",
+        "core-js": "2.5.3",
         "home-or-tmp": "2.0.0",
-        "lodash": "4.17.4",
+        "lodash": "4.17.5",
         "mkdirp": "0.5.1",
         "source-map-support": "0.4.18"
       }
@@ -529,8 +529,8 @@
       "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
       "dev": true,
       "requires": {
-        "core-js": "2.5.1",
-        "regenerator-runtime": "0.11.0"
+        "core-js": "2.5.3",
+        "regenerator-runtime": "0.11.1"
       }
     },
     "babel-template": {
@@ -543,7 +543,7 @@
         "babel-traverse": "6.26.0",
         "babel-types": "6.26.0",
         "babylon": "6.18.0",
-        "lodash": "4.17.4"
+        "lodash": "4.17.5"
       },
       "dependencies": {
         "babylon": {
@@ -568,7 +568,7 @@
         "debug": "2.6.9",
         "globals": "9.18.0",
         "invariant": "2.2.2",
-        "lodash": "4.17.4"
+        "lodash": "4.17.5"
       },
       "dependencies": {
         "babylon": {
@@ -587,14 +587,14 @@
       "requires": {
         "babel-runtime": "6.26.0",
         "esutils": "2.0.2",
-        "lodash": "4.17.4",
+        "lodash": "4.17.5",
         "to-fast-properties": "1.0.3"
       }
     },
     "babylon": {
-      "version": "7.0.0-beta.32",
-      "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.32.tgz",
-      "integrity": "sha512-PvAmyP2IJEBVAuE5yVzrTSWCCN9VMa1eGns8w3w6FYD/ivHSUmS7n+F40Fmjn+0nCQSUFR96wP0CqQ4jxTnF4Q==",
+      "version": "7.0.0-beta.40",
+      "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.40.tgz",
+      "integrity": "sha512-AVxF2EcxvGD5hhOuLTOLAXBb0VhwWpEX0HyHdAI2zU+AAP4qEwtQj8voz1JR3uclGai0rfcE+dCTHnNMOnimFg==",
       "dev": true
     },
     "balanced-match": {
@@ -604,9 +604,9 @@
       "dev": true
     },
     "brace-expansion": {
-      "version": "1.1.8",
-      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz",
-      "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=",
+      "version": "1.1.11",
+      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
+      "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
       "dev": true,
       "requires": {
         "balanced-match": "1.0.0",
@@ -645,15 +645,15 @@
       "dev": true
     },
     "convert-source-map": {
-      "version": "1.5.0",
-      "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.0.tgz",
-      "integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=",
+      "version": "1.5.1",
+      "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.1.tgz",
+      "integrity": "sha1-uCeAl7m8IpNl3lxiz1/K7YtVmeU=",
       "dev": true
     },
     "core-js": {
-      "version": "2.5.1",
-      "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz",
-      "integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs=",
+      "version": "2.5.3",
+      "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.3.tgz",
+      "integrity": "sha1-isw4NFgk8W2DZbfJtCWRaOjtYD4=",
       "dev": true
     },
     "debug": {
@@ -704,9 +704,9 @@
       "dev": true
     },
     "flow-parser": {
-      "version": "0.59.0",
-      "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.59.0.tgz",
-      "integrity": "sha1-9uvK5h/6GH5CCZnUDOCoAfObJjU=",
+      "version": "0.66.0",
+      "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.66.0.tgz",
+      "integrity": "sha1-vlg/77ARkqpRZEFdMaYkGzVxiYM=",
       "dev": true
     },
     "fs.realpath": {
@@ -825,9 +825,9 @@
       "dev": true
     },
     "lodash": {
-      "version": "4.17.4",
-      "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz",
-      "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=",
+      "version": "4.17.5",
+      "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.5.tgz",
+      "integrity": "sha512-svL3uiZf1RwhH+cWrfZn3A4+U58wbP0tGVTLQPbjplZxZ8ROD9VLuNgsRniTlLe7OlSqR79RUehXgpBW/s0IQw==",
       "dev": true
     },
     "loose-envify": {
@@ -845,7 +845,7 @@
       "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
       "dev": true,
       "requires": {
-        "brace-expansion": "1.1.8"
+        "brace-expansion": "1.1.11"
       }
     },
     "minimist": {
@@ -864,9 +864,9 @@
       }
     },
     "minizlib": {
-      "version": "1.0.4",
-      "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.0.4.tgz",
-      "integrity": "sha512-sN4U9tIJtBRwKbwgFh9qJfrPIQ/GGTRr1MGqkgOeMTLy8/lM0FcWU//FqlnZ3Vb7gJ+Mxh3FOg1EklibdajbaQ==",
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.1.0.tgz",
+      "integrity": "sha512-4T6Ur/GctZ27nHfpt9THOdRZNgyJ9FZchYO1ceg5S8Q3DNLCKYy44nCZzgCJgcvx2UM8czmqak5BCxJMrq37lA==",
       "dev": true,
       "requires": {
         "minipass": "2.2.1"
@@ -882,9 +882,9 @@
       }
     },
     "mocha": {
-      "version": "4.0.1",
-      "resolved": "https://registry.npmjs.org/mocha/-/mocha-4.0.1.tgz",
-      "integrity": "sha512-evDmhkoA+cBNiQQQdSKZa2b9+W2mpLoj50367lhy+Klnx9OV8XlCIhigUnn1gaTFLQCa0kdNhEGDr0hCXOQFDw==",
+      "version": "5.0.1",
+      "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.0.1.tgz",
+      "integrity": "sha512-SpwyojlnE/WRBNGtvJSNfllfm5PqEDFxcWluSIgLeSBJtXG4DmoX2NNAeEA7rP5kK+79VgtVq8nG6HskaL1ykg==",
       "dev": true,
       "requires": {
         "browser-stdout": "1.3.0",
@@ -970,9 +970,9 @@
       "dev": true
     },
     "regenerator-runtime": {
-      "version": "0.11.0",
-      "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz",
-      "integrity": "sha512-/aA0kLeRb5N9K0d4fw7ooEbI+xDe+DKD499EQqygGqeS8N3xto15p09uY2xj7ixP81sNPXvRLnAQIqdVStgb1A==",
+      "version": "0.11.1",
+      "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
+      "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==",
       "dev": true
     },
     "regenerator-transform": {
@@ -1021,14 +1021,14 @@
       }
     },
     "reify": {
-      "version": "0.12.3",
-      "resolved": "https://registry.npmjs.org/reify/-/reify-0.12.3.tgz",
-      "integrity": "sha512-s13k0kuZbhBzeRoJQGomWnLj2y10wK3FYXRXbZoydowAMmY0jTiFN98TgLkaE8uZkVCaoq3djnDo7mksWLsx4g==",
+      "version": "0.14.1",
+      "resolved": "https://registry.npmjs.org/reify/-/reify-0.14.1.tgz",
+      "integrity": "sha512-HAKYzqlCCWsfAcOTm8gsJZ6FE5I06kvjzHRQTCDD6xqUJaY8Mh4ve9oiCDe8yiYXOqZqpt03gn8yS4+bokRmhQ==",
       "dev": true,
       "requires": {
-        "acorn": "5.1.2",
-        "minizlib": "1.0.4",
-        "semver": "5.4.1"
+        "acorn": "5.4.1",
+        "minizlib": "1.1.0",
+        "semver": "5.5.0"
       }
     },
     "repeating": {
@@ -1041,9 +1041,9 @@
       }
     },
     "semver": {
-      "version": "5.4.1",
-      "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz",
-      "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==",
+      "version": "5.5.0",
+      "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz",
+      "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==",
       "dev": true
     },
     "slash": {
diff --git a/package.json b/package.json
index ccc5667..37c0dfa 100644
--- a/package.json
+++ b/package.json
@@ -12,7 +12,7 @@
     "parsing",
     "pretty-printing"
   ],
-  "version": "0.13.0",
+  "version": "0.13.2",
   "homepage": "http://github.com/benjamn/recast",
   "repository": {
     "type": "git",
@@ -28,7 +28,7 @@
     "fs": false
   },
   "dependencies": {
-    "ast-types": "0.10.1",
+    "ast-types": "0.10.2",
     "esprima": "~4.0.0",
     "private": "~0.1.5",
     "source-map": "~0.6.1"
@@ -38,9 +38,9 @@
     "babel-preset-es2015": "^6.22.0",
     "babylon": "~7.0.0-beta.31",
     "esprima-fb": "^15001.1001.0-dev-harmony-fb",
-    "mocha": "~4.0.1",
-    "flow-parser": "^0.59.0",
-    "reify": "^0.12.3",
+    "flow-parser": "^0.66.0",
+    "mocha": "~5.0.0",
+    "reify": "^0.14.1",
     "semver": "^5.3.0"
   },
   "engines": {
diff --git a/test/babylon.js b/test/babylon.js
index 96e4f92..157827a 100644
--- a/test/babylon.js
+++ b/test/babylon.js
@@ -411,4 +411,17 @@ describe("Babel", function () {
       }
     });
   });
+
+  it("prints numbers in bases other than 10 without converting them", function() {
+    var code = [
+      'let decimal = 6;',
+      'let hex = 0xf00d;',
+      'let binary = 0b1010;',
+      'let octal = 0o744;'
+    ].join(eol);
+
+    var ast = recast.parse(code, parseOptions);
+    var output = recast.print(ast, { tabWidth: 2 }).code;
+    assert.strictEqual(output, code);
+  });
 });
diff --git a/test/jsx.js b/test/jsx.js
index 082dd09..ba3aef1 100644
--- a/test/jsx.js
+++ b/test/jsx.js
@@ -4,10 +4,16 @@ var types = require("../lib/types");
 
 describe("JSX Compatability", function() {
   var printer = new Printer({ tabWidth: 2 });
+  var parseOptions = {
+    parser: require("reify/lib/parsers/babylon")
+  };
 
   function check(source) {
-    var ast1 = parse(source);
-    var ast2 = parse(printer.printGenerically(ast1).code);
+    var ast1 = parse(source, parseOptions);
+    var ast2 = parse(
+      printer.printGenerically(ast1).code,
+      parseOptions
+    );
     types.astNodesAreEquivalent.assert(ast1, ast2);
   }
 
@@ -44,4 +50,13 @@ describe("JSX Compatability", function() {
   it("should parse and print namespaced elements", function() {
     check("<Foo.Bar />");
   });
+
+  it("should parse and print fragments", function() {
+    check([
+      "<>",
+      "  <td>Hello</td>",
+      "  <td>world!</td>",
+      "</>",
+    ].join("\n"));
+  });
 });
diff --git a/test/lines.js b/test/lines.js
index da11afa..da1ce2a 100644
--- a/test/lines.js
+++ b/test/lines.js
@@ -7,11 +7,14 @@ var concat = linesModule.concat;
 var eol = require("os").EOL;
 
 function check(a, b) {
-    assert.strictEqual(a.toString(), b.toString());
+    assert.strictEqual(a.toString({
+        lineTerminator: eol
+    }), b.toString({
+        lineTerminator: eol
+    }));
 }
 
 describe("lines", function() {
-
     describe('line terminators', function() {
         var source = [
             'foo;',
@@ -25,6 +28,7 @@ describe("lines", function() {
             '\u2029',
             '\u000D\u000A',
         ];
+
         terminators.forEach(function(t) {
             it('can handle ' + escape(t) + ' as line terminator', function() {
                 var lines = fromString(source.join(t));
@@ -34,7 +38,6 @@ describe("lines", function() {
         });
     });
 
-
     it("FromString", function() {
         function checkIsCached(s) {
             assert.strictEqual(fromString(s), fromString(s));
@@ -59,10 +62,9 @@ describe("lines", function() {
         assert.strictEqual(fromString(longerLines), longerLines);
     });
 
-    it("ToString", function() {
-        var code = arguments.callee + "",
-            lines = fromString(code);
-
+    it("ToString", function ToStringTest() {
+        var code = String(ToStringTest);
+        var lines = fromString(code);
         check(lines, code);
         check(lines.indentTail(5)
                    .indentTail(-7)
@@ -108,8 +110,8 @@ describe("lines", function() {
         assert.strictEqual(joined, withoutSpaces);
     }
 
-    it("EachPos", function() {
-        var code = (arguments.callee + "");
+    it("EachPos", function EachPosTest() {
+        var code = String(EachPosTest);
         var lines = fromString(code);
 
         testEachPosHelper(lines, code);
@@ -124,10 +126,10 @@ describe("lines", function() {
         testEachPosHelper(lines, code);
     });
 
-    it("CharAt", function() {
+    it("CharAt", function CharAtTest() {
         // Function.prototype.toString uses \r\n line endings on non-*NIX
         // systems, so normalize those to \n characters.
-        var code = (arguments.callee + "").replace(/\r\n/g, "\n");
+        var code = String(CharAtTest).replace(/\r\n/g, "\n");
         var lines = fromString(code);
 
         function compare(pos) {
@@ -269,8 +271,8 @@ describe("lines", function() {
         });
     });
 
-    it("Slice", function() {
-        var code = arguments.callee + "",
+    it("Slice", function SliceTest() {
+        var code = String(SliceTest),
             lines = fromString(code);
         checkAllSlices(lines);
     });
@@ -291,8 +293,8 @@ describe("lines", function() {
                  end: lines.lastPos() };
     }
 
-    it("GetSourceLocation", function() {
-        var code = arguments.callee + "",
+    it("GetSourceLocation", function GetSourceLocationTest() {
+        var code = String(GetSourceLocationTest),
             lines = fromString(code);
 
         function verify(indent) {
@@ -497,8 +499,8 @@ describe("lines", function() {
         ].join(eol));
     });
 
-    it("GuessTabWidth", function(done) {
-        var lines = fromString(arguments.callee + "");
+    it("GuessTabWidth", function GuessTabWidthTest(done) {
+        var lines = fromString(String(GuessTabWidthTest));
         assert.strictEqual(lines.guessTabWidth(), 4);
 
         lines = fromString([
diff --git a/test/printer.js b/test/printer.js
index 0c1d52e..171fd1a 100644
--- a/test/printer.js
+++ b/test/printer.js
@@ -1699,4 +1699,31 @@ describe("printer", function() {
       "(1).foo"
     );
   });
+
+  it("prints numbers in bases other than 10 without converting them", function() {
+    var code = [
+      'let decimal = 6;',
+      'let hex = 0xf00d;',
+      'let binary = 0b1010;',
+      'let octal = 0o744;'
+    ].join(eol);
+    var ast = parse(code);
+    var printer = new Printer({});
+    var pretty = printer.printGenerically(ast).code;
+
+    assert.strictEqual(pretty, code);
+  });
+
+  it("reprints modified numeric literals", function () {
+    const code = '3 + 4;';
+    const ast = parse(code);
+    const expr = ast.program.body[0].expression;
+    const left = expr.left;
+    const right = expr.right;
+
+    left.value++;
+    right.value++;
+
+    assert.strictEqual(recast.print(ast).code, '4 + 5;');
+  });
 });
diff --git a/yarn.lock b/yarn.lock
index 5571079..a2fbf76 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -14,9 +14,9 @@ ansi-styles@^2.2.1:
   version "2.2.1"
   resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
 
-ast-types at 0.9.14:
-  version "0.9.14"
-  resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.14.tgz#d34ba5dffb9d15a44351fd2a9d82e4ab2838b5ba"
+ast-types at 0.10.1:
+  version "0.10.1"
+  resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.10.1.tgz#f52fca9715579a14f841d67d7f8d25432ab6a3dd"
 
 babel-code-frame@^6.26.0:
   version "6.26.0"
@@ -412,10 +412,14 @@ babel-types@^6.19.0, babel-types@^6.24.1, babel-types@^6.26.0:
     lodash "^4.17.4"
     to-fast-properties "^1.0.3"
 
-babylon@^6.18.0, babylon@~6.18.0:
+babylon@^6.18.0:
   version "6.18.0"
   resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3"
 
+babylon@~7.0.0-beta.31:
+  version "7.0.0-beta.40"
+  resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.40.tgz#91fc8cd56d5eb98b28e6fde41045f2957779940a"
+
 balanced-match@^1.0.0:
   version "1.0.0"
   resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
@@ -453,7 +457,7 @@ convert-source-map@^1.5.0:
   version "1.5.0"
   resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.0.tgz#9acd70851c6d5dfdd93d9282e5edf94a03ff46b5"
 
-core-js@^2.4.0, core-js@^2.4.1, core-js@^2.5.0:
+core-js@^2.4.0, core-js@^2.5.0:
   version "2.5.1"
   resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.1.tgz#ae6874dc66937789b80754ff5428df66819ca50b"
 
@@ -495,9 +499,9 @@ esutils@^2.0.2:
   version "2.0.2"
   resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b"
 
-flow-parser@^0.57.3:
-  version "0.57.3"
-  resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.57.3.tgz#b8d241a1b1cbae043afa7976e39f269988d8fe34"
+flow-parser@^0.59.0:
+  version "0.59.0"
+  resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.59.0.tgz#f6ebcae61ffa187e420999d40ce0a801f39b2635"
 
 fs.realpath@^1.0.0:
   version "1.0.0"
@@ -602,17 +606,17 @@ minimist at 0.0.8:
   version "0.0.8"
   resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"
 
-minipass@^2.0.0:
+minipass@^2.2.1:
   version "2.2.1"
   resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.2.1.tgz#5ada97538b1027b4cf7213432428578cb564011f"
   dependencies:
     yallist "^3.0.0"
 
 minizlib@^1.0.3:
-  version "1.0.3"
-  resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.0.3.tgz#d5c1abf77be154619952e253336eccab9b2a32f5"
+  version "1.1.0"
+  resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.1.0.tgz#11e13658ce46bc3a70a267aac58359d1e0c29ceb"
   dependencies:
-    minipass "^2.0.0"
+    minipass "^2.2.1"
 
 mkdirp at 0.5.1, mkdirp@^0.5.1:
   version "0.5.1"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-recast.git



More information about the Pkg-javascript-commits mailing list