-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Improve output when wrapping functions" (#15979)
* Add a test * Revert "Improve output when wrapping functions (e.g. `async` functions) (#15922)" This reverts commit b9a2244. * Update snapshot
- Loading branch information
Showing
76 changed files
with
753 additions
and
383 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
9 changes: 6 additions & 3 deletions
9
packages/babel-plugin-proposal-function-sent/test/fixtures/function-sent/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 |
---|---|---|
@@ -1,7 +1,10 @@ | ||
var _gen; | ||
function gen() { | ||
return (_gen = _gen || babelHelpers.skipFirstGeneratorNext(function* () { | ||
return _gen.apply(this, arguments); | ||
} | ||
function _gen() { | ||
_gen = babelHelpers.skipFirstGeneratorNext(function* () { | ||
let _functionSent = yield; | ||
let sent = _functionSent; | ||
})).apply(this, arguments); | ||
}); | ||
return _gen.apply(this, arguments); | ||
} |
9 changes: 6 additions & 3 deletions
9
...bel-plugin-proposal-function-sent/test/fixtures/generator-kinds/async-generator/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 |
---|---|---|
@@ -1,7 +1,10 @@ | ||
var _foo; | ||
function foo() { | ||
return (_foo = _foo || babelHelpers.wrapAsyncGenerator(babelHelpers.skipFirstGeneratorNext(function* () { | ||
return _foo.apply(this, arguments); | ||
} | ||
function _foo() { | ||
_foo = babelHelpers.wrapAsyncGenerator(babelHelpers.skipFirstGeneratorNext(function* () { | ||
let _functionSent = yield; | ||
_functionSent = yield babelHelpers.awaitAsyncGenerator(_functionSent); | ||
}))).apply(this, arguments); | ||
})); | ||
return _foo.apply(this, arguments); | ||
} |
9 changes: 6 additions & 3 deletions
9
...-proposal-function-sent/test/fixtures/generator-kinds/export-default-anonymous/output.mjs
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 |
---|---|---|
@@ -1,7 +1,10 @@ | ||
var _ref; | ||
export default function () { | ||
return (_ref = _ref || babelHelpers.skipFirstGeneratorNext(function* () { | ||
return _ref.apply(this, arguments); | ||
} | ||
function _ref() { | ||
_ref = babelHelpers.skipFirstGeneratorNext(function* () { | ||
let _functionSent = yield; | ||
return _functionSent; | ||
})).apply(this, arguments); | ||
}); | ||
return _ref.apply(this, arguments); | ||
} |
9 changes: 6 additions & 3 deletions
9
...ugin-proposal-function-sent/test/fixtures/generator-kinds/export-default-named/output.mjs
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 |
---|---|---|
@@ -1,7 +1,10 @@ | ||
var _gen; | ||
export default function gen() { | ||
return (_gen = _gen || babelHelpers.skipFirstGeneratorNext(function* () { | ||
return _gen.apply(this, arguments); | ||
} | ||
function _gen() { | ||
_gen = babelHelpers.skipFirstGeneratorNext(function* () { | ||
let _functionSent = yield; | ||
return _functionSent; | ||
})).apply(this, arguments); | ||
}); | ||
return _gen.apply(this, arguments); | ||
} |
9 changes: 6 additions & 3 deletions
9
packages/babel-plugin-proposal-function-sent/test/fixtures/generator-kinds/export/output.mjs
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 |
---|---|---|
@@ -1,7 +1,10 @@ | ||
var _gen; | ||
export function gen() { | ||
return (_gen = _gen || babelHelpers.skipFirstGeneratorNext(function* () { | ||
return _gen.apply(this, arguments); | ||
} | ||
function _gen() { | ||
_gen = babelHelpers.skipFirstGeneratorNext(function* () { | ||
let _functionSent = yield; | ||
return _functionSent; | ||
})).apply(this, arguments); | ||
}); | ||
return _gen.apply(this, arguments); | ||
} |
13 changes: 8 additions & 5 deletions
13
...el-plugin-proposal-function-sent/test/fixtures/generator-kinds/expression-named/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 |
---|---|---|
@@ -1,7 +1,10 @@ | ||
var _gen; | ||
const foo = function gen() { | ||
return (_gen = _gen || babelHelpers.skipFirstGeneratorNext(function* () { | ||
const foo = function () { | ||
var _gen = babelHelpers.skipFirstGeneratorNext(function* () { | ||
let _functionSent = yield; | ||
return _functionSent; | ||
})).apply(this, arguments); | ||
}; | ||
}); | ||
function gen() { | ||
return _gen.apply(this, arguments); | ||
} | ||
return gen; | ||
}(); |
9 changes: 6 additions & 3 deletions
9
...ges/babel-plugin-proposal-function-sent/test/fixtures/generator-kinds/statement/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 |
---|---|---|
@@ -1,7 +1,10 @@ | ||
var _gen; | ||
function gen() { | ||
return (_gen = _gen || babelHelpers.skipFirstGeneratorNext(function* () { | ||
return _gen.apply(this, arguments); | ||
} | ||
function _gen() { | ||
_gen = babelHelpers.skipFirstGeneratorNext(function* () { | ||
let _functionSent = yield; | ||
return _functionSent; | ||
})).apply(this, arguments); | ||
}); | ||
return _gen.apply(this, arguments); | ||
} |
9 changes: 6 additions & 3 deletions
9
...-transform-async-generator-functions/test/fixtures/async-generators/declaration/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 |
---|---|---|
@@ -1,9 +1,12 @@ | ||
var _agf; | ||
function agf() { | ||
return (_agf = _agf || babelHelpers.wrapAsyncGenerator(function* () { | ||
return _agf.apply(this, arguments); | ||
} | ||
function _agf() { | ||
_agf = babelHelpers.wrapAsyncGenerator(function* () { | ||
this; | ||
yield babelHelpers.awaitAsyncGenerator(1); | ||
yield 2; | ||
return 3; | ||
})).apply(this, arguments); | ||
}); | ||
return _agf.apply(this, arguments); | ||
} |
13 changes: 8 additions & 5 deletions
13
...n-transform-async-generator-functions/test/fixtures/async-generators/expression/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 |
---|---|---|
@@ -1,9 +1,12 @@ | ||
var _agf; | ||
(function agf() { | ||
return (_agf = _agf || babelHelpers.wrapAsyncGenerator(function* () { | ||
/*#__PURE__*/(function () { | ||
var _agf = babelHelpers.wrapAsyncGenerator(function* () { | ||
this; | ||
yield babelHelpers.awaitAsyncGenerator(1); | ||
yield 2; | ||
return 3; | ||
})).apply(this, arguments); | ||
}); | ||
}); | ||
function agf() { | ||
return _agf.apply(this, arguments); | ||
} | ||
return agf; | ||
})(); |
9 changes: 6 additions & 3 deletions
9
...m-async-generator-functions/test/fixtures/async-generators/transform-class-keys/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 |
---|---|---|
@@ -1,11 +1,14 @@ | ||
var _fn; | ||
function fn() { | ||
return (_fn = _fn || babelHelpers.wrapAsyncGenerator(function* () { | ||
return _fn.apply(this, arguments); | ||
} | ||
function _fn() { | ||
_fn = babelHelpers.wrapAsyncGenerator(function* () { | ||
class A { | ||
[yield 1]() {} | ||
} | ||
class B extends A { | ||
[yield babelHelpers.awaitAsyncGenerator(1)]() {} | ||
} | ||
})).apply(this, arguments); | ||
}); | ||
return _fn.apply(this, arguments); | ||
} |
9 changes: 6 additions & 3 deletions
9
...orm-async-generator-functions/test/fixtures/async-generators/yield-star-babel-7/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 |
---|---|---|
@@ -1,7 +1,10 @@ | ||
var _g; | ||
function g() { | ||
return (_g = _g || babelHelpers.wrapAsyncGenerator(function* () { | ||
return _g.apply(this, arguments); | ||
} | ||
function _g() { | ||
_g = babelHelpers.wrapAsyncGenerator(function* () { | ||
yield* babelHelpers.asyncGeneratorDelegate(babelHelpers.asyncIterator([1, 2, 3]), babelHelpers.awaitAsyncGenerator); | ||
yield* babelHelpers.asyncGeneratorDelegate(babelHelpers.asyncIterator(iterable), babelHelpers.awaitAsyncGenerator); | ||
})).apply(this, arguments); | ||
}); | ||
return _g.apply(this, arguments); | ||
} |
9 changes: 6 additions & 3 deletions
9
...n-transform-async-generator-functions/test/fixtures/async-generators/yield-star/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 |
---|---|---|
@@ -1,7 +1,10 @@ | ||
var _g; | ||
function g() { | ||
return (_g = _g || babelHelpers.wrapAsyncGenerator(function* () { | ||
return _g.apply(this, arguments); | ||
} | ||
function _g() { | ||
_g = babelHelpers.wrapAsyncGenerator(function* () { | ||
yield* babelHelpers.asyncGeneratorDelegate(babelHelpers.asyncIterator([1, 2, 3])); | ||
yield* babelHelpers.asyncGeneratorDelegate(babelHelpers.asyncIterator(iterable)); | ||
})).apply(this, arguments); | ||
}); | ||
return _g.apply(this, arguments); | ||
} |
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
Oops, something went wrong.