Skip to content

Commit 700d724

Browse files
authored
Merge pull request #12488 from vvakame/modify-extends
change class inheritance code
2 parents 2ec3508 + 4affef2 commit 700d724

File tree

674 files changed

+7436
-4046
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

674 files changed

+7436
-4046
lines changed

src/compiler/transformers/es2015.ts

+10-5
Original file line numberDiff line numberDiff line change
@@ -3627,10 +3627,15 @@ namespace ts {
36273627
scoped: false,
36283628
priority: 0,
36293629
text: `
3630-
var __extends = (this && this.__extends) || function (d, b) {
3631-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
3632-
function __() { this.constructor = d; }
3633-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3634-
};`
3630+
var __extends = (this && this.__extends) || (function () {
3631+
var extendStatics = Object.setPrototypeOf ||
3632+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
3633+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
3634+
return function (d, b) {
3635+
extendStatics(d, b);
3636+
function __() { this.constructor = d; }
3637+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3638+
};
3639+
})();`
36353640
};
36363641
}

tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,16 @@ module A {
2121

2222

2323
//// [ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js]
24-
var __extends = (this && this.__extends) || function (d, b) {
25-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
26-
function __() { this.constructor = d; }
27-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
28-
};
24+
var __extends = (this && this.__extends) || (function () {
25+
var extendStatics = Object.setPrototypeOf ||
26+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
27+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
28+
return function (d, b) {
29+
extendStatics(d, b);
30+
function __() { this.constructor = d; }
31+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
32+
};
33+
})();
2934
var A;
3035
(function (A) {
3136
var Point = (function () {

tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,16 @@ module A {
2525

2626

2727
//// [ExportClassWithInaccessibleTypeInTypeParameterConstraint.js]
28-
var __extends = (this && this.__extends) || function (d, b) {
29-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
30-
function __() { this.constructor = d; }
31-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
32-
};
28+
var __extends = (this && this.__extends) || (function () {
29+
var extendStatics = Object.setPrototypeOf ||
30+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
31+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
32+
return function (d, b) {
33+
extendStatics(d, b);
34+
function __() { this.constructor = d; }
35+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
36+
};
37+
})();
3338
var A;
3439
(function (A) {
3540
var Point = (function () {

tests/baselines/reference/abstractClassInLocalScope.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@
88

99

1010
//// [abstractClassInLocalScope.js]
11-
var __extends = (this && this.__extends) || function (d, b) {
12-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
13-
function __() { this.constructor = d; }
14-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15-
};
11+
var __extends = (this && this.__extends) || (function () {
12+
var extendStatics = Object.setPrototypeOf ||
13+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
14+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
15+
return function (d, b) {
16+
extendStatics(d, b);
17+
function __() { this.constructor = d; }
18+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
19+
};
20+
})();
1621
(function () {
1722
var A = (function () {
1823
function A() {

tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@
88

99

1010
//// [abstractClassInLocalScopeIsAbstract.js]
11-
var __extends = (this && this.__extends) || function (d, b) {
12-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
13-
function __() { this.constructor = d; }
14-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15-
};
11+
var __extends = (this && this.__extends) || (function () {
12+
var extendStatics = Object.setPrototypeOf ||
13+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
14+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
15+
return function (d, b) {
16+
extendStatics(d, b);
17+
function __() { this.constructor = d; }
18+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
19+
};
20+
})();
1621
(function () {
1722
var A = (function () {
1823
function A() {

tests/baselines/reference/abstractProperty.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,16 @@ class C extends B {
2222
}
2323

2424
//// [abstractProperty.js]
25-
var __extends = (this && this.__extends) || function (d, b) {
26-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
27-
function __() { this.constructor = d; }
28-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
29-
};
25+
var __extends = (this && this.__extends) || (function () {
26+
var extendStatics = Object.setPrototypeOf ||
27+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
28+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
29+
return function (d, b) {
30+
extendStatics(d, b);
31+
function __() { this.constructor = d; }
32+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
33+
};
34+
})();
3035
var B = (function () {
3136
function B() {
3237
}

tests/baselines/reference/abstractPropertyNegative.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,16 @@ abstract class AbstractAccessorMismatch {
4444

4545

4646
//// [abstractPropertyNegative.js]
47-
var __extends = (this && this.__extends) || function (d, b) {
48-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
49-
function __() { this.constructor = d; }
50-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
51-
};
47+
var __extends = (this && this.__extends) || (function () {
48+
var extendStatics = Object.setPrototypeOf ||
49+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
50+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
51+
return function (d, b) {
52+
extendStatics(d, b);
53+
function __() { this.constructor = d; }
54+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
55+
};
56+
})();
5257
var B = (function () {
5358
function B() {
5459
}

tests/baselines/reference/accessOverriddenBaseClassMember1.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,16 @@ class ColoredPoint extends Point {
1616

1717

1818
//// [accessOverriddenBaseClassMember1.js]
19-
var __extends = (this && this.__extends) || function (d, b) {
20-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
21-
function __() { this.constructor = d; }
22-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
23-
};
19+
var __extends = (this && this.__extends) || (function () {
20+
var extendStatics = Object.setPrototypeOf ||
21+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
22+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
23+
return function (d, b) {
24+
extendStatics(d, b);
25+
function __() { this.constructor = d; }
26+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
27+
};
28+
})();
2429
var Point = (function () {
2530
function Point(x, y) {
2631
this.x = x;

tests/baselines/reference/accessors_spec_section-4.5_inference.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,16 @@ class LanguageSpec_section_4_5_inference {
2525
}
2626

2727
//// [accessors_spec_section-4.5_inference.js]
28-
var __extends = (this && this.__extends) || function (d, b) {
29-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
30-
function __() { this.constructor = d; }
31-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
32-
};
28+
var __extends = (this && this.__extends) || (function () {
29+
var extendStatics = Object.setPrototypeOf ||
30+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
31+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
32+
return function (d, b) {
33+
extendStatics(d, b);
34+
function __() { this.constructor = d; }
35+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
36+
};
37+
})();
3338
var A = (function () {
3439
function A() {
3540
}

tests/baselines/reference/aliasUsageInAccessorsOfClass.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,16 @@ var Model = (function () {
3737
exports.Model = Model;
3838
//// [aliasUsage1_moduleA.js]
3939
"use strict";
40-
var __extends = (this && this.__extends) || function (d, b) {
41-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
42-
function __() { this.constructor = d; }
43-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
44-
};
40+
var __extends = (this && this.__extends) || (function () {
41+
var extendStatics = Object.setPrototypeOf ||
42+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
43+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
44+
return function (d, b) {
45+
extendStatics(d, b);
46+
function __() { this.constructor = d; }
47+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
48+
};
49+
})();
4550
var Backbone = require("./aliasUsage1_backbone");
4651
var VisualizationModel = (function (_super) {
4752
__extends(VisualizationModel, _super);

tests/baselines/reference/aliasUsageInArray.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,16 @@ var Model = (function () {
3131
exports.Model = Model;
3232
//// [aliasUsageInArray_moduleA.js]
3333
"use strict";
34-
var __extends = (this && this.__extends) || function (d, b) {
35-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
36-
function __() { this.constructor = d; }
37-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
38-
};
34+
var __extends = (this && this.__extends) || (function () {
35+
var extendStatics = Object.setPrototypeOf ||
36+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
37+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
38+
return function (d, b) {
39+
extendStatics(d, b);
40+
function __() { this.constructor = d; }
41+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
42+
};
43+
})();
3944
var Backbone = require("./aliasUsageInArray_backbone");
4045
var VisualizationModel = (function (_super) {
4146
__extends(VisualizationModel, _super);

tests/baselines/reference/aliasUsageInFunctionExpression.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,16 @@ var Model = (function () {
3030
exports.Model = Model;
3131
//// [aliasUsageInFunctionExpression_moduleA.js]
3232
"use strict";
33-
var __extends = (this && this.__extends) || function (d, b) {
34-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
35-
function __() { this.constructor = d; }
36-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
37-
};
33+
var __extends = (this && this.__extends) || (function () {
34+
var extendStatics = Object.setPrototypeOf ||
35+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
36+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
37+
return function (d, b) {
38+
extendStatics(d, b);
39+
function __() { this.constructor = d; }
40+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
41+
};
42+
})();
3843
var Backbone = require("./aliasUsageInFunctionExpression_backbone");
3944
var VisualizationModel = (function (_super) {
4045
__extends(VisualizationModel, _super);

tests/baselines/reference/aliasUsageInGenericFunction.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,16 @@ var Model = (function () {
3434
exports.Model = Model;
3535
//// [aliasUsageInGenericFunction_moduleA.js]
3636
"use strict";
37-
var __extends = (this && this.__extends) || function (d, b) {
38-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
39-
function __() { this.constructor = d; }
40-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
41-
};
37+
var __extends = (this && this.__extends) || (function () {
38+
var extendStatics = Object.setPrototypeOf ||
39+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
40+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
41+
return function (d, b) {
42+
extendStatics(d, b);
43+
function __() { this.constructor = d; }
44+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
45+
};
46+
})();
4247
var Backbone = require("./aliasUsageInGenericFunction_backbone");
4348
var VisualizationModel = (function (_super) {
4449
__extends(VisualizationModel, _super);

tests/baselines/reference/aliasUsageInIndexerOfClass.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,16 @@ var Model = (function () {
3636
exports.Model = Model;
3737
//// [aliasUsageInIndexerOfClass_moduleA.js]
3838
"use strict";
39-
var __extends = (this && this.__extends) || function (d, b) {
40-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
41-
function __() { this.constructor = d; }
42-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
43-
};
39+
var __extends = (this && this.__extends) || (function () {
40+
var extendStatics = Object.setPrototypeOf ||
41+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
42+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
43+
return function (d, b) {
44+
extendStatics(d, b);
45+
function __() { this.constructor = d; }
46+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
47+
};
48+
})();
4449
var Backbone = require("./aliasUsageInIndexerOfClass_backbone");
4550
var VisualizationModel = (function (_super) {
4651
__extends(VisualizationModel, _super);

tests/baselines/reference/aliasUsageInObjectLiteral.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,16 @@ var Model = (function () {
3131
exports.Model = Model;
3232
//// [aliasUsageInObjectLiteral_moduleA.js]
3333
"use strict";
34-
var __extends = (this && this.__extends) || function (d, b) {
35-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
36-
function __() { this.constructor = d; }
37-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
38-
};
34+
var __extends = (this && this.__extends) || (function () {
35+
var extendStatics = Object.setPrototypeOf ||
36+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
37+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
38+
return function (d, b) {
39+
extendStatics(d, b);
40+
function __() { this.constructor = d; }
41+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
42+
};
43+
})();
3944
var Backbone = require("./aliasUsageInObjectLiteral_backbone");
4045
var VisualizationModel = (function (_super) {
4146
__extends(VisualizationModel, _super);

tests/baselines/reference/aliasUsageInOrExpression.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,16 @@ var Model = (function () {
3434
exports.Model = Model;
3535
//// [aliasUsageInOrExpression_moduleA.js]
3636
"use strict";
37-
var __extends = (this && this.__extends) || function (d, b) {
38-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
39-
function __() { this.constructor = d; }
40-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
41-
};
37+
var __extends = (this && this.__extends) || (function () {
38+
var extendStatics = Object.setPrototypeOf ||
39+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
40+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
41+
return function (d, b) {
42+
extendStatics(d, b);
43+
function __() { this.constructor = d; }
44+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
45+
};
46+
})();
4247
var Backbone = require("./aliasUsageInOrExpression_backbone");
4348
var VisualizationModel = (function (_super) {
4449
__extends(VisualizationModel, _super);

tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js

+20-10
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,16 @@ var Model = (function () {
3434
exports.Model = Model;
3535
//// [aliasUsageInTypeArgumentOfExtendsClause_moduleA.js]
3636
"use strict";
37-
var __extends = (this && this.__extends) || function (d, b) {
38-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
39-
function __() { this.constructor = d; }
40-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
41-
};
37+
var __extends = (this && this.__extends) || (function () {
38+
var extendStatics = Object.setPrototypeOf ||
39+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
40+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
41+
return function (d, b) {
42+
extendStatics(d, b);
43+
function __() { this.constructor = d; }
44+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
45+
};
46+
})();
4247
var Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone");
4348
var VisualizationModel = (function (_super) {
4449
__extends(VisualizationModel, _super);
@@ -50,11 +55,16 @@ var VisualizationModel = (function (_super) {
5055
exports.VisualizationModel = VisualizationModel;
5156
//// [aliasUsageInTypeArgumentOfExtendsClause_main.js]
5257
"use strict";
53-
var __extends = (this && this.__extends) || function (d, b) {
54-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
55-
function __() { this.constructor = d; }
56-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
57-
};
58+
var __extends = (this && this.__extends) || (function () {
59+
var extendStatics = Object.setPrototypeOf ||
60+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
61+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
62+
return function (d, b) {
63+
extendStatics(d, b);
64+
function __() { this.constructor = d; }
65+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
66+
};
67+
})();
5868
var moduleA = require("./aliasUsageInTypeArgumentOfExtendsClause_moduleA");
5969
var C = (function () {
6070
function C() {

0 commit comments

Comments
 (0)