Fix order of optional argument reordering (#8376)

Previously, if the optional `opts` parameter wasn't passed, the _intent_ was to move the function it held into the `callback` parameter and null out the `opts` param - but instead, it was nulling both.
This commit is contained in:
Qix 2018-07-26 09:25:35 -06:00 committed by Henry Zhu
parent 75767e9273
commit db2a9fc96e
3 changed files with 3 additions and 3 deletions

View File

@ -24,8 +24,8 @@ type Parse = {
export const parse: Parse = (function parse(code, opts, callback) { export const parse: Parse = (function parse(code, opts, callback) {
if (typeof opts === "function") { if (typeof opts === "function") {
opts = undefined;
callback = opts; callback = opts;
opts = undefined;
} }
// For backward-compat with Babel 7's early betas, we allow sync parsing when // For backward-compat with Babel 7's early betas, we allow sync parsing when

View File

@ -31,8 +31,8 @@ export const transformFromAst: TransformFromAst = (function transformFromAst(
callback, callback,
) { ) {
if (typeof opts === "function") { if (typeof opts === "function") {
opts = undefined;
callback = opts; callback = opts;
opts = undefined;
} }
// For backward-compat with Babel 6, we allow sync transformation when // For backward-compat with Babel 6, we allow sync transformation when

View File

@ -18,8 +18,8 @@ type Transform = {
export const transform: Transform = (function transform(code, opts, callback) { export const transform: Transform = (function transform(code, opts, callback) {
if (typeof opts === "function") { if (typeof opts === "function") {
opts = undefined;
callback = opts; callback = opts;
opts = undefined;
} }
// For backward-compat with Babel 6, we allow sync transformation when // For backward-compat with Babel 6, we allow sync transformation when