Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxingbaoyu committed May 28, 2022
1 parent f15cf3f commit fbc4b1c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
3 changes: 2 additions & 1 deletion packages/babel-plugin-transform-new-target/src/index.ts
Expand Up @@ -53,7 +53,8 @@ export default declare(api => {
// packages/babel-helper-create-class-features-plugin/src/fields.ts#L192 unshadow
let scope = path.scope;
while (
scope?.hasBinding(node.id.name) &&
scope !== func.parentPath.scope &&
scope?.hasOwnBinding(node.id.name) &&
!scope.bindingIdentifierEquals(node.id.name, node.id)
) {
scope.rename(node.id.name);
Expand Down
@@ -1,10 +1,12 @@
function Foo() {
var Foo = new.target;
}
function Foo() {
var Foo = new.target;
}

Foo.prototype.test = function() {
var Foo = new.target;
};
Foo.prototype.test = function() {
var Foo = new.target;
};
}

var Bar = function() {
var Bar = new.target;
Expand Down
@@ -1,10 +1,12 @@
function Foo() {
var _Foo = this instanceof Foo ? this.constructor : void 0;
}
function Foo() {
var _Foo = this instanceof Foo ? this.constructor : void 0;
}

Foo.prototype.test = function _target() {
var Foo = this instanceof _target ? this.constructor : void 0;
};
Foo.prototype.test = function _target() {
var Foo = this instanceof _target ? this.constructor : void 0;
};
}

var Bar = function _target2() {
var Bar = this instanceof _target2 ? this.constructor : void 0;
Expand Down

0 comments on commit fbc4b1c

Please sign in to comment.