Merge pull request #6481 from nicolo-ribaudo/fn-bind-dupl-nodes-6458
Don't insert duplicated nodes when transforming function bind
This commit is contained in:
commit
0951720a81
@ -16,7 +16,7 @@ export default function({ types: t }) {
|
||||
|
||||
function inferBindContext(bind, scope) {
|
||||
const staticContext = getStaticContext(bind, scope);
|
||||
if (staticContext) return staticContext;
|
||||
if (staticContext) return t.cloneDeep(staticContext);
|
||||
|
||||
const tempId = getTempId(scope);
|
||||
if (bind.object) {
|
||||
|
||||
3
packages/babel-plugin-transform-function-bind/test/fixtures/regression/6458/actual.js
vendored
Normal file
3
packages/babel-plugin-transform-function-bind/test/fixtures/regression/6458/actual.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
import Obj from "./file";
|
||||
|
||||
console.log(::Obj.method);
|
||||
7
packages/babel-plugin-transform-function-bind/test/fixtures/regression/6458/expected.js
vendored
Normal file
7
packages/babel-plugin-transform-function-bind/test/fixtures/regression/6458/expected.js
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var _file = _interopRequireDefault(require("./file"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
console.log(_file.default.method.bind(_file.default));
|
||||
3
packages/babel-plugin-transform-function-bind/test/fixtures/regression/6458/options.json
vendored
Normal file
3
packages/babel-plugin-transform-function-bind/test/fixtures/regression/6458/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["transform-function-bind", "transform-es2015-modules-commonjs"]
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user