fix: properly wrap private class methods (#12192)
This commit is contained in:
parent
31396b286d
commit
a9cd0945b7
@ -124,7 +124,7 @@ function plainFunction(path: NodePath, callId: Object) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function wrapFunction(path: NodePath, callId: Object) {
|
export default function wrapFunction(path: NodePath, callId: Object) {
|
||||||
if (path.isClassMethod() || path.isObjectMethod()) {
|
if (path.isMethod()) {
|
||||||
classOrObjectMethod(path, callId);
|
classOrObjectMethod(path, callId);
|
||||||
} else {
|
} else {
|
||||||
plainFunction(path, callId);
|
plainFunction(path, callId);
|
||||||
|
|||||||
@ -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;
|
||||||
|
})();
|
||||||
|
};
|
||||||
Loading…
x
Reference in New Issue
Block a user