Issue 1:
Bug Report

Current Behavior

babel/preset-env with option of targets={esmodules: true} generates infinite recursive call for async super method calls.

Input Code

REPL or Repo link if applicable:

https://codesandbox.io/s/sparkling-sky-qqc0z

Example code:

class A {
async foo() {
console.log("A#foo");
}
}

class B extends A {
async foo() {
console.log("B#foo");
await super.foo();
}
}

new B().foo();

The transpiled result of above becomes:

"use strict";

function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }

function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }

class A {
foo() {
return _asyncToGenerator(function* () {
console.log("A#foo");
})();
}

}

class B extends A {
foo() {
var _superprop_callFoo = function _superprop_callFoo() {
return _superprop_callFoo(...arguments);
};

return _asyncToGenerator(function* () {
console.log("B#foo");
yield _superprop_callFoo();
})();
}

}

new B().foo();

Executed result of above:

$ babel-node src/index.js
B#foo
(node:2329) UnhandledPromiseRejectionWarning: RangeError: Maximum call stack size exceeded
at Arguments.values (<anonymous>)
at _superprop_callFoo (/sandbox/src/index.js:8:15)
at _superprop_callFoo (/sandbox/src/index.js:8:15)
at _superprop_callFoo (/sandbox/src/index.js:8:15)
at _superprop_callFoo (/sandbox/src/index.js:8:15)
at _superprop_callFoo (/sandbox/src/index.js:8:15)
at _superprop_callFoo (/sandbox/src/index.js:8:15)
at _superprop_callFoo (/sandbox/src/index.js:8:15)
at _superprop_callFoo (/sandbox/src/index.js:8:15)
at _superprop_callFoo (/sandbox/src/index.js:8:15)
(node:2329) UnhandledPromiseRejectionWarning: Unhandled promise rejection. Thiserror originated either by throwing inside of an async function without a catchblock, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:2329) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Expected behavior

Expected result of the above example would be like this (if target is default es5 shows so).

B#foo
A#foo

Babel Configuration (.babelrc, package.json, cli command)

babel.config.js

module.exports = {
presets: [
[
"@babel/env",
{
targets: { esmodules: true }
}
]
]
};

Environment

Babel version(s): 7.4.4

Node/npm version: Node 10.15.3/yarn 1.13.0

How you are using Babel: cli

Possible Solution

Additional context/Screenshots

Issue 2:
Bug Report

Current Behavior

I have error RangeError: Maximum call stack size exceeded when I used a super in my async method

Input Code

REPL

class MyClass extends BaseClass {
async loadEntity() {
this.website = await this.loadWebsite();
this.report.setCompany(this.website.company);
super.loadEntity();
}
}

Expected behavior/code

It should work without looping

class MyClass extends BaseClass {
loadEntity() {
var _this = this,
_superprop_callLoadEntity = function _superprop_callLoadEntity() {
return _superprop_callLoadEntity(...arguments); // <= HERE I HAVE LOOPING :(
};

return _asyncToGenerator(function* () {
_this.website = yield _this.loadWebsite();

_this.report.setCompany(_this.website.company);

_superprop_callLoadEntity();
})();
}

}