From db2a9fc96ebb2b29aaeedb962b46f5010a552f17 Mon Sep 17 00:00:00 2001 From: Qix Date: Thu, 26 Jul 2018 09:25:35 -0600 Subject: [PATCH] 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. --- packages/babel-core/src/parse.js | 2 +- packages/babel-core/src/transform-ast.js | 2 +- packages/babel-core/src/transform.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/babel-core/src/parse.js b/packages/babel-core/src/parse.js index ef905efb1f..b3397a1a2e 100644 --- a/packages/babel-core/src/parse.js +++ b/packages/babel-core/src/parse.js @@ -24,8 +24,8 @@ type Parse = { export const parse: Parse = (function parse(code, opts, callback) { if (typeof opts === "function") { - opts = undefined; callback = opts; + opts = undefined; } // For backward-compat with Babel 7's early betas, we allow sync parsing when diff --git a/packages/babel-core/src/transform-ast.js b/packages/babel-core/src/transform-ast.js index 62cef671e3..101177dcec 100644 --- a/packages/babel-core/src/transform-ast.js +++ b/packages/babel-core/src/transform-ast.js @@ -31,8 +31,8 @@ export const transformFromAst: TransformFromAst = (function transformFromAst( callback, ) { if (typeof opts === "function") { - opts = undefined; callback = opts; + opts = undefined; } // For backward-compat with Babel 6, we allow sync transformation when diff --git a/packages/babel-core/src/transform.js b/packages/babel-core/src/transform.js index 11a8ad5c0c..4a2f0e5c16 100644 --- a/packages/babel-core/src/transform.js +++ b/packages/babel-core/src/transform.js @@ -18,8 +18,8 @@ type Transform = { export const transform: Transform = (function transform(code, opts, callback) { if (typeof opts === "function") { - opts = undefined; callback = opts; + opts = undefined; } // For backward-compat with Babel 6, we allow sync transformation when