@babel/plugin-transform-regenerator
Advanced tools
+15
-15
@@ -192,3 +192,3 @@ import { declare } from '@babel/helper-plugin-utils'; | ||
| } | ||
| return null; | ||
| throw new Error("unreachable"); | ||
| } | ||
@@ -259,2 +259,3 @@ getBreakLoc(label) { | ||
| YieldExpression: true, | ||
| AwaitExpression: true, | ||
| BreakStatement: true, | ||
@@ -856,2 +857,14 @@ ContinueStatement: true, | ||
| return self.contextProperty("v"); | ||
| case "AwaitExpression": | ||
| { | ||
| after = this.loc(); | ||
| const arg = self.explodeExpression(path.get("argument")); | ||
| self.emitAssign(self.contextProperty("n"), after); | ||
| const helper = self.pluginPass.addHelper("awaitAsyncGenerator"); | ||
| const ret = types.returnStatement(types.cloneNode(types.callExpression(helper, [arg])) || null); | ||
| ret.loc = expr.loc; | ||
| self.emit(ret); | ||
| self.mark(after); | ||
| return self.contextProperty("v"); | ||
| } | ||
| case "ClassExpression": | ||
@@ -924,5 +937,2 @@ return finish(self.explodeClass(path)); | ||
| const bodyBlockPath = path.get("body"); | ||
| if (node.async) { | ||
| bodyBlockPath.traverse(awaitVisitor, this); | ||
| } | ||
| bodyBlockPath.traverse(functionSentVisitor, { | ||
@@ -1101,12 +1111,2 @@ context: contextId, | ||
| }; | ||
| const awaitVisitor = { | ||
| Function: function (path) { | ||
| path.skip(); | ||
| }, | ||
| AwaitExpression: function (path) { | ||
| const argument = path.node.argument; | ||
| const helper = this.addHelper("awaitAsyncGenerator"); | ||
| path.replaceWith(types.yieldExpression(types.callExpression(helper, [argument]), false)); | ||
| } | ||
| }; | ||
@@ -1116,3 +1116,3 @@ var index = declare(({ | ||
| }) => { | ||
| assertVersion("^7.0.0-0 || ^8.0.0 || 8.0.0-rc.2"); | ||
| assertVersion("^7.0.0-0 || ^8.0.0 || 8.0.0-rc.3"); | ||
| return { | ||
@@ -1119,0 +1119,0 @@ name: "transform-regenerator", |
+14
-14
@@ -5,3 +5,3 @@ { | ||
| "description": "Explode async and generator functions into a state machine.", | ||
| "version": "8.0.0-rc.2", | ||
| "version": "8.0.0-rc.3", | ||
| "homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-regenerator", | ||
@@ -15,3 +15,3 @@ "repository": { | ||
| "dependencies": { | ||
| "@babel/helper-plugin-utils": "^8.0.0-rc.2" | ||
| "@babel/helper-plugin-utils": "^8.0.0-rc.3" | ||
| }, | ||
@@ -23,16 +23,16 @@ "license": "MIT", | ||
| "peerDependencies": { | ||
| "@babel/core": "^8.0.0-rc.2" | ||
| "@babel/core": "^8.0.0-rc.3" | ||
| }, | ||
| "devDependencies": { | ||
| "@babel/core": "^8.0.0-rc.2", | ||
| "@babel/helper-check-duplicate-nodes": "^8.0.0-rc.2", | ||
| "@babel/helper-plugin-test-runner": "^8.0.0-rc.2", | ||
| "@babel/plugin-proposal-function-sent": "^8.0.0-rc.2", | ||
| "@babel/plugin-transform-arrow-functions": "^8.0.0-rc.2", | ||
| "@babel/plugin-transform-block-scoping": "^8.0.0-rc.2", | ||
| "@babel/plugin-transform-classes": "^8.0.0-rc.2", | ||
| "@babel/plugin-transform-for-of": "^8.0.0-rc.2", | ||
| "@babel/plugin-transform-modules-commonjs": "^8.0.0-rc.2", | ||
| "@babel/plugin-transform-parameters": "^8.0.0-rc.2", | ||
| "@babel/plugin-transform-runtime": "^8.0.0-rc.2", | ||
| "@babel/core": "^8.0.0-rc.3", | ||
| "@babel/helper-check-duplicate-nodes": "^8.0.0-rc.3", | ||
| "@babel/helper-plugin-test-runner": "^8.0.0-rc.3", | ||
| "@babel/plugin-proposal-function-sent": "^8.0.0-rc.3", | ||
| "@babel/plugin-transform-arrow-functions": "^8.0.0-rc.3", | ||
| "@babel/plugin-transform-block-scoping": "^8.0.0-rc.3", | ||
| "@babel/plugin-transform-classes": "^8.0.0-rc.3", | ||
| "@babel/plugin-transform-for-of": "^8.0.0-rc.3", | ||
| "@babel/plugin-transform-modules-commonjs": "^8.0.0-rc.3", | ||
| "@babel/plugin-transform-parameters": "^8.0.0-rc.3", | ||
| "@babel/plugin-transform-runtime": "^8.0.0-rc.3", | ||
| "babel-plugin-polyfill-regenerator": "^0.6.6", | ||
@@ -39,0 +39,0 @@ "mocha": "^10.0.0", |
Sorry, the diff of this file is too big to display
171618
-1.22%