Skip to content

Commit c8f1a87

Browse files
authored
Exempt tslib from indirect call transform (#47070)
1 parent a72bf54 commit c8f1a87

File tree

34 files changed

+94
-94
lines changed

34 files changed

+94
-94
lines changed

src/compiler/transformers/module/module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,7 +1853,7 @@ namespace ts {
18531853
if (isIdentifier(node.expression)) {
18541854
const expression = substituteExpressionIdentifier(node.expression);
18551855
noSubstitution[getNodeId(expression)] = true;
1856-
if (!isIdentifier(expression)) {
1856+
if (!isIdentifier(expression) && !(getEmitFlags(node.expression) & EmitFlags.HelperName)) {
18571857
return addEmitFlags(
18581858
factory.updateCallExpression(node,
18591859
expression,
@@ -1872,7 +1872,7 @@ namespace ts {
18721872
if (isIdentifier(node.tag)) {
18731873
const tag = substituteExpressionIdentifier(node.tag);
18741874
noSubstitution[getNodeId(tag)] = true;
1875-
if (!isIdentifier(tag)) {
1875+
if (!isIdentifier(tag) && !(getEmitFlags(node.tag) & EmitFlags.HelperName)) {
18761876
return addEmitFlags(
18771877
factory.updateTaggedTemplateExpression(node,
18781878
tag,

tests/baselines/reference/es5-importHelpersAsyncFunctions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
2323
exports.foo = void 0;
2424
var tslib_1 = require("tslib");
2525
function foo() {
26-
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
27-
return (0, tslib_1.__generator)(this, function (_a) {
26+
return tslib_1.__awaiter(this, void 0, void 0, function () {
27+
return tslib_1.__generator(this, function (_a) {
2828
return [2 /*return*/];
2929
});
3030
});

tests/baselines/reference/esModuleInteropImportTSLibHasImport.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ exports.username = username;
2626
"use strict";
2727
Object.defineProperty(exports, "__esModule", { value: true });
2828
const tslib_1 = require("tslib");
29-
(0, tslib_1.__exportStar)(require("./username"), exports);
29+
tslib_1.__exportStar(require("./username"), exports);
3030
//// [hello.js]
3131
"use strict";
3232
Object.defineProperty(exports, "__esModule", { value: true });
@@ -36,6 +36,6 @@ exports.default = sayHello;
3636
"use strict";
3737
Object.defineProperty(exports, "__esModule", { value: true });
3838
const tslib_1 = require("tslib");
39-
const hello_1 = (0, tslib_1.__importDefault)(require("./hello"));
39+
const hello_1 = tslib_1.__importDefault(require("./hello"));
4040
const utils_1 = require("./utils");
4141
(0, hello_1.default)((0, utils_1.username)());

tests/baselines/reference/esModuleInteropTslibHelpers.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export { Bar }
2424
exports.__esModule = true;
2525
exports.Foo = void 0;
2626
var tslib_1 = require("tslib");
27-
var path_1 = (0, tslib_1.__importDefault)(require("path"));
27+
var path_1 = tslib_1.__importDefault(require("path"));
2828
path_1["default"].resolve("", "../");
2929
var Foo = /** @class */ (function () {
3030
function Foo() {
@@ -37,7 +37,7 @@ exports.Foo = Foo;
3737
exports.__esModule = true;
3838
exports.Foo2 = void 0;
3939
var tslib_1 = require("tslib");
40-
var path = (0, tslib_1.__importStar)(require("path"));
40+
var path = tslib_1.__importStar(require("path"));
4141
path.resolve("", "../");
4242
var Foo2 = /** @class */ (function () {
4343
function Foo2() {
@@ -50,7 +50,7 @@ exports.Foo2 = Foo2;
5050
exports.__esModule = true;
5151
exports.Foo3 = void 0;
5252
var tslib_1 = require("tslib");
53-
var path_1 = (0, tslib_1.__importDefault)(require("path"));
53+
var path_1 = tslib_1.__importDefault(require("path"));
5454
(0, path_1["default"])("", "../");
5555
var Foo3 = /** @class */ (function () {
5656
function Foo3() {
@@ -63,6 +63,6 @@ exports.Foo3 = Foo3;
6363
exports.__esModule = true;
6464
exports.Bar = void 0;
6565
var tslib_1 = require("tslib");
66-
var path_1 = (0, tslib_1.__importStar)(require("path"));
66+
var path_1 = tslib_1.__importStar(require("path"));
6767
exports.Bar = path_1.Bar;
6868
(0, path_1["default"])("", "../");

tests/baselines/reference/exportAsNamespace_missingEmitHelpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ exports.__esModule = true;
1515
exports.__esModule = true;
1616
exports.ns = void 0;
1717
var tslib_1 = require("tslib");
18-
exports.ns = (0, tslib_1.__importStar)(require("./a")); // Error
18+
exports.ns = tslib_1.__importStar(require("./a")); // Error

tests/baselines/reference/importHelpers.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ var A = /** @class */ (function () {
5858
}());
5959
exports.A = A;
6060
var B = /** @class */ (function (_super) {
61-
(0, tslib_1.__extends)(B, _super);
61+
tslib_1.__extends(B, _super);
6262
function B() {
6363
return _super !== null && _super.apply(this, arguments) || this;
6464
}
@@ -70,21 +70,21 @@ var C = /** @class */ (function () {
7070
}
7171
C.prototype.method = function (x) {
7272
};
73-
(0, tslib_1.__decorate)([
74-
(0, tslib_1.__param)(0, dec),
75-
(0, tslib_1.__metadata)("design:type", Function),
76-
(0, tslib_1.__metadata)("design:paramtypes", [Number]),
77-
(0, tslib_1.__metadata)("design:returntype", void 0)
73+
tslib_1.__decorate([
74+
tslib_1.__param(0, dec),
75+
tslib_1.__metadata("design:type", Function),
76+
tslib_1.__metadata("design:paramtypes", [Number]),
77+
tslib_1.__metadata("design:returntype", void 0)
7878
], C.prototype, "method", null);
79-
C = (0, tslib_1.__decorate)([
79+
C = tslib_1.__decorate([
8080
dec
8181
], C);
8282
return C;
8383
}());
8484
function id(x) {
8585
return x;
8686
}
87-
exports.result = id(templateObject_1 || (templateObject_1 = (0, tslib_1.__makeTemplateObject)(["hello world"], ["hello world"])));
87+
exports.result = id(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["hello world"], ["hello world"])));
8888
var templateObject_1;
8989
//// [script.js]
9090
var __extends = (this && this.__extends) || (function () {

tests/baselines/reference/importHelpersAmd.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ define(["require", "exports", "tslib", "./a", "./a"], function (require, exports
3636
"use strict";
3737
Object.defineProperty(exports, "__esModule", { value: true });
3838
exports.B = void 0;
39-
(0, tslib_1.__exportStar)(a_2, exports);
39+
tslib_1.__exportStar(a_2, exports);
4040
var B = /** @class */ (function (_super) {
41-
(0, tslib_1.__extends)(B, _super);
41+
tslib_1.__extends(B, _super);
4242
function B() {
4343
return _super !== null && _super.apply(this, arguments) || this;
4444
}

tests/baselines/reference/importHelpersInIsolatedModules.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ var A = /** @class */ (function () {
4545
}());
4646
exports.A = A;
4747
var B = /** @class */ (function (_super) {
48-
(0, tslib_1.__extends)(B, _super);
48+
tslib_1.__extends(B, _super);
4949
function B() {
5050
return _super !== null && _super.apply(this, arguments) || this;
5151
}
@@ -57,13 +57,13 @@ var C = /** @class */ (function () {
5757
}
5858
C.prototype.method = function (x) {
5959
};
60-
(0, tslib_1.__decorate)([
61-
(0, tslib_1.__param)(0, dec),
62-
(0, tslib_1.__metadata)("design:type", Function),
63-
(0, tslib_1.__metadata)("design:paramtypes", [Number]),
64-
(0, tslib_1.__metadata)("design:returntype", void 0)
60+
tslib_1.__decorate([
61+
tslib_1.__param(0, dec),
62+
tslib_1.__metadata("design:type", Function),
63+
tslib_1.__metadata("design:paramtypes", [Number]),
64+
tslib_1.__metadata("design:returntype", void 0)
6565
], C.prototype, "method", null);
66-
C = (0, tslib_1.__decorate)([
66+
C = tslib_1.__decorate([
6767
dec
6868
], C);
6969
return C;
@@ -76,7 +76,7 @@ var A = /** @class */ (function () {
7676
return A;
7777
}());
7878
var B = /** @class */ (function (_super) {
79-
(0, tslib_1.__extends)(B, _super);
79+
tslib_1.__extends(B, _super);
8080
function B() {
8181
return _super !== null && _super.apply(this, arguments) || this;
8282
}
@@ -87,13 +87,13 @@ var C = /** @class */ (function () {
8787
}
8888
C.prototype.method = function (x) {
8989
};
90-
(0, tslib_1.__decorate)([
91-
(0, tslib_1.__param)(0, dec),
92-
(0, tslib_1.__metadata)("design:type", Function),
93-
(0, tslib_1.__metadata)("design:paramtypes", [Number]),
94-
(0, tslib_1.__metadata)("design:returntype", void 0)
90+
tslib_1.__decorate([
91+
tslib_1.__param(0, dec),
92+
tslib_1.__metadata("design:type", Function),
93+
tslib_1.__metadata("design:paramtypes", [Number]),
94+
tslib_1.__metadata("design:returntype", void 0)
9595
], C.prototype, "method", null);
96-
C = (0, tslib_1.__decorate)([
96+
C = tslib_1.__decorate([
9797
dec
9898
], C);
9999
return C;

tests/baselines/reference/importHelpersInTsx.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export declare function __awaiter(thisArg: any, _arguments: any, P: Function, ge
2424
Object.defineProperty(exports, "__esModule", { value: true });
2525
exports.x = void 0;
2626
var tslib_1 = require("tslib");
27-
exports.x = React.createElement("span", (0, tslib_1.__assign)({}, o));
27+
exports.x = React.createElement("span", tslib_1.__assign({}, o));
2828
//// [script.js]
2929
var __assign = (this && this.__assign) || function () {
3030
__assign = Object.assign || function(t) {

tests/baselines/reference/importHelpersNoHelpers.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ exports.x = 1;
4646
Object.defineProperty(exports, "__esModule", { value: true });
4747
exports.B = exports.A = void 0;
4848
var tslib_1 = require("tslib");
49-
(0, tslib_1.__exportStar)(require("./other"), exports);
49+
tslib_1.__exportStar(require("./other"), exports);
5050
var A = /** @class */ (function () {
5151
function A() {
5252
}
5353
return A;
5454
}());
5555
exports.A = A;
5656
var B = /** @class */ (function (_super) {
57-
(0, tslib_1.__extends)(B, _super);
57+
tslib_1.__extends(B, _super);
5858
function B() {
5959
return _super !== null && _super.apply(this, arguments) || this;
6060
}
@@ -66,20 +66,20 @@ var C = /** @class */ (function () {
6666
}
6767
C.prototype.method = function (x) {
6868
};
69-
(0, tslib_1.__decorate)([
70-
(0, tslib_1.__param)(0, dec),
71-
(0, tslib_1.__metadata)("design:type", Function),
72-
(0, tslib_1.__metadata)("design:paramtypes", [Number]),
73-
(0, tslib_1.__metadata)("design:returntype", void 0)
69+
tslib_1.__decorate([
70+
tslib_1.__param(0, dec),
71+
tslib_1.__metadata("design:type", Function),
72+
tslib_1.__metadata("design:paramtypes", [Number]),
73+
tslib_1.__metadata("design:returntype", void 0)
7474
], C.prototype, "method", null);
75-
C = (0, tslib_1.__decorate)([
75+
C = tslib_1.__decorate([
7676
dec
7777
], C);
7878
return C;
7979
}());
8080
var o = { a: 1 };
81-
var y = (0, tslib_1.__assign)({}, o);
82-
var x = (0, tslib_1.__rest)(y, []);
81+
var y = tslib_1.__assign({}, o);
82+
var x = tslib_1.__rest(y, []);
8383
//// [script.js]
8484
var __extends = (this && this.__extends) || (function () {
8585
var extendStatics = function (d, b) {

0 commit comments

Comments
 (0)