ES2015 modules - Export default function hoisting
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 3 Jun 2017 01:35:00 +0000 (01:35 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 3 Jun 2017 01:35:00 +0000 (01:35 +0000)
https://bugs.webkit.org/show_bug.cgi?id=170174

Reviewed by Saam Barati.

This issue itself is solved by fixing function declaration hoisting rules.
This patch just adds the specific test to modules tests to ensure the bug
is fixed.

* modules/export-default-function-hoisting.js: Added.
* modules/export-default-function-hoisting/cappuccino.js: Added.
(import.drinkCocoa.from.string_appeared_here.export.default.drinkCappuccino):
* modules/export-default-function-hoisting/cocoa.js: Added.
(export.default.drinkCocoa):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@217747 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JSTests/ChangeLog
JSTests/modules/export-default-function-hoisting.js [new file with mode: 0644]
JSTests/modules/export-default-function-hoisting/cappuccino.js [new file with mode: 0644]
JSTests/modules/export-default-function-hoisting/cocoa.js [new file with mode: 0644]

index 8bedae1..4314251 100644 (file)
@@ -1,3 +1,20 @@
+2017-06-02  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        ES2015 modules - Export default function hoisting
+        https://bugs.webkit.org/show_bug.cgi?id=170174
+
+        Reviewed by Saam Barati.
+
+        This issue itself is solved by fixing function declaration hoisting rules.
+        This patch just adds the specific test to modules tests to ensure the bug
+        is fixed.
+
+        * modules/export-default-function-hoisting.js: Added.
+        * modules/export-default-function-hoisting/cappuccino.js: Added.
+        (import.drinkCocoa.from.string_appeared_here.export.default.drinkCappuccino):
+        * modules/export-default-function-hoisting/cocoa.js: Added.
+        (export.default.drinkCocoa):
+
 2017-06-01  Oleksandr Skachkov  <gskachkov@gmail.com>
 
         Class Proxy can't be extended
diff --git a/JSTests/modules/export-default-function-hoisting.js b/JSTests/modules/export-default-function-hoisting.js
new file mode 100644 (file)
index 0000000..f71e7f3
--- /dev/null
@@ -0,0 +1,5 @@
+import { shouldBe } from "./resources/assert.js";
+import drinkCocoa from './export-default-function-hoisting/cocoa.js'
+
+shouldBe(drinkCocoa(), 42);
+
diff --git a/JSTests/modules/export-default-function-hoisting/cappuccino.js b/JSTests/modules/export-default-function-hoisting/cappuccino.js
new file mode 100644 (file)
index 0000000..3bf4a39
--- /dev/null
@@ -0,0 +1,6 @@
+import drinkCocoa from './cocoa.js'
+
+export default function drinkCappuccino()
+{
+    return drinkCocoa();
+}
diff --git a/JSTests/modules/export-default-function-hoisting/cocoa.js b/JSTests/modules/export-default-function-hoisting/cocoa.js
new file mode 100644 (file)
index 0000000..d19f9fc
--- /dev/null
@@ -0,0 +1,9 @@
+import drinkCappuccino from './cappuccino.js'
+import { shouldBe } from "../resources/assert.js";
+
+shouldBe(drinkCappuccino(), 42);
+
+export default function drinkCocoa()
+{
+    return 42;
+}