From e046bb195c8d0003999eab2161d21459a2da6fa8 Mon Sep 17 00:00:00 2001 From: Jamesernator Date: Thu, 13 Oct 2016 15:02:14 +1300 Subject: [PATCH] Fixed incorrect compilation of async iterator methods --- packages/babel-helper-remap-async-to-generator/src/index.js | 4 ++++ .../test/fixtures/async-generators/class-method/expected.js | 2 +- .../test/fixtures/async-generators/object-method/expected.js | 2 +- .../test/fixtures/async-generators/static-method/expected.js | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/babel-helper-remap-async-to-generator/src/index.js b/packages/babel-helper-remap-async-to-generator/src/index.js index 64c2a474391d..056606da3aab 100644 --- a/packages/babel-helper-remap-async-to-generator/src/index.js +++ b/packages/babel-helper-remap-async-to-generator/src/index.js @@ -90,6 +90,10 @@ function classOrObjectMethod(path: NodePath, callId: Object) { [] )) ]; + + // Regardless of whether or not the wrapped function is a an async method + // or generator the outer function should not be + node.generator = false; } function plainFunction(path: NodePath, callId: Object) { diff --git a/packages/babel-plugin-transform-async-generator-functions/test/fixtures/async-generators/class-method/expected.js b/packages/babel-plugin-transform-async-generator-functions/test/fixtures/async-generators/class-method/expected.js index a774b790eb38..4d300b50dcdf 100644 --- a/packages/babel-plugin-transform-async-generator-functions/test/fixtures/async-generators/class-method/expected.js +++ b/packages/babel-plugin-transform-async-generator-functions/test/fixtures/async-generators/class-method/expected.js @@ -1,5 +1,5 @@ class C { - *g() { + g() { var _this = this; return babelHelpers.asyncGenerator.wrap(function* () { diff --git a/packages/babel-plugin-transform-async-generator-functions/test/fixtures/async-generators/object-method/expected.js b/packages/babel-plugin-transform-async-generator-functions/test/fixtures/async-generators/object-method/expected.js index e4fefacc6c50..c374fe93f4b3 100644 --- a/packages/babel-plugin-transform-async-generator-functions/test/fixtures/async-generators/object-method/expected.js +++ b/packages/babel-plugin-transform-async-generator-functions/test/fixtures/async-generators/object-method/expected.js @@ -1,5 +1,5 @@ ({ - *g() { + g() { var _this = this; return babelHelpers.asyncGenerator.wrap(function* () { diff --git a/packages/babel-plugin-transform-async-generator-functions/test/fixtures/async-generators/static-method/expected.js b/packages/babel-plugin-transform-async-generator-functions/test/fixtures/async-generators/static-method/expected.js index 01bbe9574235..751788620620 100644 --- a/packages/babel-plugin-transform-async-generator-functions/test/fixtures/async-generators/static-method/expected.js +++ b/packages/babel-plugin-transform-async-generator-functions/test/fixtures/async-generators/static-method/expected.js @@ -1,5 +1,5 @@ class C { - static *g() { + static g() { var _this = this; return babelHelpers.asyncGenerator.wrap(function* () {