fix(plugin-proposal-function-bind): fix invalid code emitted for ::super.foo (#12000)
This commit is contained in:
parent
941f610275
commit
76d571e285
@ -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) {
|
||||
|
||||
6
packages/babel-plugin-proposal-function-bind/test/fixtures/function-bind/super/input.js
vendored
Normal file
6
packages/babel-plugin-proposal-function-bind/test/fixtures/function-bind/super/input.js
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
class C {
|
||||
foo() {
|
||||
::super.bar;
|
||||
::super.baz(123);
|
||||
}
|
||||
}
|
||||
7
packages/babel-plugin-proposal-function-bind/test/fixtures/function-bind/super/output.js
vendored
Normal file
7
packages/babel-plugin-proposal-function-bind/test/fixtures/function-bind/super/output.js
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
class C {
|
||||
foo() {
|
||||
super.bar.bind(this);
|
||||
super.baz.call(this, 123);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user