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

Julien Puydt julien.puydt at laposte.net
Thu Apr 6 07:20:34 UTC 2017


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

jpuydt-guest pushed a commit to annotated tag upstream/0.12.3
in repository node-recast.

commit 268dd19b564db68da14718b79fee15f5e29282da
Author: Julien Puydt <julien.puydt at laposte.net>
Date:   Thu Apr 6 09:18:00 2017 +0200

    New upstream version 0.12.3
---
 lib/fast-path.js |  6 ++++++
 package.json     |  7 ++++---
 test/babylon.js  | 13 ++++++++++---
 test/printer.js  | 33 +++++++++++++++++++++++++++++++--
 4 files changed, 51 insertions(+), 8 deletions(-)

diff --git a/lib/fast-path.js b/lib/fast-path.js
index b8c8ffb..cb353a5 100644
--- a/lib/fast-path.js
+++ b/lib/fast-path.js
@@ -304,6 +304,12 @@ FPp.needsParens = function(assumeExpressionContext) {
       && name === "object"
       && parent.object === node;
 
+  // Babel 6 Literal split
+  case "NumericLiteral":
+    return parent.type === "MemberExpression"
+      && name === "object"
+      && parent.object === node;
+
   case "AssignmentExpression":
   case "ConditionalExpression":
     switch (parent.type) {
diff --git a/package.json b/package.json
index 2645d5f..6812770 100644
--- a/package.json
+++ b/package.json
@@ -12,7 +12,7 @@
     "parsing",
     "pretty-printing"
   ],
-  "version": "0.12.2",
+  "version": "0.12.3",
   "homepage": "http://github.com/benjamn/recast",
   "repository": {
     "type": "git",
@@ -28,7 +28,7 @@
     "fs": false
   },
   "dependencies": {
-    "ast-types": "0.9.10",
+    "ast-types": "0.9.11",
     "core-js": "^2.4.1",
     "esprima": "~3.1.0",
     "private": "~0.1.5",
@@ -40,7 +40,8 @@
     "babylon": "~6.16.1",
     "esprima-fb": "^15001.1001.0-dev-harmony-fb",
     "mocha": "~3.2.0",
-    "reify": "^0.5.3"
+    "reify": "^0.6.2",
+    "semver": "^5.3.0"
   },
   "engines": {
     "node": ">= 0.8"
diff --git a/test/babylon.js b/test/babylon.js
index 74c75e2..5630220 100644
--- a/test/babylon.js
+++ b/test/babylon.js
@@ -7,9 +7,16 @@ var eol = require("os").EOL;
 describe("decorators", function () {
   var babelTransform = require("babel-core").transform;
   var babelPresetES2015 = require("babel-preset-es2015");
-  var parseOptions = {
-    parser: require("reify/lib/parsers/babylon.js")
-  };
+  var parseOptions = {};
+
+  try {
+    parseOptions.parser = require("reify/lib/parsers/babylon.js");
+  } catch (e) {
+    if (require("semver").gte(process.version, "4.0.0")) {
+      throw e;
+    }
+    return;
+  }
 
   it("babel 6 printing", function () {
     var code = [
diff --git a/test/printer.js b/test/printer.js
index 5071d67..0c1d52e 100644
--- a/test/printer.js
+++ b/test/printer.js
@@ -1667,7 +1667,36 @@ describe("printer", function() {
     }
 
     checkWith(require("esprima"));
-    checkWith(require("reify/lib/parsers/acorn.js"));
-    checkWith(require("reify/lib/parsers/babylon.js"));
+
+    try {
+      checkWith(require("reify/lib/parsers/acorn.js"));
+      checkWith(require("reify/lib/parsers/babylon.js"));
+    } catch (e) {
+      if (require("semver").gte(process.version, "4.0.0")) {
+        throw e;
+      }
+    }
+  });
+
+  it("parenthesizes NumericLiteral MemberExpression objects", function () {
+    var nonBabelNode = b.memberExpression(
+      b.literal(1),
+      b.identifier('foo')
+    );
+
+    var babelNode = b.memberExpression(
+      b.numericLiteral(1),
+      b.identifier('foo')
+    );
+
+    assert.strictEqual(
+      recast.print(nonBabelNode).code,
+      "(1).foo"
+    );
+
+    assert.strictEqual(
+      recast.print(babelNode).code,
+      "(1).foo"
+    );
   });
 });

-- 
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