diff options
Diffstat (limited to 'node_modules/@babel/plugin-transform-for-of/lib/index.js')
| -rw-r--r-- | node_modules/@babel/plugin-transform-for-of/lib/index.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/node_modules/@babel/plugin-transform-for-of/lib/index.js b/node_modules/@babel/plugin-transform-for-of/lib/index.js index 3d4daace..8b517bd8 100644 --- a/node_modules/@babel/plugin-transform-for-of/lib/index.js +++ b/node_modules/@babel/plugin-transform-for-of/lib/index.js @@ -7,6 +7,7 @@ exports.default = void 0; var _helperPluginUtils = require("@babel/helper-plugin-utils"); var _core = require("@babel/core"); var _noHelperImplementation = require("./no-helper-implementation.js"); +var _helperSkipTransparentExpressionWrappers = require("@babel/helper-skip-transparent-expression-wrappers"); function buildLoopBody(path, declar, newBody) { let block; const bodyPath = path.get("body"); @@ -19,7 +20,7 @@ function buildLoopBody(path, declar, newBody) { } return block; } -var _default = (0, _helperPluginUtils.declare)((api, options) => { +var _default = exports.default = (0, _helperPluginUtils.declare)((api, options) => { var _options$assumeArray, _options$allowArrayLi, _api$assumption; api.assertVersion(7); { @@ -56,14 +57,17 @@ var _default = (0, _helperPluginUtils.declare)((api, options) => { } = path; const { left, - right, await: isAwait } = path.node; if (isAwait) { return; } + const right = (0, _helperSkipTransparentExpressionWrappers.skipTransparentExprWrapperNodes)(path.node.right); const i = scope.generateUidIdentifier("i"); let array = scope.maybeGenerateMemoised(right, true); + if (!array && _core.types.isIdentifier(right) && path.get("body").scope.hasOwnBinding(right.name)) { + array = scope.generateUidIdentifier("arr"); + } const inits = [_core.types.variableDeclarator(i, _core.types.numericLiteral(0))]; if (array) { inits.push(_core.types.variableDeclarator(array, right)); @@ -186,6 +190,5 @@ var _default = (0, _helperPluginUtils.declare)((api, options) => { } }; }); -exports.default = _default; //# sourceMappingURL=index.js.map |
