Skip to content

super is not working inside methods marked async (T6895) #3930

@babel-bot

Description

@babel-bot

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Has PRoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions