@@ -3543,10 +3543,7 @@ Generated by [AVA](https://avajs.dev).
3543
3543
if (typeof f == "function") {β
3544
3544
var a = function a () {β
3545
3545
if (this instanceof a) {β
3546
- var args = [null];β
3547
- args.push.apply(args, arguments);β
3548
- var Ctor = Function.bind.apply(f, args);β
3549
- return new Ctor();β
3546
+ return Reflect.construct(f, arguments, this.constructor);β
3550
3547
}β
3551
3548
return f.apply(this, arguments);β
3552
3549
};β
@@ -3630,10 +3627,7 @@ Generated by [AVA](https://avajs.dev).
3630
3627
if (typeof f == "function") {β
3631
3628
var a = function a () {β
3632
3629
if (this instanceof a) {β
3633
- var args = [null];β
3634
- args.push.apply(args, arguments);β
3635
- var Ctor = Function.bind.apply(f, args);β
3636
- return new Ctor();β
3630
+ return Reflect.construct(f, arguments, this.constructor);β
3637
3631
}β
3638
3632
return f.apply(this, arguments);β
3639
3633
};β
@@ -3711,10 +3705,7 @@ Generated by [AVA](https://avajs.dev).
3711
3705
if (typeof f == "function") {β
3712
3706
var a = function a () {β
3713
3707
if (this instanceof a) {β
3714
- var args = [null];β
3715
- args.push.apply(args, arguments);β
3716
- var Ctor = Function.bind.apply(f, args);β
3717
- return new Ctor();β
3708
+ return Reflect.construct(f, arguments, this.constructor);β
3718
3709
}β
3719
3710
return f.apply(this, arguments);β
3720
3711
};β
@@ -3822,10 +3813,7 @@ Generated by [AVA](https://avajs.dev).
3822
3813
if (typeof f == "function") {β
3823
3814
var a = function a () {β
3824
3815
if (this instanceof a) {β
3825
- var args = [null];β
3826
- args.push.apply(args, arguments);β
3827
- var Ctor = Function.bind.apply(f, args);β
3828
- return new Ctor();β
3816
+ return Reflect.construct(f, arguments, this.constructor);β
3829
3817
}β
3830
3818
return f.apply(this, arguments);β
3831
3819
};β
@@ -3915,10 +3903,7 @@ Generated by [AVA](https://avajs.dev).
3915
3903
if (typeof f == "function") {β
3916
3904
var a = function a () {β
3917
3905
if (this instanceof a) {β
3918
- var args = [null];β
3919
- args.push.apply(args, arguments);β
3920
- var Ctor = Function.bind.apply(f, args);β
3921
- return new Ctor();β
3906
+ return Reflect.construct(f, arguments, this.constructor);β
3922
3907
}β
3923
3908
return f.apply(this, arguments);β
3924
3909
};β
@@ -4104,10 +4089,7 @@ Generated by [AVA](https://avajs.dev).
4104
4089
if (typeof f == "function") {β
4105
4090
var a = function a () {β
4106
4091
if (this instanceof a) {β
4107
- var args = [null];β
4108
- args.push.apply(args, arguments);β
4109
- var Ctor = Function.bind.apply(f, args);β
4110
- return new Ctor();β
4092
+ return Reflect.construct(f, arguments, this.constructor);β
4111
4093
}β
4112
4094
return f.apply(this, arguments);β
4113
4095
};β
@@ -4341,10 +4323,7 @@ Generated by [AVA](https://avajs.dev).
4341
4323
if (typeof f == "function") {β
4342
4324
var a = function a () {β
4343
4325
if (this instanceof a) {β
4344
- var args = [null];β
4345
- args.push.apply(args, arguments);β
4346
- var Ctor = Function.bind.apply(f, args);β
4347
- return new Ctor();β
4326
+ return Reflect.construct(f, arguments, this.constructor);β
4348
4327
}β
4349
4328
return f.apply(this, arguments);β
4350
4329
};β
@@ -4444,10 +4423,7 @@ Generated by [AVA](https://avajs.dev).
4444
4423
if (typeof f == "function") {β
4445
4424
var a = function a () {β
4446
4425
if (this instanceof a) {β
4447
- var args = [null];β
4448
- args.push.apply(args, arguments);β
4449
- var Ctor = Function.bind.apply(f, args);β
4450
- return new Ctor();β
4426
+ return Reflect.construct(f, arguments, this.constructor);β
4451
4427
}β
4452
4428
return f.apply(this, arguments);β
4453
4429
};β
@@ -4638,10 +4614,7 @@ Generated by [AVA](https://avajs.dev).
4638
4614
if (typeof f == "function") {β
4639
4615
var a = function a () {β
4640
4616
if (this instanceof a) {β
4641
- var args = [null];β
4642
- args.push.apply(args, arguments);β
4643
- var Ctor = Function.bind.apply(f, args);β
4644
- return new Ctor();β
4617
+ return Reflect.construct(f, arguments, this.constructor);β
4645
4618
}β
4646
4619
return f.apply(this, arguments);β
4647
4620
};β
@@ -4917,10 +4890,7 @@ Generated by [AVA](https://avajs.dev).
4917
4890
if (typeof f == "function") {β
4918
4891
var a = function a () {β
4919
4892
if (this instanceof a) {β
4920
- var args = [null];β
4921
- args.push.apply(args, arguments);β
4922
- var Ctor = Function.bind.apply(f, args);β
4923
- return new Ctor();β
4893
+ return Reflect.construct(f, arguments, this.constructor);β
4924
4894
}β
4925
4895
return f.apply(this, arguments);β
4926
4896
};β
@@ -5012,10 +4982,7 @@ Generated by [AVA](https://avajs.dev).
5012
4982
if (typeof f == "function") {β
5013
4983
var a = function a () {β
5014
4984
if (this instanceof a) {β
5015
- var args = [null];β
5016
- args.push.apply(args, arguments);β
5017
- var Ctor = Function.bind.apply(f, args);β
5018
- return new Ctor();β
4985
+ return Reflect.construct(f, arguments, this.constructor);β
5019
4986
}β
5020
4987
return f.apply(this, arguments);β
5021
4988
};β
@@ -5899,6 +5866,65 @@ Generated by [AVA](https://avajs.dev).
5899
5866
`,
5900
5867
}
5901
5868
5869
+ ## preserv-this-reference-in-the-child-class
5870
+
5871
+ > Snapshot 1
5872
+
5873
+ {
5874
+ 'main.js': `'use strict';β
5875
+ β
5876
+ function getAugmentedNamespace(n) {β
5877
+ if (n.__esModule) return n;β
5878
+ var f = n.default;β
5879
+ if (typeof f == "function") {β
5880
+ var a = function a () {β
5881
+ if (this instanceof a) {β
5882
+ return Reflect.construct(f, arguments, this.constructor);β
5883
+ }β
5884
+ return f.apply(this, arguments);β
5885
+ };β
5886
+ a.prototype = f.prototype;β
5887
+ } else a = {};β
5888
+ Object.defineProperty(a, '__esModule', {value: true});β
5889
+ Object.keys(n).forEach(function (k) {β
5890
+ var d = Object.getOwnPropertyDescriptor(n, k);β
5891
+ Object.defineProperty(a, k, d.get ? d : {β
5892
+ enumerable: true,β
5893
+ get: function () {β
5894
+ return n[k];β
5895
+ }β
5896
+ });β
5897
+ });β
5898
+ return a;β
5899
+ }β
5900
+ β
5901
+ var main = {};β
5902
+ β
5903
+ function Dep$1(){}β
5904
+ β
5905
+ var dep = /*#__PURE__*/Object.freeze({β
5906
+ __proto__: null,β
5907
+ default: Dep$1β
5908
+ });β
5909
+ β
5910
+ var require$$0 = /*@__PURE__*/getAugmentedNamespace(dep);β
5911
+ β
5912
+ const Dep = require$$0;β
5913
+ β
5914
+ class Main extends Dep {β
5915
+ constructor() {β
5916
+ super();β
5917
+ this.name = this.constructor.name;β
5918
+ }β
5919
+ static name = "main";β
5920
+ }β
5921
+ β
5922
+ t.is(new Main().name, "main");β
5923
+ β
5924
+ module.exports = main;β
5925
+ `,
5926
+ }
5927
+
5902
5928
## preserve-modules
5903
5929
5904
5930
> Snapshot 1
@@ -6370,10 +6396,7 @@ Generated by [AVA](https://avajs.dev).
6370
6396
if (typeof f == "function") {β
6371
6397
var a = function a () {β
6372
6398
if (this instanceof a) {β
6373
- var args = [null];β
6374
- args.push.apply(args, arguments);β
6375
- var Ctor = Function.bind.apply(f, args);β
6376
- return new Ctor();β
6399
+ return Reflect.construct(f, arguments, this.constructor);β
6377
6400
}β
6378
6401
return f.apply(this, arguments);β
6379
6402
};β
@@ -6422,10 +6445,7 @@ Generated by [AVA](https://avajs.dev).
6422
6445
if (typeof f == "function") {β
6423
6446
var a = function a () {β
6424
6447
if (this instanceof a) {β
6425
- var args = [null];β
6426
- args.push.apply(args, arguments);β
6427
- var Ctor = Function.bind.apply(f, args);β
6428
- return new Ctor();β
6448
+ return Reflect.construct(f, arguments, this.constructor);β
6429
6449
}β
6430
6450
return f.apply(this, arguments);β
6431
6451
};β
@@ -7435,10 +7455,7 @@ Generated by [AVA](https://avajs.dev).
7435
7455
if (typeof f == "function") {β
7436
7456
var a = function a () {β
7437
7457
if (this instanceof a) {β
7438
- var args = [null];β
7439
- args.push.apply(args, arguments);β
7440
- var Ctor = Function.bind.apply(f, args);β
7441
- return new Ctor();β
7458
+ return Reflect.construct(f, arguments, this.constructor);β
7442
7459
}β
7443
7460
return f.apply(this, arguments);β
7444
7461
};β
@@ -7488,10 +7505,7 @@ Generated by [AVA](https://avajs.dev).
7488
7505
if (typeof f == "function") {β
7489
7506
var a = function a () {β
7490
7507
if (this instanceof a) {β
7491
- var args = [null];β
7492
- args.push.apply(args, arguments);β
7493
- var Ctor = Function.bind.apply(f, args);β
7494
- return new Ctor();β
7508
+ return Reflect.construct(f, arguments, this.constructor);β
7495
7509
}β
7496
7510
return f.apply(this, arguments);β
7497
7511
};β
0 commit comments