Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Super in async methods with generators #2104

Open
arv opened this issue Apr 11, 2016 · 0 comments
Open

Super in async methods with generators #2104

arv opened this issue Apr 11, 2016 · 0 comments
Assignees
Labels

Comments

@arv
Copy link
Collaborator

arv commented Apr 11, 2016

When compiling async functions to generators, super in async methods do not work correctly.

// Options: --async-functions --generators=parse --classes=parse

class B {
  m() {
    console.log('B-m');
  }
}
class C extends B {
  async m() {
    super.m();
  }
}
new C().m();

compiles to:

$traceurRuntime.ModuleStore.getAnonymousModule(function() {
  "use strict";
  class B {
    m() {
      console.log('B-m');
    }
  }
  class C extends B {
    m() {
      return $traceurRuntime.spawn(this, null, function*() {
        super.m();
      });
    }
  }
  new C().m();
  return {};
});
//# sourceURL=traceured.js

which of course does not work.

We need to transform that super.m using the SuperTransformer to:

$traceurRuntime.superGet(this, C.prototype, "m").call(this);
@arv arv self-assigned this Apr 11, 2016
@arv arv added the bug label Apr 11, 2016
@arv arv changed the title Super in async methods with generatorts Super in async methods with generators May 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant