Skip to content

Commit

Permalink
fix: properly wrap private class methods (#12192)
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Oct 16, 2020
1 parent 31396b2 commit a9cd094
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/babel-helper-wrap-function/src/index.js
Expand Up @@ -124,7 +124,7 @@ function plainFunction(path: NodePath, callId: Object) {
}

export default function wrapFunction(path: NodePath, callId: Object) {
if (path.isClassMethod() || path.isObjectMethod()) {
if (path.isMethod()) {
classOrObjectMethod(path, callId);
} else {
plainFunction(path, callId);
Expand Down
@@ -0,0 +1,8 @@
class C {
async * #g() {
this;
await 1;
yield 2;
return 3;
}
}
@@ -0,0 +1,3 @@
{
"plugins": ["external-helpers", "proposal-private-methods", "proposal-async-generator-functions"]
}
@@ -0,0 +1,19 @@
var _g = new WeakSet();

class C {
constructor() {
_g.add(this);
}

}

var _g2 = function _g2() {
var _this = this;

return babelHelpers.wrapAsyncGenerator(function* () {
_this;
yield babelHelpers.awaitAsyncGenerator(1);
yield 2;
return 3;
})();
};

0 comments on commit a9cd094

Please sign in to comment.