fix(plugin-proposal-function-bind): fix invalid code emitted for ::super.foo (#12000)

This commit is contained in:
uhyo 2020-08-25 02:35:31 +09:00 committed by GitHub
parent 941f610275
commit 76d571e285
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 1 deletions

View File

@ -15,7 +15,10 @@ export default declare(api => {
function getStaticContext(bind, scope) { function getStaticContext(bind, scope) {
const object = bind.object || bind.callee.object; const object = bind.object || bind.callee.object;
return scope.isStatic(object) && object; return (
scope.isStatic(object) &&
(t.isSuper(object) ? t.thisExpression() : object)
);
} }
function inferBindContext(bind, scope) { function inferBindContext(bind, scope) {

View File

@ -0,0 +1,6 @@
class C {
foo() {
::super.bar;
::super.baz(123);
}
}

View File

@ -0,0 +1,7 @@
class C {
foo() {
super.bar.bind(this);
super.baz.call(this, 123);
}
}