Skip to content

Commit

Permalink
fix(plugin-proposal-function-bind): fix invalid code emitted for `::s…
Browse files Browse the repository at this point in the history
…uper.foo` (#12000)
  • Loading branch information
uhyo committed Aug 24, 2020
1 parent 941f610 commit 76d571e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/babel-plugin-proposal-function-bind/src/index.js
Expand Up @@ -15,7 +15,10 @@ export default declare(api => {

function getStaticContext(bind, scope) {
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) {
Expand Down
@@ -0,0 +1,6 @@
class C {
foo() {
::super.bar;
::super.baz(123);
}
}
@@ -0,0 +1,7 @@
class C {
foo() {
super.bar.bind(this);
super.baz.call(this, 123);
}

}

0 comments on commit 76d571e

Please sign in to comment.