[Pkg-javascript-commits] [node-acorn-jsx] 348/484: allow `export { default } from "foo"`

Bastien Roucariès rouca at moszumanska.debian.org
Sat Aug 19 14:20:54 UTC 2017


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

rouca pushed a commit to branch master
in repository node-acorn-jsx.

commit f48a921e249392226387b3e6323b01e6b3f5c3c5
Author: Rich Harris <richard.a.harris at gmail.com>
Date:   Wed Nov 5 12:02:47 2014 -0500

    allow `export { default } from "foo"`
---
 acorn.js              |  2 +-
 test/tests-harmony.js | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/acorn.js b/acorn.js
index ca5e8eb..526c3a4 100644
--- a/acorn.js
+++ b/acorn.js
@@ -2524,7 +2524,7 @@
         } else first = false;
 
         var node = startNode();
-        node.id = parseIdent();
+        node.id = parseIdent(tokType === _default);
         if (tokType === _name && tokVal === "as") {
           next();
           node.name = parseIdent(true);
diff --git a/test/tests-harmony.js b/test/tests-harmony.js
index 00149c1..f5064c8 100644
--- a/test/tests-harmony.js
+++ b/test/tests-harmony.js
@@ -5064,6 +5064,59 @@ test("export { encrypt, decrypt as dec }", {
   locations: true
 });
 
+test("export { default } from \"other\"", {
+  type: "Program",
+  body: [{
+    type: "ExportDeclaration",
+    declaration: null,
+    specifiers: [
+      {
+        type: "ExportSpecifier",
+        id: {
+          type: "Identifier",
+          name: "default",
+          loc: {
+            start: {line: 1, column: 9},
+            end: {line: 1, column: 16}
+          }
+        },
+        name: null,
+        loc: {
+          start: {line: 1, column: 9},
+          end: {line: 1, column: 16}
+        }
+      }
+    ],
+    source: {
+      type: "Literal",
+      loc: {
+        start: {
+          line: 1,
+          column: 24
+        },
+        end: {
+          line: 1,
+          column: 31
+        }
+      },
+      value: "other",
+      raw: "\"other\""
+    },
+    loc: {
+      start: {line: 1, column: 0},
+      end: {line: 1, column: 31}
+    }
+  }],
+  loc: {
+    start: {line: 1, column: 0},
+    end: {line: 1, column: 31}
+  }
+}, {
+  ecmaVersion: 6,
+  ranges: true,
+  locations: true
+});
+
 test("import \"jquery\"", {
   type: "Program",
   body: [{

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



More information about the Pkg-javascript-commits mailing list