diff --git a/src/babel/transformation/transformers/index.js b/src/babel/transformation/transformers/index.js index d2b46c8ce9..c2fd23be65 100644 --- a/src/babel/transformation/transformers/index.js +++ b/src/babel/transformation/transformers/index.js @@ -8,14 +8,14 @@ export default { "validation.undeclaredVariableCheck": require("./validation/undeclared-variable-check"), "validation.react": require("./validation/react"), + // needs to be before `_aliasFunction` + "es6.arrowFunctions": require("./es6/arrow-functions"), + // this goes at the start so we only transform the original user code "spec.functionName": require("./spec/function-name"), "spec.blockScopedFunctions": require("./spec/block-scoped-functions"), - // needs to be before `_aliasFunction` - "es6.arrowFunctions": require("./es6/arrow-functions"), - reactCompat: require("./other/react-compat"), react: require("./other/react"), diff --git a/test/fixtures/transformation/es6-arrow-functions/arguments/expected.js b/test/fixtures/transformation/es6-arrow-functions/arguments/expected.js index 05f7b209cf..86b1ab853b 100644 --- a/test/fixtures/transformation/es6-arrow-functions/arguments/expected.js +++ b/test/fixtures/transformation/es6-arrow-functions/arguments/expected.js @@ -3,7 +3,7 @@ function one() { var _arguments = arguments; - var inner = function () { + var inner = function inner() { return _arguments; }; return [].slice.call(inner()); @@ -13,14 +13,14 @@ one(1, 2); function two() { var _arguments = arguments; - var inner = function () { + var inner = function inner() { return _arguments; }; var another = function another() { var _arguments2 = arguments; - var inner2 = function () { + var inner2 = function inner2() { return _arguments2; }; }; @@ -32,7 +32,7 @@ two(1, 2); function three() { var _arguments = arguments; - var fn = function () { + var fn = function fn() { return _arguments[0] + "bar"; }; return fn(); @@ -42,7 +42,7 @@ three("foo"); function four() { var _arguments = arguments; - var fn = function () { + var fn = function fn() { return _arguments[0].foo + "bar"; }; return fn(); diff --git a/test/fixtures/transformation/es6-arrow-functions/default-parameters/expected.js b/test/fixtures/transformation/es6-arrow-functions/default-parameters/expected.js index f857152487..19e5a5638d 100644 --- a/test/fixtures/transformation/es6-arrow-functions/default-parameters/expected.js +++ b/test/fixtures/transformation/es6-arrow-functions/default-parameters/expected.js @@ -1,6 +1,6 @@ "use strict"; -var some = function () { +var some = function some() { var count = arguments[0] === undefined ? "30" : arguments[0]; console.log("count", count); diff --git a/test/fixtures/transformation/es6-arrow-functions/destructuring-parameters/expected.js b/test/fixtures/transformation/es6-arrow-functions/destructuring-parameters/expected.js index 129dc43cc4..ae78c6970a 100644 --- a/test/fixtures/transformation/es6-arrow-functions/destructuring-parameters/expected.js +++ b/test/fixtures/transformation/es6-arrow-functions/destructuring-parameters/expected.js @@ -1,6 +1,6 @@ "use strict"; -var a = function (_ref) { +var a = function a(_ref) { var target = _ref.target; return console.log(target); }; diff --git a/test/fixtures/transformation/es6-arrow-functions/empty-arguments/expected.js b/test/fixtures/transformation/es6-arrow-functions/empty-arguments/expected.js index 12786c6dc4..354fc5f55d 100644 --- a/test/fixtures/transformation/es6-arrow-functions/empty-arguments/expected.js +++ b/test/fixtures/transformation/es6-arrow-functions/empty-arguments/expected.js @@ -1,5 +1,5 @@ "use strict"; -var t = function () { +var t = function t() { return 5 + 5; }; diff --git a/test/fixtures/transformation/es6-arrow-functions/empty-block/expected.js b/test/fixtures/transformation/es6-arrow-functions/empty-block/expected.js index 83176f427d..6dc77b8b34 100644 --- a/test/fixtures/transformation/es6-arrow-functions/empty-block/expected.js +++ b/test/fixtures/transformation/es6-arrow-functions/empty-block/expected.js @@ -1,3 +1,3 @@ "use strict"; -var t = function () {}; +var t = function t() {}; diff --git a/test/fixtures/transformation/es6-arrow-functions/multiple-arguments/expected.js b/test/fixtures/transformation/es6-arrow-functions/multiple-arguments/expected.js index 3eaf3163ea..267a0c9bd5 100644 --- a/test/fixtures/transformation/es6-arrow-functions/multiple-arguments/expected.js +++ b/test/fixtures/transformation/es6-arrow-functions/multiple-arguments/expected.js @@ -1,5 +1,5 @@ "use strict"; -var t = function (i, x) { +var t = function t(i, x) { return i * x; }; diff --git a/test/fixtures/transformation/es6-arrow-functions/paran-insertion/expected.js b/test/fixtures/transformation/es6-arrow-functions/paran-insertion/expected.js index 478e9c335b..9ad28d8c8c 100644 --- a/test/fixtures/transformation/es6-arrow-functions/paran-insertion/expected.js +++ b/test/fixtures/transformation/es6-arrow-functions/paran-insertion/expected.js @@ -1,5 +1,5 @@ "use strict"; -var t = function (i) { +var t = function t(i) { return i * 5; }; diff --git a/test/fixtures/transformation/es6-arrow-functions/single-argument/expected.js b/test/fixtures/transformation/es6-arrow-functions/single-argument/expected.js index 478e9c335b..9ad28d8c8c 100644 --- a/test/fixtures/transformation/es6-arrow-functions/single-argument/expected.js +++ b/test/fixtures/transformation/es6-arrow-functions/single-argument/expected.js @@ -1,5 +1,5 @@ "use strict"; -var t = function (i) { +var t = function t(i) { return i * 5; }; diff --git a/test/fixtures/transformation/es6-arrow-functions/this/expected.js b/test/fixtures/transformation/es6-arrow-functions/this/expected.js index 0a976c0686..7480ec8fff 100644 --- a/test/fixtures/transformation/es6-arrow-functions/this/expected.js +++ b/test/fixtures/transformation/es6-arrow-functions/this/expected.js @@ -3,7 +3,7 @@ function b() { var _this = this; - var t = function (x) { + var t = function t(x) { return _this.x + x; }; } diff --git a/test/fixtures/transformation/es6-parameters.rest/arrow-functions/expected.js b/test/fixtures/transformation/es6-parameters.rest/arrow-functions/expected.js index 44f86ca4c9..c345b2a74c 100644 --- a/test/fixtures/transformation/es6-parameters.rest/arrow-functions/expected.js +++ b/test/fixtures/transformation/es6-parameters.rest/arrow-functions/expected.js @@ -1,6 +1,6 @@ "use strict"; -var concat = function () { +var concat = function concat() { var x = arguments[0]; var y = arguments[1]; }; @@ -8,18 +8,18 @@ var concat = function () { var somefun = function somefun() { var _arguments = arguments; - var get2ndArg = function (a, b) { + var get2ndArg = function get2ndArg(a, b) { var _b = arguments[2]; - var somef = function (x, y, z) { + var somef = function somef(x, y, z) { var _a = arguments[3]; }; - var somefg = function (c, d, e, f) { + var somefg = function somefg(c, d, e, f) { var _a = arguments[4]; }; var _c = _arguments[1]; var _d = arguments[3]; }; - var get1stArg = function () { + var get1stArg = function get1stArg() { return arguments[0]; }; }; diff --git a/test/fixtures/transformation/source-maps/arrow-function/expected.js b/test/fixtures/transformation/source-maps/arrow-function/expected.js index bfd01cf68c..d90283482b 100644 --- a/test/fixtures/transformation/source-maps/arrow-function/expected.js +++ b/test/fixtures/transformation/source-maps/arrow-function/expected.js @@ -1,5 +1,5 @@ "use strict"; -var t = function (x) { +var t = function t(x) { return x * x; }; diff --git a/test/fixtures/transformation/strict/undefined-this-arrow-function/expected.js b/test/fixtures/transformation/strict/undefined-this-arrow-function/expected.js index bf107937df..7d20ebb7fc 100644 --- a/test/fixtures/transformation/strict/undefined-this-arrow-function/expected.js +++ b/test/fixtures/transformation/strict/undefined-this-arrow-function/expected.js @@ -1,5 +1,5 @@ "use strict"; -var foo = function () { +var foo = function foo() { return undefined; -}; \ No newline at end of file +};