forked from babel/babel
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement
newableArrowFunctions
assumption (babel#12613)
- Loading branch information
1 parent
2adb1c8
commit 7f6b32c
Showing
35 changed files
with
161 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
...ransform-arrow-functions/test/fixtures/arrow-functions/spec-self-referential/options.json
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
...sform-arrow-functions/test/fixtures/assumption-newableArrowFunctions-false/basic/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
function foo() { | ||
arr.map(x => x * x); | ||
var f = (x, y) => x * y; | ||
(function () { | ||
return () => this; | ||
})(); | ||
return { | ||
g: () => this | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...form-arrow-functions/test/fixtures/assumption-newableArrowFunctions-false/basic/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
function foo() { | ||
var _this = this; | ||
|
||
arr.map(function (x) { | ||
babelHelpers.newArrowCheck(this, _this); | ||
return x * x; | ||
}.bind(this)); | ||
|
||
var f = function f(x, y) { | ||
babelHelpers.newArrowCheck(this, _this); | ||
return x * y; | ||
}.bind(this); | ||
|
||
(function () { | ||
var _this2 = this; | ||
|
||
return function () { | ||
babelHelpers.newArrowCheck(this, _this2); | ||
return this; | ||
}.bind(this); | ||
})(); | ||
|
||
return { | ||
g: function g() { | ||
babelHelpers.newArrowCheck(this, _this); | ||
return this; | ||
}.bind(this) | ||
}; | ||
} |
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions
6
...ansform-arrow-functions/test/fixtures/assumption-newableArrowFunctions-false/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"plugins": ["external-helpers", "transform-arrow-functions"], | ||
"assumptions": { | ||
"newableArrowFunctions": false | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...plugin-transform-arrow-functions/test/fixtures/spec/newableArrowFunction-default/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let a = () => 1; |
File renamed without changes.
6 changes: 6 additions & 0 deletions
6
...lugin-transform-arrow-functions/test/fixtures/spec/newableArrowFunction-default/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
var _this = this; | ||
|
||
let a = function a() { | ||
babelHelpers.newArrowCheck(this, _this); | ||
return 1; | ||
}.bind(this); |
1 change: 1 addition & 0 deletions
1
...-transform-arrow-functions/test/fixtures/spec/newableArrowFunction-vs-spec-false/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let a = () => 1; |
9 changes: 9 additions & 0 deletions
9
...nsform-arrow-functions/test/fixtures/spec/newableArrowFunction-vs-spec-false/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"plugins": [ | ||
"external-helpers", | ||
["transform-arrow-functions", { "spec": false }] | ||
], | ||
"assumptions": { | ||
"newableArrowFunctions": false | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...transform-arrow-functions/test/fixtures/spec/newableArrowFunction-vs-spec-false/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
var _this = this; | ||
|
||
let a = function a() { | ||
babelHelpers.newArrowCheck(this, _this); | ||
return 1; | ||
}.bind(this); |
1 change: 1 addition & 0 deletions
1
...n-transform-arrow-functions/test/fixtures/spec/newableArrowFunction-vs-spec-true/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let a = () => 1; |
9 changes: 9 additions & 0 deletions
9
...ansform-arrow-functions/test/fixtures/spec/newableArrowFunction-vs-spec-true/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"plugins": [ | ||
"external-helpers", | ||
["transform-arrow-functions", { "spec": true }] | ||
], | ||
"assumptions": { | ||
"newableArrowFunctions": true | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...-transform-arrow-functions/test/fixtures/spec/newableArrowFunction-vs-spec-true/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
let a = function () { | ||
return 1; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
1 change: 1 addition & 0 deletions
1
...rm-async-to-generator/test/fixtures/assumption-newableArrowFunctions-false/basic/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
async () => 2; |
6 changes: 6 additions & 0 deletions
6
...sync-to-generator/test/fixtures/assumption-newableArrowFunctions-false/basic/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"plugins": ["external-helpers", "transform-async-to-generator"], | ||
"assumptions": { | ||
"newableArrowFunctions": false | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...m-async-to-generator/test/fixtures/assumption-newableArrowFunctions-false/basic/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
var _this = this; | ||
|
||
/*#__PURE__*/ | ||
babelHelpers.asyncToGenerator(function* () { | ||
babelHelpers.newArrowCheck(this, _this); | ||
return 2; | ||
}); |
Empty file.
12 changes: 12 additions & 0 deletions
12
...c-to-generator/test/fixtures/assumption-newableArrowFunctions-false/bluebird/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"plugins": [ | ||
"external-helpers", | ||
[ | ||
"transform-async-to-generator", | ||
{ "module": "bluebird", "method": "coroutine" } | ||
] | ||
], | ||
"assumptions": { | ||
"newableArrowFunctions": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters