Issue 1:
Babelrc, v6.11.4

"babel": {
"plugins": [
"transform-async-to-generator",
"transform-es2015-modules-commonjs",
"transform-export-extensions"
],
"presets": [
"es2016"
]
}

Error:

SyntaxError: /Users/fundon/Dev/repos/trekjs/trek/dist/paths.js: 'super' outside of function or class (32:20)
30 |
31 | return _asyncToGenerator(function* () {
> 32 | const value = super.get(key) || key;
| ^
33 | let matched = value.matched;
34 | if (matched && matched.length) {
35 | return matched;
at Parser.pp.raise (/Users/fundon/Dev/repos/trekjs/trek/node_modules/babylon/lib/parser/location.js:22:13)
at Parser.pp.parseExprAtom (/Users/fundon/Dev/repos/trekjs/trek/node_modules/babylon/lib/parser/expression.js:393:14)

Source code

import globby from 'globby'

export default class Paths extends Map {

constructor (root) {
super()

this.root = root
}

set (key, value) {
super.set(key, value || key)
return this
}

async get (key, absolute = false) {
const value = super.get(key) || key
let matched = value.matched
if (matched && matched.length) {
return matched
}

const pattern = value.glob || (value.single ? key : value)
const result = await globby(pattern, { realpath: absolute, cwd: this.root })
matched = value.matched = value.single ? result[0] : result
this.set(key, value)
return matched
}

async getAll (absolute = false) {
const result = Object.create(null)
for (const key of this.blueprint.keys()) {
result[key] = await this.get(key, absolute) // eslint-disable-line babel/no-await-in-loop
}
return result
}

async globby (pattern, options) {
return await globby(pattern, options)
}

}

Transformed codes

'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});

var _globby = require('globby');

var _globby2 = _interopRequireDefault(_globby);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { return step("next", value); }, function (err) { return step("throw", err); }); } } return step("next"); }); }; }

class Paths extends Map {

constructor(root) {
super();

this.root = root;
}

set(key, value) {
super.set(key, value || key);
return this;
}

get(key, absolute = false) {
var _this = this;

return _asyncToGenerator(function* () {
const value = super.get(key) || key;
let matched = value.matched;
if (matched && matched.length) {
return matched;
}

const pattern = value.glob || (value.single ? key : value);
const result = yield (0, _globby2.default)(pattern, { realpath: absolute, cwd: _this.root });
matched = value.matched = value.single ? result[0] : result;
_this.set(key, value);
return matched;
})();
}

getAll(absolute = false) {
var _this2 = this;

return _asyncToGenerator(function* () {
const result = Object.create(null);
for (const key of _this2.blueprint.keys()) {
result[key] = yield _this2.get(key, absolute); // eslint-disable-line babel/no-await-in-loop
}
return result;
})();
}

globby(pattern, options) {
return _asyncToGenerator(function* () {
return yield (0, _globby2.default)(pattern, options);
})();
}

}
exports.default = Paths;

Issue 2:
Issue originally made by Dmitriy Krasnikov (dmitriy.krasnikov)

Bug information

Babel version: 6.3.26

Node version: 5.3

npm version: 3.3.12

Options

{
plugins:[
"transform-async-to-generator",
]
}

Input code

export class BaseClass {
async test(id){
console.log(id);
}
}
export class ChildClass extends BaseClass{
async test(id){
id=1;
super.test(id);
}
}

let cls = new ChildClass();
cls.test(5);

Description

Outputs:

export class BaseClass {
test(id) {
return _asyncToGenerator(function* () {
console.log(id);
})();
}
}
export class ChildClass extends BaseClass {
test(id) {
return _asyncToGenerator(function* () {
id = 1;
super.test(id);
})();
}
}

let cls = new ChildClass();
cls.test(5);