@babel/plugin-transform-regenerator
Advanced tools
+16
-26
@@ -11,4 +11,3 @@ import { declare } from '@babel/helper-plugin-utils'; | ||
| function varDeclToExpr({ | ||
| node: vdec, | ||
| scope | ||
| node: vdec | ||
| }, includeIdentifiers) { | ||
@@ -19,3 +18,2 @@ types.assertVariableDeclaration(vdec); | ||
| vars[dec.id.name] = types.identifier(dec.id.name); | ||
| scope.removeBinding(dec.id.name); | ||
| if (dec.init) { | ||
@@ -38,2 +36,5 @@ exprs.push(types.assignmentExpression("=", dec.id, dec.init)); | ||
| } else { | ||
| for (const name of Object.keys(vars)) { | ||
| path.scope.removeBinding(name); | ||
| } | ||
| path.replaceWith(types.expressionStatement(expr)); | ||
@@ -70,4 +71,4 @@ } | ||
| path.replaceWith(assignment); | ||
| path.scope.removeBinding(node.id.name); | ||
| } | ||
| path.scope.removeBinding(node.id.name); | ||
| path.skip(); | ||
@@ -427,6 +428,4 @@ }, | ||
| this.finalLoc.value = this.getIndex(); | ||
| { | ||
| if (this.lastReferenceIndex === this.index || !this.returns.has(this.listing.length)) { | ||
| cases.push(types.switchCase(this.finalLoc, [types.returnStatement(types.callExpression(this.contextProperty("a"), [types.numericLiteral(2)]))])); | ||
| } | ||
| if (this.lastReferenceIndex === this.index || !this.returns.has(this.listing.length)) { | ||
| cases.push(types.switchCase(this.finalLoc, [types.returnStatement(types.callExpression(this.contextProperty("a"), [types.numericLiteral(2)]))])); | ||
| } | ||
@@ -453,5 +452,3 @@ return types.whileStatement(types.numericLiteral(1), types.switchStatement(this.tryEntries.length === 0 ? this.contextProperty("n") : types.assignmentExpression("=", this.contextProperty("p"), this.contextProperty("n")), cases)); | ||
| })); | ||
| { | ||
| arrayExpression.elements.reverse(); | ||
| } | ||
| arrayExpression.elements.reverse(); | ||
| return arrayExpression; | ||
@@ -652,5 +649,3 @@ } | ||
| const safeParam = self.makeTempVar(); | ||
| { | ||
| this.emitAssign(safeParam, self.contextProperty("v")); | ||
| } | ||
| this.emitAssign(safeParam, self.contextProperty("v")); | ||
| bodyPath.traverse(catchParamVisitor, { | ||
@@ -854,9 +849,7 @@ getSafeParam: () => types.cloneNode(safeParam), | ||
| if (arg && path.node.delegate) { | ||
| { | ||
| const ret = types.returnStatement(types.callExpression(self.contextProperty("d"), [types.callExpression(this.pluginPass.addHelper("regeneratorValues"), [arg]), after])); | ||
| ret.loc = expr.loc; | ||
| self.emit(ret); | ||
| self.mark(after); | ||
| return self.contextProperty("v"); | ||
| } | ||
| const ret = types.returnStatement(types.callExpression(self.contextProperty("d"), [types.callExpression(this.pluginPass.addHelper("regeneratorValues"), [arg]), after])); | ||
| ret.loc = expr.loc; | ||
| self.emit(ret); | ||
| self.mark(after); | ||
| return self.contextProperty("v"); | ||
| } | ||
@@ -913,4 +906,3 @@ self.emitAssign(self.contextProperty("n"), after); | ||
| const functionExpression = types.functionExpression(null, parameters, types.cloneNode(path.node.body), path.node.generator, path.node.async); | ||
| path.replaceWith(types.objectProperty(types.cloneNode(path.node.key), functionExpression, path.node.computed, false)); | ||
| return path.get("value"); | ||
| return path.replaceWith(types.objectProperty(types.cloneNode(path.node.key), functionExpression, path.node.computed, false))[0].get("value"); | ||
| } | ||
@@ -1126,7 +1118,5 @@ | ||
| var index = declare(({ | ||
| types: t, | ||
| traverse, | ||
| assertVersion | ||
| }) => { | ||
| assertVersion("8.0.0-beta.3"); | ||
| assertVersion("^7.0.0-0 || ^8.0.0 || 8.0.0-beta.4"); | ||
| return { | ||
@@ -1133,0 +1123,0 @@ name: "transform-regenerator", |
+14
-14
@@ -5,3 +5,3 @@ { | ||
| "description": "Explode async and generator functions into a state machine.", | ||
| "version": "8.0.0-beta.3", | ||
| "version": "8.0.0-beta.4", | ||
| "homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-regenerator", | ||
@@ -15,3 +15,3 @@ "repository": { | ||
| "dependencies": { | ||
| "@babel/helper-plugin-utils": "^8.0.0-beta.3" | ||
| "@babel/helper-plugin-utils": "^8.0.0-beta.4" | ||
| }, | ||
@@ -23,16 +23,16 @@ "license": "MIT", | ||
| "peerDependencies": { | ||
| "@babel/core": "^8.0.0-beta.3" | ||
| "@babel/core": "^7.0.0-0" | ||
| }, | ||
| "devDependencies": { | ||
| "@babel/core": "^8.0.0-beta.3", | ||
| "@babel/helper-check-duplicate-nodes": "^8.0.0-beta.3", | ||
| "@babel/helper-plugin-test-runner": "^8.0.0-beta.3", | ||
| "@babel/plugin-proposal-function-sent": "^8.0.0-beta.3", | ||
| "@babel/plugin-transform-arrow-functions": "^8.0.0-beta.3", | ||
| "@babel/plugin-transform-block-scoping": "^8.0.0-beta.3", | ||
| "@babel/plugin-transform-classes": "^8.0.0-beta.3", | ||
| "@babel/plugin-transform-for-of": "^8.0.0-beta.3", | ||
| "@babel/plugin-transform-modules-commonjs": "^8.0.0-beta.3", | ||
| "@babel/plugin-transform-parameters": "^8.0.0-beta.3", | ||
| "@babel/plugin-transform-runtime": "^8.0.0-beta.3", | ||
| "@babel/core": "^8.0.0-beta.4", | ||
| "@babel/helper-check-duplicate-nodes": "^8.0.0-beta.4", | ||
| "@babel/helper-plugin-test-runner": "^8.0.0-beta.4", | ||
| "@babel/plugin-proposal-function-sent": "^8.0.0-beta.4", | ||
| "@babel/plugin-transform-arrow-functions": "^8.0.0-beta.4", | ||
| "@babel/plugin-transform-block-scoping": "^8.0.0-beta.4", | ||
| "@babel/plugin-transform-classes": "^8.0.0-beta.4", | ||
| "@babel/plugin-transform-for-of": "^8.0.0-beta.4", | ||
| "@babel/plugin-transform-modules-commonjs": "^8.0.0-beta.4", | ||
| "@babel/plugin-transform-parameters": "^8.0.0-beta.4", | ||
| "@babel/plugin-transform-runtime": "^8.0.0-beta.4", | ||
| "babel-plugin-polyfill-regenerator": "^0.6.5", | ||
@@ -39,0 +39,0 @@ "mocha": "^10.0.0", |
Sorry, the diff of this file is too big to display
173769
-4.21%1114
-0.89%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed