diff --git a/crates/swc/tests/tsc-references/1.0lib-noErrors_es2015.1.normal.js b/crates/swc/tests/tsc-references/1.0lib-noErrors_es2015.1.normal.js new file mode 100644 index 000000000000..b35a03adb234 --- /dev/null +++ b/crates/swc/tests/tsc-references/1.0lib-noErrors_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 30 | declare function eval(x: string): any; +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/1.0lib-noErrors_es2015.2.minified.js b/crates/swc/tests/tsc-references/1.0lib-noErrors_es2015.2.minified.js new file mode 100644 index 000000000000..b35a03adb234 --- /dev/null +++ b/crates/swc/tests/tsc-references/1.0lib-noErrors_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 30 | declare function eval(x: string): any; +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/1.0lib-noErrors_es5.1.normal.js b/crates/swc/tests/tsc-references/1.0lib-noErrors_es5.1.normal.js new file mode 100644 index 000000000000..b35a03adb234 --- /dev/null +++ b/crates/swc/tests/tsc-references/1.0lib-noErrors_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 30 | declare function eval(x: string): any; +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/1.0lib-noErrors_es5.2.minified.js b/crates/swc/tests/tsc-references/1.0lib-noErrors_es5.2.minified.js new file mode 100644 index 000000000000..b35a03adb234 --- /dev/null +++ b/crates/swc/tests/tsc-references/1.0lib-noErrors_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 30 | declare function eval(x: string): any; +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/AmbientModuleAndAmbientFunctionWithTheSameNameAndCommonRoot_es2015.1.normal.js b/crates/swc/tests/tsc-references/AmbientModuleAndAmbientFunctionWithTheSameNameAndCommonRoot_es2015.1.normal.js index 3b59359bd552..5f4c889431a1 100644 --- a/crates/swc/tests/tsc-references/AmbientModuleAndAmbientFunctionWithTheSameNameAndCommonRoot_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/AmbientModuleAndAmbientFunctionWithTheSameNameAndCommonRoot_es2015.1.normal.js @@ -1,4 +1,5 @@ // @filename: module.d.ts +// @filename: function.d.ts // @filename: test.ts var cl; var cl = Point(); diff --git a/crates/swc/tests/tsc-references/AmbientModuleAndAmbientFunctionWithTheSameNameAndCommonRoot_es5.1.normal.js b/crates/swc/tests/tsc-references/AmbientModuleAndAmbientFunctionWithTheSameNameAndCommonRoot_es5.1.normal.js index 3b59359bd552..5f4c889431a1 100644 --- a/crates/swc/tests/tsc-references/AmbientModuleAndAmbientFunctionWithTheSameNameAndCommonRoot_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/AmbientModuleAndAmbientFunctionWithTheSameNameAndCommonRoot_es5.1.normal.js @@ -1,4 +1,5 @@ // @filename: module.d.ts +// @filename: function.d.ts // @filename: test.ts var cl; var cl = Point(); diff --git a/crates/swc/tests/tsc-references/AmbientModuleAndAmbientWithSameNameAndCommonRoot_es2015.1.normal.js b/crates/swc/tests/tsc-references/AmbientModuleAndAmbientWithSameNameAndCommonRoot_es2015.1.normal.js index 28fd4ff1ba56..871efa66ee44 100644 --- a/crates/swc/tests/tsc-references/AmbientModuleAndAmbientWithSameNameAndCommonRoot_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/AmbientModuleAndAmbientWithSameNameAndCommonRoot_es2015.1.normal.js @@ -1,4 +1,5 @@ // @filename: module.d.ts +// @filename: class.d.ts // @filename: test.ts var p; var p = A.Point.Origin; diff --git a/crates/swc/tests/tsc-references/AmbientModuleAndAmbientWithSameNameAndCommonRoot_es5.1.normal.js b/crates/swc/tests/tsc-references/AmbientModuleAndAmbientWithSameNameAndCommonRoot_es5.1.normal.js index 28fd4ff1ba56..871efa66ee44 100644 --- a/crates/swc/tests/tsc-references/AmbientModuleAndAmbientWithSameNameAndCommonRoot_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/AmbientModuleAndAmbientWithSameNameAndCommonRoot_es5.1.normal.js @@ -1,4 +1,5 @@ // @filename: module.d.ts +// @filename: class.d.ts // @filename: test.ts var p; var p = A.Point.Origin; diff --git a/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot_es2015.2.minified.js b/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot_es2015.2.minified.js index 5b4b2039e46d..b5c73a80c7dd 100644 --- a/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot_es2015.2.minified.js @@ -3,4 +3,5 @@ var A; constructor(x, y){ this.x = x, this.y = y; } -}, A.Point.Origin, new A.Point(0, 0); +}; +A.Point.Origin, new A.Point(0, 0); diff --git a/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot_es5.1.normal.js b/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot_es5.1.normal.js index 0dd8024b3cd4..811c9ea497e5 100644 --- a/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot_es5.1.normal.js @@ -1,6 +1,6 @@ // @filename: module.d.ts -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; // @filename: classPoint.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var A; (function(A) { var Point = function Point(x, y) { diff --git a/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot_es5.2.minified.js b/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot_es5.2.minified.js index a95955f43181..d937babdd6cf 100644 --- a/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot_es5.2.minified.js @@ -6,4 +6,5 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; _class_call_check(this, Point), this.x = x, this.y = y; }; A.Point = Point; -}(A || (A = {})), A.Point.Origin, new A.Point(0, 0); +}(A || (A = {})); +A.Point.Origin, new A.Point(0, 0); diff --git a/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientFunctionWithTheSameNameAndCommonRoot_es2015.2.minified.js b/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientFunctionWithTheSameNameAndCommonRoot_es2015.2.minified.js new file mode 100644 index 000000000000..3348fd6966f3 --- /dev/null +++ b/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientFunctionWithTheSameNameAndCommonRoot_es2015.2.minified.js @@ -0,0 +1 @@ +Point(), Point.Origin; diff --git a/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientFunctionWithTheSameNameAndCommonRoot_es5.2.minified.js b/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientFunctionWithTheSameNameAndCommonRoot_es5.2.minified.js new file mode 100644 index 000000000000..3348fd6966f3 --- /dev/null +++ b/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientFunctionWithTheSameNameAndCommonRoot_es5.2.minified.js @@ -0,0 +1 @@ +Point(), Point.Origin; diff --git a/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRootES6_es2015.1.normal.js b/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRootES6_es2015.1.normal.js index c62b8c6a6004..fc2e03eb074d 100644 --- a/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRootES6_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRootES6_es2015.1.normal.js @@ -13,6 +13,8 @@ var X; Y.Point = Point; })(Y = X.Y || (X.Y = {})); })(X || (X = {})); +// @filename: module.ts +var X; (function(X) { let Y; (function(Y) { diff --git a/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRootES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRootES6_es2015.2.minified.js index 463c269edd69..5fc9ead1d887 100644 --- a/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRootES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRootES6_es2015.2.minified.js @@ -5,11 +5,14 @@ var X; this.x = x, this.y = y; } }; -}(X || (X = {})), function(X) { +}(X || (X = {})); +var X; +!function(X) { var Y; let Point; (Point = (Y = X.Y || (X.Y = {})).Point || (Y.Point = {})).Origin = new Point(0, 0); -}(X || (X = {})), new X.Y.Point(1, 1), X.Y.Point.Origin; +}(X || (X = {})); +new X.Y.Point(1, 1), X.Y.Point.Origin; class A { } (A || (A = {})).Instance = new A(), A.Instance, new A(); diff --git a/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRootES6_es5.1.normal.js b/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRootES6_es5.1.normal.js index 9765655845c6..8daa7ef0313f 100644 --- a/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRootES6_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRootES6_es5.1.normal.js @@ -14,6 +14,8 @@ var X; Y.Point = Point; })(Y = X.Y || (X.Y = {})); })(X || (X = {})); +// @filename: module.ts +var X; (function(X) { var Y; (function(Y) { @@ -28,6 +30,7 @@ var X; var cl = new X.Y.Point(1, 1); var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ? // @filename: simple.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var A = function A() { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRootES6_es5.2.minified.js b/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRootES6_es5.2.minified.js index bc42c3488e11..6a6aec7e23a9 100644 --- a/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRootES6_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRootES6_es5.2.minified.js @@ -1,3 +1,4 @@ +var X; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; !function(X) { var Y, Point; @@ -5,11 +6,15 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; "use strict"; _class_call_check(this, Point), this.x = x, this.y = y; }, Y.Point = Point; -}(X || (X = {})), function(X) { +}(X || (X = {})); +var X; +!function(X) { var Y, Point; (Point = (Y = X.Y || (X.Y = {})).Point || (Y.Point = {})).Origin = new Point(0, 0); -}(X || (X = {})), new X.Y.Point(1, 1), X.Y.Point.Origin; -var X, A = function() { +}(X || (X = {})); +new X.Y.Point(1, 1), X.Y.Point.Origin; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +var A = function() { "use strict"; _class_call_check(this, A); }; diff --git a/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRoot_es2015.1.normal.js b/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRoot_es2015.1.normal.js index 657e8128a5b5..98fb8f61bc08 100644 --- a/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRoot_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRoot_es2015.1.normal.js @@ -12,6 +12,8 @@ var X; Y.Point = Point; })(Y = X.Y || (X.Y = {})); })(X || (X = {})); +// @filename: module.ts +var X; (function(X) { let Y; (function(Y) { diff --git a/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRoot_es2015.2.minified.js b/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRoot_es2015.2.minified.js index 463c269edd69..5fc9ead1d887 100644 --- a/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRoot_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRoot_es2015.2.minified.js @@ -5,11 +5,14 @@ var X; this.x = x, this.y = y; } }; -}(X || (X = {})), function(X) { +}(X || (X = {})); +var X; +!function(X) { var Y; let Point; (Point = (Y = X.Y || (X.Y = {})).Point || (Y.Point = {})).Origin = new Point(0, 0); -}(X || (X = {})), new X.Y.Point(1, 1), X.Y.Point.Origin; +}(X || (X = {})); +new X.Y.Point(1, 1), X.Y.Point.Origin; class A { } (A || (A = {})).Instance = new A(), A.Instance, new A(); diff --git a/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRoot_es5.1.normal.js b/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRoot_es5.1.normal.js index 47d1359fd974..3d16423522ef 100644 --- a/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRoot_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRoot_es5.1.normal.js @@ -13,6 +13,8 @@ var X; Y.Point = Point; })(Y = X.Y || (X.Y = {})); })(X || (X = {})); +// @filename: module.ts +var X; (function(X) { var Y; (function(Y) { @@ -27,6 +29,7 @@ var X; var cl = new X.Y.Point(1, 1); var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ? // @filename: simple.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var A = function A() { "use strict"; _class_call_check(this, A); diff --git a/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRoot_es5.2.minified.js b/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRoot_es5.2.minified.js index bc42c3488e11..6a6aec7e23a9 100644 --- a/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRoot_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRoot_es5.2.minified.js @@ -1,3 +1,4 @@ +var X; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; !function(X) { var Y, Point; @@ -5,11 +6,15 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; "use strict"; _class_call_check(this, Point), this.x = x, this.y = y; }, Y.Point = Point; -}(X || (X = {})), function(X) { +}(X || (X = {})); +var X; +!function(X) { var Y, Point; (Point = (Y = X.Y || (X.Y = {})).Point || (Y.Point = {})).Origin = new Point(0, 0); -}(X || (X = {})), new X.Y.Point(1, 1), X.Y.Point.Origin; -var X, A = function() { +}(X || (X = {})); +new X.Y.Point(1, 1), X.Y.Point.Origin; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +var A = function() { "use strict"; _class_call_check(this, A); }; diff --git a/crates/swc/tests/tsc-references/ES5For-of12_es2015.1.normal.js b/crates/swc/tests/tsc-references/ES5For-of12_es2015.1.normal.js new file mode 100644 index 000000000000..2cea13879414 --- /dev/null +++ b/crates/swc/tests/tsc-references/ES5For-of12_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x Cannot assign to this +//! ,---- +//! 1 | for ([""] of [[""]]) { } +//! : ^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/ES5For-of12_es2015.2.minified.js b/crates/swc/tests/tsc-references/ES5For-of12_es2015.2.minified.js new file mode 100644 index 000000000000..2cea13879414 --- /dev/null +++ b/crates/swc/tests/tsc-references/ES5For-of12_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x Cannot assign to this +//! ,---- +//! 1 | for ([""] of [[""]]) { } +//! : ^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/ES5For-of12_es5.1.normal.js b/crates/swc/tests/tsc-references/ES5For-of12_es5.1.normal.js new file mode 100644 index 000000000000..2cea13879414 --- /dev/null +++ b/crates/swc/tests/tsc-references/ES5For-of12_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x Cannot assign to this +//! ,---- +//! 1 | for ([""] of [[""]]) { } +//! : ^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/ES5For-of12_es5.2.minified.js b/crates/swc/tests/tsc-references/ES5For-of12_es5.2.minified.js new file mode 100644 index 000000000000..2cea13879414 --- /dev/null +++ b/crates/swc/tests/tsc-references/ES5For-of12_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x Cannot assign to this +//! ,---- +//! 1 | for ([""] of [[""]]) { } +//! : ^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndCommonRoot_es2015.1.normal.js b/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndCommonRoot_es2015.1.normal.js index 3e0c84470c25..5cecce563788 100644 --- a/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndCommonRoot_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndCommonRoot_es2015.1.normal.js @@ -9,6 +9,8 @@ var A; } A.Point = Point; })(A || (A = {})); +// @filename: module.ts +var A; (function(A) { let Point; (function(Point) { diff --git a/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndCommonRoot_es2015.2.minified.js b/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndCommonRoot_es2015.2.minified.js index c3627e4a6572..76a72886debb 100644 --- a/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndCommonRoot_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndCommonRoot_es2015.2.minified.js @@ -1,15 +1,20 @@ -var A, B; +var A; (A || (A = {})).Point = function() { return { x: 0, y: 0 }; -}, function(A) { +}; +var A; +!function(A) { (A.Point || (A.Point = {})).Origin = { x: 0, y: 0 }; -}(A || (A = {})), A.Point, A.Point(), A.Point.Origin, function(B) { +}(A || (A = {})); +A.Point, A.Point(), A.Point.Origin; +var B; +!function(B) { function Point() { return { x: 0, diff --git a/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndCommonRoot_es5.1.normal.js b/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndCommonRoot_es5.1.normal.js index 8f68c5b296c4..f3a33bc06ead 100644 --- a/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndCommonRoot_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndCommonRoot_es5.1.normal.js @@ -9,6 +9,8 @@ var A; }; A.Point = Point; })(A || (A = {})); +// @filename: module.ts +var A; (function(A) { var Point; (function(Point) { diff --git a/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndCommonRoot_es5.2.minified.js b/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndCommonRoot_es5.2.minified.js index 02e7a03956a3..1c58b5fba966 100644 --- a/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndCommonRoot_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndCommonRoot_es5.2.minified.js @@ -1,4 +1,4 @@ -var A, B; +var A; !function(A) { var Point = function() { return { @@ -7,12 +7,17 @@ var A, B; }; }; A.Point = Point; -}(A || (A = {})), function(A) { +}(A || (A = {})); +var A; +!function(A) { (A.Point || (A.Point = {})).Origin = { x: 0, y: 0 }; -}(A || (A = {})), A.Point, A.Point(), A.Point.Origin, function(B) { +}(A || (A = {})); +A.Point, A.Point(), A.Point.Origin; +var B; +!function(B) { var Point = function() { return { x: 0, diff --git a/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndDifferentCommonRoot_es2015.2.minified.js b/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndDifferentCommonRoot_es2015.2.minified.js index 950f570ba007..52fb5269d747 100644 --- a/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndDifferentCommonRoot_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndDifferentCommonRoot_es2015.2.minified.js @@ -1,12 +1,15 @@ -var A, B; +var A; (A || (A = {})).Point = function() { return { x: 0, y: 0 }; -}, function(B) { +}; +var B; +!function(B) { (B.Point || (B.Point = {})).Origin = { x: 0, y: 0 }; -}(B || (B = {})), A.Point, B.Point.Origin; +}(B || (B = {})); +A.Point, B.Point.Origin; diff --git a/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndDifferentCommonRoot_es5.2.minified.js b/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndDifferentCommonRoot_es5.2.minified.js index 1dc7205191e5..111a89529991 100644 --- a/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndDifferentCommonRoot_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndDifferentCommonRoot_es5.2.minified.js @@ -1,4 +1,4 @@ -var A, B; +var A; !function(A) { var Point = function() { return { @@ -7,9 +7,12 @@ var A, B; }; }; A.Point = Point; -}(A || (A = {})), function(B) { +}(A || (A = {})); +var B; +!function(B) { (B.Point || (B.Point = {})).Origin = { x: 0, y: 0 }; -}(B || (B = {})), A.Point, B.Point.Origin; +}(B || (B = {})); +A.Point, B.Point.Origin; diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration11_es6_es2015.1.normal.js b/crates/swc/tests/tsc-references/FunctionDeclaration11_es6_es2015.1.normal.js new file mode 100644 index 000000000000..7d8a6c759b08 --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration11_es6_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | function * yield() { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration11_es6_es2015.2.minified.js b/crates/swc/tests/tsc-references/FunctionDeclaration11_es6_es2015.2.minified.js new file mode 100644 index 000000000000..7d8a6c759b08 --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration11_es6_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | function * yield() { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration11_es6_es5.1.normal.js b/crates/swc/tests/tsc-references/FunctionDeclaration11_es6_es5.1.normal.js new file mode 100644 index 000000000000..7d8a6c759b08 --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration11_es6_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | function * yield() { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration11_es6_es5.2.minified.js b/crates/swc/tests/tsc-references/FunctionDeclaration11_es6_es5.2.minified.js new file mode 100644 index 000000000000..7d8a6c759b08 --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration11_es6_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | function * yield() { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration2_es6_es2015.1.normal.js b/crates/swc/tests/tsc-references/FunctionDeclaration2_es6_es2015.1.normal.js new file mode 100644 index 000000000000..16e342af2c5e --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration2_es6_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | function f(yield) { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration2_es6_es2015.2.minified.js b/crates/swc/tests/tsc-references/FunctionDeclaration2_es6_es2015.2.minified.js new file mode 100644 index 000000000000..16e342af2c5e --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration2_es6_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | function f(yield) { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration2_es6_es5.1.normal.js b/crates/swc/tests/tsc-references/FunctionDeclaration2_es6_es5.1.normal.js new file mode 100644 index 000000000000..16e342af2c5e --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration2_es6_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | function f(yield) { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration2_es6_es5.2.minified.js b/crates/swc/tests/tsc-references/FunctionDeclaration2_es6_es5.2.minified.js new file mode 100644 index 000000000000..16e342af2c5e --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration2_es6_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | function f(yield) { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration3_es6_es2015.1.normal.js b/crates/swc/tests/tsc-references/FunctionDeclaration3_es6_es2015.1.normal.js new file mode 100644 index 000000000000..4696531c40fb --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration3_es6_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | function f(yield = yield) { +//! : ^^^^^ +//! `---- +//! +//! x Unexpected token `yield`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, +//! | ` for template literal, (, or an identifier +//! ,---- +//! 2 | function f(yield = yield) { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration3_es6_es2015.2.minified.js b/crates/swc/tests/tsc-references/FunctionDeclaration3_es6_es2015.2.minified.js new file mode 100644 index 000000000000..4696531c40fb --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration3_es6_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | function f(yield = yield) { +//! : ^^^^^ +//! `---- +//! +//! x Unexpected token `yield`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, +//! | ` for template literal, (, or an identifier +//! ,---- +//! 2 | function f(yield = yield) { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration3_es6_es5.1.normal.js b/crates/swc/tests/tsc-references/FunctionDeclaration3_es6_es5.1.normal.js new file mode 100644 index 000000000000..4696531c40fb --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration3_es6_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | function f(yield = yield) { +//! : ^^^^^ +//! `---- +//! +//! x Unexpected token `yield`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, +//! | ` for template literal, (, or an identifier +//! ,---- +//! 2 | function f(yield = yield) { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration3_es6_es5.2.minified.js b/crates/swc/tests/tsc-references/FunctionDeclaration3_es6_es5.2.minified.js new file mode 100644 index 000000000000..4696531c40fb --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration3_es6_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | function f(yield = yield) { +//! : ^^^^^ +//! `---- +//! +//! x Unexpected token `yield`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, +//! | ` for template literal, (, or an identifier +//! ,---- +//! 2 | function f(yield = yield) { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration4_es6_es2015.1.normal.js b/crates/swc/tests/tsc-references/FunctionDeclaration4_es6_es2015.1.normal.js new file mode 100644 index 000000000000..e00fae2ceaa0 --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration4_es6_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | function yield() { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration4_es6_es2015.2.minified.js b/crates/swc/tests/tsc-references/FunctionDeclaration4_es6_es2015.2.minified.js new file mode 100644 index 000000000000..e00fae2ceaa0 --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration4_es6_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | function yield() { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration4_es6_es5.1.normal.js b/crates/swc/tests/tsc-references/FunctionDeclaration4_es6_es5.1.normal.js new file mode 100644 index 000000000000..e00fae2ceaa0 --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration4_es6_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | function yield() { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration4_es6_es5.2.minified.js b/crates/swc/tests/tsc-references/FunctionDeclaration4_es6_es5.2.minified.js new file mode 100644 index 000000000000..e00fae2ceaa0 --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration4_es6_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | function yield() { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration6_es6_es2015.1.normal.js b/crates/swc/tests/tsc-references/FunctionDeclaration6_es6_es2015.1.normal.js new file mode 100644 index 000000000000..d1513e749d2d --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration6_es6_es2015.1.normal.js @@ -0,0 +1,11 @@ +//! +//! x 'yield' cannot be used as a parameter within generator +//! ,---- +//! 2 | function*foo(a = yield) { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration6_es6_es2015.2.minified.js b/crates/swc/tests/tsc-references/FunctionDeclaration6_es6_es2015.2.minified.js new file mode 100644 index 000000000000..d1513e749d2d --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration6_es6_es2015.2.minified.js @@ -0,0 +1,11 @@ +//! +//! x 'yield' cannot be used as a parameter within generator +//! ,---- +//! 2 | function*foo(a = yield) { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration6_es6_es5.1.normal.js b/crates/swc/tests/tsc-references/FunctionDeclaration6_es6_es5.1.normal.js new file mode 100644 index 000000000000..d1513e749d2d --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration6_es6_es5.1.normal.js @@ -0,0 +1,11 @@ +//! +//! x 'yield' cannot be used as a parameter within generator +//! ,---- +//! 2 | function*foo(a = yield) { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration6_es6_es5.2.minified.js b/crates/swc/tests/tsc-references/FunctionDeclaration6_es6_es5.2.minified.js new file mode 100644 index 000000000000..d1513e749d2d --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration6_es6_es5.2.minified.js @@ -0,0 +1,11 @@ +//! +//! x 'yield' cannot be used as a parameter within generator +//! ,---- +//! 2 | function*foo(a = yield) { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration7_es6_es2015.1.normal.js b/crates/swc/tests/tsc-references/FunctionDeclaration7_es6_es2015.1.normal.js new file mode 100644 index 000000000000..14ed4f8c4612 --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration7_es6_es2015.1.normal.js @@ -0,0 +1,11 @@ +//! +//! x 'yield' cannot be used as a parameter within generator +//! ,---- +//! 4 | function*foo(a = yield) { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration7_es6_es2015.2.minified.js b/crates/swc/tests/tsc-references/FunctionDeclaration7_es6_es2015.2.minified.js new file mode 100644 index 000000000000..14ed4f8c4612 --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration7_es6_es2015.2.minified.js @@ -0,0 +1,11 @@ +//! +//! x 'yield' cannot be used as a parameter within generator +//! ,---- +//! 4 | function*foo(a = yield) { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration7_es6_es5.1.normal.js b/crates/swc/tests/tsc-references/FunctionDeclaration7_es6_es5.1.normal.js new file mode 100644 index 000000000000..14ed4f8c4612 --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration7_es6_es5.1.normal.js @@ -0,0 +1,11 @@ +//! +//! x 'yield' cannot be used as a parameter within generator +//! ,---- +//! 4 | function*foo(a = yield) { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration7_es6_es5.2.minified.js b/crates/swc/tests/tsc-references/FunctionDeclaration7_es6_es5.2.minified.js new file mode 100644 index 000000000000..14ed4f8c4612 --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration7_es6_es5.2.minified.js @@ -0,0 +1,11 @@ +//! +//! x 'yield' cannot be used as a parameter within generator +//! ,---- +//! 4 | function*foo(a = yield) { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration8_es6_es2015.1.normal.js b/crates/swc/tests/tsc-references/FunctionDeclaration8_es6_es2015.1.normal.js new file mode 100644 index 000000000000..58981556479b --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration8_es6_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x Unexpected token `yield`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, +//! | ` for template literal, (, or an identifier +//! ,---- +//! 1 | var v = { [yield]: foo } +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration8_es6_es2015.2.minified.js b/crates/swc/tests/tsc-references/FunctionDeclaration8_es6_es2015.2.minified.js new file mode 100644 index 000000000000..58981556479b --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration8_es6_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x Unexpected token `yield`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, +//! | ` for template literal, (, or an identifier +//! ,---- +//! 1 | var v = { [yield]: foo } +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration8_es6_es5.1.normal.js b/crates/swc/tests/tsc-references/FunctionDeclaration8_es6_es5.1.normal.js new file mode 100644 index 000000000000..58981556479b --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration8_es6_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x Unexpected token `yield`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, +//! | ` for template literal, (, or an identifier +//! ,---- +//! 1 | var v = { [yield]: foo } +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/FunctionDeclaration8_es6_es5.2.minified.js b/crates/swc/tests/tsc-references/FunctionDeclaration8_es6_es5.2.minified.js new file mode 100644 index 000000000000..58981556479b --- /dev/null +++ b/crates/swc/tests/tsc-references/FunctionDeclaration8_es6_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x Unexpected token `yield`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, +//! | ` for template literal, (, or an identifier +//! ,---- +//! 1 | var v = { [yield]: foo } +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/ModuleAndClassWithSameNameAndCommonRoot_es2015.1.normal.js b/crates/swc/tests/tsc-references/ModuleAndClassWithSameNameAndCommonRoot_es2015.1.normal.js index 26a506dd9616..fd332e353d51 100644 --- a/crates/swc/tests/tsc-references/ModuleAndClassWithSameNameAndCommonRoot_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/ModuleAndClassWithSameNameAndCommonRoot_es2015.1.normal.js @@ -9,6 +9,8 @@ var X; })(Point = Y.Point || (Y.Point = {})); })(Y = X.Y || (X.Y = {})); })(X || (X = {})); +// @Filename: classPoint.ts +var X; (function(X) { let Y; (function(Y) { @@ -21,6 +23,7 @@ var X; Y.Point = Point; })(Y = X.Y || (X.Y = {})); })(X || (X = {})); +// @Filename: simple.ts (function(A1) { var Instance = A1.Instance = new A(); })(A || (A = {})); diff --git a/crates/swc/tests/tsc-references/ModuleAndClassWithSameNameAndCommonRoot_es2015.2.minified.js b/crates/swc/tests/tsc-references/ModuleAndClassWithSameNameAndCommonRoot_es2015.2.minified.js index 5d624b22af8f..95e37a6c52d7 100644 --- a/crates/swc/tests/tsc-references/ModuleAndClassWithSameNameAndCommonRoot_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/ModuleAndClassWithSameNameAndCommonRoot_es2015.2.minified.js @@ -3,12 +3,15 @@ var X; var Y; let Point; (Point = (Y = X.Y || (X.Y = {})).Point || (Y.Point = {})).Origin = new Point(0, 0); -}(X || (X = {})), function(X) { +}(X || (X = {})); +var X; +!function(X) { (X.Y || (X.Y = {})).Point = class { constructor(x, y){ this.x = x, this.y = y; } }; -}(X || (X = {})), (A || (A = {})).Instance = new A(); +}(X || (X = {})); +(A || (A = {})).Instance = new A(); class A { } diff --git a/crates/swc/tests/tsc-references/ModuleAndClassWithSameNameAndCommonRoot_es5.1.normal.js b/crates/swc/tests/tsc-references/ModuleAndClassWithSameNameAndCommonRoot_es5.1.normal.js index 7dfd5f421b55..28e58e9cc046 100644 --- a/crates/swc/tests/tsc-references/ModuleAndClassWithSameNameAndCommonRoot_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/ModuleAndClassWithSameNameAndCommonRoot_es5.1.normal.js @@ -1,5 +1,4 @@ // @Filename: module.ts -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var X; (function(X) { var Y; @@ -10,6 +9,9 @@ var X; })(Point = Y.Point || (Y.Point = {})); })(Y = X.Y || (X.Y = {})); })(X || (X = {})); +// @Filename: classPoint.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +var X; (function(X) { var Y; (function(Y) { @@ -22,6 +24,8 @@ var X; Y.Point = Point; })(Y = X.Y || (X.Y = {})); })(X || (X = {})); +// @Filename: simple.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; (function(A1) { var Instance = A1.Instance = new A(); })(A || (A = {})); diff --git a/crates/swc/tests/tsc-references/ModuleAndClassWithSameNameAndCommonRoot_es5.2.minified.js b/crates/swc/tests/tsc-references/ModuleAndClassWithSameNameAndCommonRoot_es5.2.minified.js index dd9e61c0be90..83e3d59f4523 100644 --- a/crates/swc/tests/tsc-references/ModuleAndClassWithSameNameAndCommonRoot_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/ModuleAndClassWithSameNameAndCommonRoot_es5.2.minified.js @@ -1,15 +1,20 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +var X; !function(X) { var Y, Point; (Point = (Y = X.Y || (X.Y = {})).Point || (Y.Point = {})).Origin = new Point(0, 0); -}(X || (X = {})), function(X) { +}(X || (X = {})); +var X; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +!function(X) { var Y, Point; Y = X.Y || (X.Y = {}), Point = function(x, y) { "use strict"; _class_call_check(this, Point), this.x = x, this.y = y; }, Y.Point = Point; -}(X || (X = {})), (A || (A = {})).Instance = new A(); -var X, A = function A() { +}(X || (X = {})); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +(A || (A = {})).Instance = new A(); +var A = function A() { "use strict"; _class_call_check(this, A); }; diff --git a/crates/swc/tests/tsc-references/ModuleAndFunctionWithSameNameAndCommonRoot_es2015.1.normal.js b/crates/swc/tests/tsc-references/ModuleAndFunctionWithSameNameAndCommonRoot_es2015.1.normal.js index 7d3f7c188423..352f5d211c47 100644 --- a/crates/swc/tests/tsc-references/ModuleAndFunctionWithSameNameAndCommonRoot_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/ModuleAndFunctionWithSameNameAndCommonRoot_es2015.1.normal.js @@ -9,6 +9,8 @@ var A; }; })(Point = A.Point || (A.Point = {})); })(A || (A = {})); +// @filename: function.ts +var A; (function(A) { function Point() { return { diff --git a/crates/swc/tests/tsc-references/ModuleAndFunctionWithSameNameAndCommonRoot_es2015.2.minified.js b/crates/swc/tests/tsc-references/ModuleAndFunctionWithSameNameAndCommonRoot_es2015.2.minified.js index 6728ee4a93af..3d14f48e1b3d 100644 --- a/crates/swc/tests/tsc-references/ModuleAndFunctionWithSameNameAndCommonRoot_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/ModuleAndFunctionWithSameNameAndCommonRoot_es2015.2.minified.js @@ -1,15 +1,19 @@ -var A, B; +var A; !function(A) { (A.Point || (A.Point = {})).Origin = { x: 0, y: 0 }; -}(A || (A = {})), (A || (A = {})).Point = function() { +}(A || (A = {})); +var A; +(A || (A = {})).Point = function() { return { x: 0, y: 0 }; -}, function(B) { +}; +var B; +!function(B) { function Point() { return { x: 0, diff --git a/crates/swc/tests/tsc-references/ModuleAndFunctionWithSameNameAndCommonRoot_es5.1.normal.js b/crates/swc/tests/tsc-references/ModuleAndFunctionWithSameNameAndCommonRoot_es5.1.normal.js index 64dfa64d8a2d..6ca2ec4d02b3 100644 --- a/crates/swc/tests/tsc-references/ModuleAndFunctionWithSameNameAndCommonRoot_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/ModuleAndFunctionWithSameNameAndCommonRoot_es5.1.normal.js @@ -9,6 +9,8 @@ var A; }; })(Point = A.Point || (A.Point = {})); })(A || (A = {})); +// @filename: function.ts +var A; (function(A) { var Point = function Point() { return { diff --git a/crates/swc/tests/tsc-references/ModuleAndFunctionWithSameNameAndCommonRoot_es5.2.minified.js b/crates/swc/tests/tsc-references/ModuleAndFunctionWithSameNameAndCommonRoot_es5.2.minified.js index deb2c8a4a288..5da059454521 100644 --- a/crates/swc/tests/tsc-references/ModuleAndFunctionWithSameNameAndCommonRoot_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/ModuleAndFunctionWithSameNameAndCommonRoot_es5.2.minified.js @@ -1,10 +1,12 @@ -var A, B; +var A; !function(A) { (A.Point || (A.Point = {})).Origin = { x: 0, y: 0 }; -}(A || (A = {})), function(A) { +}(A || (A = {})); +var A; +!function(A) { var Point = function() { return { x: 0, @@ -12,7 +14,9 @@ var A, B; }; }; A.Point = Point; -}(A || (A = {})), function(B) { +}(A || (A = {})); +var B; +!function(B) { var Point = function() { return { x: 0, diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName_es2015.1.normal.js b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName_es2015.1.normal.js index 114353aebaf0..e77497337dc6 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName_es2015.1.normal.js @@ -16,6 +16,8 @@ var A; y: 0 }; })(A || (A = {})); +//@filename: part2.ts +var A; (function(A) { // not a collision, since we don't export var Origin = "0,0"; diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName_es2015.2.minified.js b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName_es2015.2.minified.js index f2297e595181..c8da269b634f 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName_es2015.2.minified.js @@ -1,3 +1,4 @@ +var A; !function(A) { (A.Utils || (A.Utils = {})).mirror = function(p) { return { @@ -8,14 +9,16 @@ x: 0, y: 0 }; -}(A || (A = {})), function(A) { +}(A || (A = {})); +var A; +!function(A) { (A.Utils || (A.Utils = {})).Plane = class { constructor(tl, br){ this.tl = tl, this.br = br; } }; }(A || (A = {})); -var A, o = A.Origin, o = A.Utils.mirror(o); +var o = A.Origin, o = A.Utils.mirror(o); new A.Utils.Plane(o, { x: 1, y: 1 diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName_es5.1.normal.js b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName_es5.1.normal.js index afb64b39aae4..6d652746c05c 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName_es5.1.normal.js @@ -1,5 +1,4 @@ //@filename: part1.ts -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var A; (function(A) { var Utils; @@ -17,6 +16,9 @@ var A; y: 0 }; })(A || (A = {})); +//@filename: part2.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +var A; (function(A) { // not a collision, since we don't export var Origin = "0,0"; diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName_es5.2.minified.js b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName_es5.2.minified.js index 7ad86551c864..eb25c9c7788b 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName_es5.2.minified.js @@ -1,4 +1,4 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +var A; !function(A) { (A.Utils || (A.Utils = {})).mirror = function(p) { return { @@ -9,14 +9,17 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; x: 0, y: 0 }; -}(A || (A = {})), function(A) { +}(A || (A = {})); +var A; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +!function(A) { var Utils, Plane; Utils = A.Utils || (A.Utils = {}), Plane = function(tl, br) { "use strict"; _class_call_check(this, Plane), this.tl = tl, this.br = br; }, Utils.Plane = Plane; }(A || (A = {})); -var A, o = A.Origin, o = A.Utils.mirror(o); +var o = A.Origin, o = A.Utils.mirror(o); new A.Utils.Plane(o, { x: 1, y: 1 diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName_es2015.1.normal.js b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName_es2015.1.normal.js index 8daffcaa7891..77d2cd3a4dbd 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName_es2015.1.normal.js @@ -16,6 +16,8 @@ export var A; y: 0 }; })(A || (A = {})); +//@filename: part2.ts +export var A; (function(A) { var Origin = A.Origin = { x: 0, diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName_es2015.2.minified.js b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName_es2015.2.minified.js index bde1fd90a1fe..87e6a3e5f666 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName_es2015.2.minified.js @@ -9,7 +9,9 @@ export var A; x: 0, y: 0 }; -}(A || (A = {})), function(A) { +}(A || (A = {})); +export var A; +!function(A) { A.Origin = { x: 0, y: 0 diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName_es5.1.normal.js b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName_es5.1.normal.js index 7e3c12d2d138..5dd9df9c9dba 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName_es5.1.normal.js @@ -1,5 +1,4 @@ //@filename: part1.ts -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export var A; (function(A) { var Utils; @@ -17,6 +16,9 @@ export var A; y: 0 }; })(A || (A = {})); +//@filename: part2.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +export var A; (function(A) { var Origin = A.Origin = { x: 0, diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName_es5.2.minified.js b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName_es5.2.minified.js index d3bd7bf71bf8..9c401ceb939e 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName_es5.2.minified.js @@ -1,4 +1,3 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export var A; !function(A) { (A.Utils || (A.Utils = {})).mirror = function(p) { @@ -10,7 +9,10 @@ export var A; x: 0, y: 0 }; -}(A || (A = {})), function(A) { +}(A || (A = {})); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +export var A; +!function(A) { var Utils, Plane; A.Origin = { x: 0, diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot_es2015.2.minified.js b/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot_es2015.2.minified.js index f1fdae0b4c1d..f6d200b17a17 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot_es2015.2.minified.js @@ -1,4 +1,4 @@ -var Root, otherRoot; +var Root; !function(Root) { var A; ((A = Root.A || (Root.A = {})).Utils || (A.Utils = {})).mirror = function(p) { @@ -7,7 +7,9 @@ var Root, otherRoot; y: p.x }; }; -}(Root || (Root = {})), function(otherRoot) { +}(Root || (Root = {})); +var otherRoot; +!function(otherRoot) { var A; (A = otherRoot.A || (otherRoot.A = {})).Origin = { x: 0, diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot_es5.1.normal.js b/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot_es5.1.normal.js index 83a7081b25a2..d045a5e21bd9 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot_es5.1.normal.js @@ -1,5 +1,4 @@ //@filename: part1.ts -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var Root; (function(Root) { var A; @@ -17,6 +16,7 @@ var Root; })(A = Root.A || (Root.A = {})); })(Root || (Root = {})); //@filename: part2.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var otherRoot; (function(otherRoot) { var A; diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot_es5.2.minified.js b/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot_es5.2.minified.js index e890290b00fd..3bc8e6551678 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot_es5.2.minified.js @@ -1,5 +1,4 @@ -var Root, otherRoot; -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +var Root; !function(Root) { var A; ((A = Root.A || (Root.A = {})).Utils || (A.Utils = {})).mirror = function(p) { @@ -8,7 +7,10 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; y: p.x }; }; -}(Root || (Root = {})), function(otherRoot) { +}(Root || (Root = {})); +var otherRoot; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +!function(otherRoot) { var A, Utils, Plane; (A = otherRoot.A || (otherRoot.A = {})).Origin = { x: 0, diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndSameCommonRoot_es2015.1.normal.js b/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndSameCommonRoot_es2015.1.normal.js index 10070110ad60..df0b7541c1dc 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndSameCommonRoot_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndSameCommonRoot_es2015.1.normal.js @@ -12,6 +12,8 @@ var A; Utils.mirror = mirror; })(Utils = A.Utils || (A.Utils = {})); })(A || (A = {})); +//@filename: part2.ts +var A; (function(A) { var Origin = A.Origin = { x: 0, diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndSameCommonRoot_es2015.2.minified.js b/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndSameCommonRoot_es2015.2.minified.js index 9a8b3ba35d82..f5723bb140f8 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndSameCommonRoot_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndSameCommonRoot_es2015.2.minified.js @@ -1,3 +1,4 @@ +var A; !function(A) { (A.Utils || (A.Utils = {})).mirror = function(p) { return { @@ -5,7 +6,9 @@ y: p.x }; }; -}(A || (A = {})), function(A) { +}(A || (A = {})); +var A; +!function(A) { A.Origin = { x: 0, y: 0 @@ -15,7 +18,7 @@ } }; }(A || (A = {})); -var A, o = A.Origin, o = A.Utils.mirror(o); +var o = A.Origin, o = A.Utils.mirror(o); new A.Utils.Plane(o, { x: 1, y: 1 diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndSameCommonRoot_es5.1.normal.js b/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndSameCommonRoot_es5.1.normal.js index 38dde840a38f..a4102fe64bce 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndSameCommonRoot_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndSameCommonRoot_es5.1.normal.js @@ -1,5 +1,4 @@ //@filename: part1.ts -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var A; (function(A) { var Utils; @@ -13,6 +12,9 @@ var A; Utils.mirror = mirror; })(Utils = A.Utils || (A.Utils = {})); })(A || (A = {})); +//@filename: part2.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +var A; (function(A) { var Origin = A.Origin = { x: 0, diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndSameCommonRoot_es5.2.minified.js b/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndSameCommonRoot_es5.2.minified.js index 1737d5bf3d01..a9712da4fd43 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndSameCommonRoot_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndSameCommonRoot_es5.2.minified.js @@ -1,4 +1,4 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +var A; !function(A) { (A.Utils || (A.Utils = {})).mirror = function(p) { return { @@ -6,7 +6,10 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; y: p.x }; }; -}(A || (A = {})), function(A) { +}(A || (A = {})); +var A; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +!function(A) { var Utils, Plane; A.Origin = { x: 0, @@ -16,7 +19,7 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; _class_call_check(this, Plane), this.tl = tl, this.br = br; }, Utils.Plane = Plane; }(A || (A = {})); -var A, o = A.Origin, o = A.Utils.mirror(o); +var o = A.Origin, o = A.Utils.mirror(o); new A.Utils.Plane(o, { x: 1, y: 1 diff --git a/crates/swc/tests/tsc-references/VariableDeclaration6_es6_es2015.1.normal.js b/crates/swc/tests/tsc-references/VariableDeclaration6_es6_es2015.1.normal.js new file mode 100644 index 000000000000..11610efedd80 --- /dev/null +++ b/crates/swc/tests/tsc-references/VariableDeclaration6_es6_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | let +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/VariableDeclaration6_es6_es2015.2.minified.js b/crates/swc/tests/tsc-references/VariableDeclaration6_es6_es2015.2.minified.js new file mode 100644 index 000000000000..11610efedd80 --- /dev/null +++ b/crates/swc/tests/tsc-references/VariableDeclaration6_es6_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | let +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/VariableDeclaration6_es6_es5.1.normal.js b/crates/swc/tests/tsc-references/VariableDeclaration6_es6_es5.1.normal.js new file mode 100644 index 000000000000..11610efedd80 --- /dev/null +++ b/crates/swc/tests/tsc-references/VariableDeclaration6_es6_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | let +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/VariableDeclaration6_es6_es5.2.minified.js b/crates/swc/tests/tsc-references/VariableDeclaration6_es6_es5.2.minified.js new file mode 100644 index 000000000000..11610efedd80 --- /dev/null +++ b/crates/swc/tests/tsc-references/VariableDeclaration6_es6_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | let +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/YieldExpression1_es6_es2015.1.normal.js b/crates/swc/tests/tsc-references/YieldExpression1_es6_es2015.1.normal.js new file mode 100644 index 000000000000..936b14e58f52 --- /dev/null +++ b/crates/swc/tests/tsc-references/YieldExpression1_es6_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x Unexpected token `yield`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, +//! | ` for template literal, (, or an identifier +//! ,---- +//! 2 | yield; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/YieldExpression1_es6_es2015.2.minified.js b/crates/swc/tests/tsc-references/YieldExpression1_es6_es2015.2.minified.js new file mode 100644 index 000000000000..936b14e58f52 --- /dev/null +++ b/crates/swc/tests/tsc-references/YieldExpression1_es6_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x Unexpected token `yield`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, +//! | ` for template literal, (, or an identifier +//! ,---- +//! 2 | yield; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/YieldExpression1_es6_es5.1.normal.js b/crates/swc/tests/tsc-references/YieldExpression1_es6_es5.1.normal.js new file mode 100644 index 000000000000..936b14e58f52 --- /dev/null +++ b/crates/swc/tests/tsc-references/YieldExpression1_es6_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x Unexpected token `yield`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, +//! | ` for template literal, (, or an identifier +//! ,---- +//! 2 | yield; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/YieldExpression1_es6_es5.2.minified.js b/crates/swc/tests/tsc-references/YieldExpression1_es6_es5.2.minified.js new file mode 100644 index 000000000000..936b14e58f52 --- /dev/null +++ b/crates/swc/tests/tsc-references/YieldExpression1_es6_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x Unexpected token `yield`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, +//! | ` for template literal, (, or an identifier +//! ,---- +//! 2 | yield; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/YieldExpression8_es6_es2015.1.normal.js b/crates/swc/tests/tsc-references/YieldExpression8_es6_es2015.1.normal.js new file mode 100644 index 000000000000..9689568d93c1 --- /dev/null +++ b/crates/swc/tests/tsc-references/YieldExpression8_es6_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x Unexpected token `yield`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, +//! | ` for template literal, (, or an identifier +//! ,---- +//! 2 | yield(foo); +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/YieldExpression8_es6_es2015.2.minified.js b/crates/swc/tests/tsc-references/YieldExpression8_es6_es2015.2.minified.js new file mode 100644 index 000000000000..9689568d93c1 --- /dev/null +++ b/crates/swc/tests/tsc-references/YieldExpression8_es6_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x Unexpected token `yield`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, +//! | ` for template literal, (, or an identifier +//! ,---- +//! 2 | yield(foo); +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/YieldExpression8_es6_es5.1.normal.js b/crates/swc/tests/tsc-references/YieldExpression8_es6_es5.1.normal.js new file mode 100644 index 000000000000..9689568d93c1 --- /dev/null +++ b/crates/swc/tests/tsc-references/YieldExpression8_es6_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x Unexpected token `yield`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, +//! | ` for template literal, (, or an identifier +//! ,---- +//! 2 | yield(foo); +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/YieldExpression8_es6_es5.2.minified.js b/crates/swc/tests/tsc-references/YieldExpression8_es6_es5.2.minified.js new file mode 100644 index 000000000000..9689568d93c1 --- /dev/null +++ b/crates/swc/tests/tsc-references/YieldExpression8_es6_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x Unexpected token `yield`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, +//! | ` for template literal, (, or an identifier +//! ,---- +//! 2 | yield(foo); +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/YieldStarExpression1_es6_es2015.1.normal.js b/crates/swc/tests/tsc-references/YieldStarExpression1_es6_es2015.1.normal.js new file mode 100644 index 000000000000..1c2584bdd6e3 --- /dev/null +++ b/crates/swc/tests/tsc-references/YieldStarExpression1_es6_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x Unexpected token `yield`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, +//! | ` for template literal, (, or an identifier +//! ,---- +//! 2 | yield * []; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/YieldStarExpression1_es6_es2015.2.minified.js b/crates/swc/tests/tsc-references/YieldStarExpression1_es6_es2015.2.minified.js new file mode 100644 index 000000000000..1c2584bdd6e3 --- /dev/null +++ b/crates/swc/tests/tsc-references/YieldStarExpression1_es6_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x Unexpected token `yield`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, +//! | ` for template literal, (, or an identifier +//! ,---- +//! 2 | yield * []; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/YieldStarExpression1_es6_es5.1.normal.js b/crates/swc/tests/tsc-references/YieldStarExpression1_es6_es5.1.normal.js new file mode 100644 index 000000000000..1c2584bdd6e3 --- /dev/null +++ b/crates/swc/tests/tsc-references/YieldStarExpression1_es6_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x Unexpected token `yield`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, +//! | ` for template literal, (, or an identifier +//! ,---- +//! 2 | yield * []; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/YieldStarExpression1_es6_es5.2.minified.js b/crates/swc/tests/tsc-references/YieldStarExpression1_es6_es5.2.minified.js new file mode 100644 index 000000000000..1c2584bdd6e3 --- /dev/null +++ b/crates/swc/tests/tsc-references/YieldStarExpression1_es6_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x Unexpected token `yield`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, +//! | ` for template literal, (, or an identifier +//! ,---- +//! 2 | yield * []; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/ambientDeclarationsExternal_es2015.1.normal.js b/crates/swc/tests/tsc-references/ambientDeclarationsExternal_es2015.1.normal.js index edfc00a0dcd6..4b3e8fb9c2ab 100644 --- a/crates/swc/tests/tsc-references/ambientDeclarationsExternal_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/ambientDeclarationsExternal_es2015.1.normal.js @@ -1,6 +1,6 @@ //@Filename: decls.ts // Ambient external module with export assignment -// Ambient external import declaration referencing ambient external module using top level module name + // Ambient external import declaration referencing ambient external module using top level module name //@Filename: consumer.ts /// const imp1 = require('equ'); diff --git a/crates/swc/tests/tsc-references/ambientDeclarationsExternal_es5.1.normal.js b/crates/swc/tests/tsc-references/ambientDeclarationsExternal_es5.1.normal.js index c8073b6067ac..08b14cab6e1e 100644 --- a/crates/swc/tests/tsc-references/ambientDeclarationsExternal_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/ambientDeclarationsExternal_es5.1.normal.js @@ -1,6 +1,6 @@ //@Filename: decls.ts // Ambient external module with export assignment -// Ambient external import declaration referencing ambient external module using top level module name + // Ambient external import declaration referencing ambient external module using top level module name //@Filename: consumer.ts /// var imp1 = require("equ"); diff --git a/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging1_es2015.1.normal.js b/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging1_es2015.1.normal.js index ac4fdf729744..f674518964ac 100644 --- a/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging1_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging1_es2015.1.normal.js @@ -1,2 +1,5 @@ // @filename: types.ts +// @filename: testA.ts +export { }; +// @filename: testB.ts export { }; // Error diff --git a/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging1_es2015.2.minified.js b/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging1_es2015.2.minified.js index 2234b9cae16d..98fdd3114198 100644 --- a/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging1_es2015.2.minified.js @@ -1 +1,2 @@ export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging1_es5.1.normal.js b/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging1_es5.1.normal.js index ac4fdf729744..f674518964ac 100644 --- a/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging1_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging1_es5.1.normal.js @@ -1,2 +1,5 @@ // @filename: types.ts +// @filename: testA.ts +export { }; +// @filename: testB.ts export { }; // Error diff --git a/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging1_es5.2.minified.js b/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging1_es5.2.minified.js index 2234b9cae16d..98fdd3114198 100644 --- a/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging1_es5.2.minified.js @@ -1 +1,2 @@ export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging2_es2015.1.normal.js b/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging2_es2015.1.normal.js index 6afb85b5c8bd..cfe8aa5afe85 100644 --- a/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging2_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging2_es2015.1.normal.js @@ -1,2 +1,5 @@ // @filename: types.ts +// @filename: testA.ts +export { }; +// @filename: testB.ts export { }; diff --git a/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging2_es2015.2.minified.js b/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging2_es2015.2.minified.js index 2234b9cae16d..98fdd3114198 100644 --- a/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging2_es2015.2.minified.js @@ -1 +1,2 @@ export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging2_es5.1.normal.js b/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging2_es5.1.normal.js index 6afb85b5c8bd..cfe8aa5afe85 100644 --- a/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging2_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging2_es5.1.normal.js @@ -1,2 +1,5 @@ // @filename: types.ts +// @filename: testA.ts +export { }; +// @filename: testB.ts export { }; diff --git a/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging2_es5.2.minified.js b/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging2_es5.2.minified.js index 2234b9cae16d..98fdd3114198 100644 --- a/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging2_es5.2.minified.js @@ -1 +1,2 @@ export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging3_es2015.1.normal.js b/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging3_es2015.1.normal.js index 1fe5d12eec68..0c9f07f7aae9 100644 --- a/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging3_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging3_es2015.1.normal.js @@ -1,4 +1,5 @@ // @filename: types.ts +// @filename: test.ts ohno.a // oh no ; export { }; diff --git a/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging3_es5.1.normal.js b/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging3_es5.1.normal.js index 1fe5d12eec68..0c9f07f7aae9 100644 --- a/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging3_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/ambientDeclarationsPatterns_merging3_es5.1.normal.js @@ -1,4 +1,5 @@ // @filename: types.ts +// @filename: test.ts ohno.a // oh no ; export { }; diff --git a/crates/swc/tests/tsc-references/ambientExternalModuleMerging_es2015.1.normal.js b/crates/swc/tests/tsc-references/ambientExternalModuleMerging_es2015.1.normal.js index 6cf7c64c1092..b144fe72290d 100644 --- a/crates/swc/tests/tsc-references/ambientExternalModuleMerging_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/ambientExternalModuleMerging_es2015.1.normal.js @@ -5,3 +5,4 @@ const M = require("M"); var x = M.x; var y = M.y; export { }; +//@filename: ambientExternalModuleMerging_declare.ts diff --git a/crates/swc/tests/tsc-references/ambientExternalModuleMerging_es5.1.normal.js b/crates/swc/tests/tsc-references/ambientExternalModuleMerging_es5.1.normal.js index b22231279895..c25e7f1780e2 100644 --- a/crates/swc/tests/tsc-references/ambientExternalModuleMerging_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/ambientExternalModuleMerging_es5.1.normal.js @@ -5,3 +5,4 @@ var M = require("M"); var x = M.x; var y = M.y; export { }; +//@filename: ambientExternalModuleMerging_declare.ts diff --git a/crates/swc/tests/tsc-references/ambientShorthand_duplicate_es2015.1.normal.js b/crates/swc/tests/tsc-references/ambientShorthand_duplicate_es2015.1.normal.js index 5701931c4350..59d90638d9b1 100644 --- a/crates/swc/tests/tsc-references/ambientShorthand_duplicate_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/ambientShorthand_duplicate_es2015.1.normal.js @@ -1,2 +1,6 @@ // @Filename: declarations1.d.ts +// @Filename: declarations2.d.ts +// @Filename: user.ts +/// +/// export { }; diff --git a/crates/swc/tests/tsc-references/ambientShorthand_duplicate_es5.1.normal.js b/crates/swc/tests/tsc-references/ambientShorthand_duplicate_es5.1.normal.js index 5701931c4350..59d90638d9b1 100644 --- a/crates/swc/tests/tsc-references/ambientShorthand_duplicate_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/ambientShorthand_duplicate_es5.1.normal.js @@ -1,2 +1,6 @@ // @Filename: declarations1.d.ts +// @Filename: declarations2.d.ts +// @Filename: user.ts +/// +/// export { }; diff --git a/crates/swc/tests/tsc-references/ambientShorthand_merging_es2015.1.normal.js b/crates/swc/tests/tsc-references/ambientShorthand_merging_es2015.1.normal.js index 5701931c4350..59d90638d9b1 100644 --- a/crates/swc/tests/tsc-references/ambientShorthand_merging_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/ambientShorthand_merging_es2015.1.normal.js @@ -1,2 +1,6 @@ // @Filename: declarations1.d.ts +// @Filename: declarations2.d.ts +// @Filename: user.ts +/// +/// export { }; diff --git a/crates/swc/tests/tsc-references/ambientShorthand_merging_es5.1.normal.js b/crates/swc/tests/tsc-references/ambientShorthand_merging_es5.1.normal.js index 5701931c4350..59d90638d9b1 100644 --- a/crates/swc/tests/tsc-references/ambientShorthand_merging_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/ambientShorthand_merging_es5.1.normal.js @@ -1,2 +1,6 @@ // @Filename: declarations1.d.ts +// @Filename: declarations2.d.ts +// @Filename: user.ts +/// +/// export { }; diff --git a/crates/swc/tests/tsc-references/ambient_es2015.1.normal.js b/crates/swc/tests/tsc-references/ambient_es2015.1.normal.js index 02bdb984780f..c33d4c3108f7 100644 --- a/crates/swc/tests/tsc-references/ambient_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/ambient_es2015.1.normal.js @@ -1,3 +1,5 @@ // @Filename: /a.ts export class A { } +// @Filename: /b.ts +export { }; diff --git a/crates/swc/tests/tsc-references/ambient_es2015.2.minified.js b/crates/swc/tests/tsc-references/ambient_es2015.2.minified.js index 4a17f4af9fc7..95b1242eacaa 100644 --- a/crates/swc/tests/tsc-references/ambient_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/ambient_es2015.2.minified.js @@ -1,2 +1,3 @@ export class A { } +export { }; diff --git a/crates/swc/tests/tsc-references/ambient_es5.1.normal.js b/crates/swc/tests/tsc-references/ambient_es5.1.normal.js index 82a82efec266..6ed91f74cca7 100644 --- a/crates/swc/tests/tsc-references/ambient_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/ambient_es5.1.normal.js @@ -4,3 +4,5 @@ export var A = function A() { "use strict"; _class_call_check(this, A); }; +// @Filename: /b.ts +export { }; diff --git a/crates/swc/tests/tsc-references/ambient_es5.2.minified.js b/crates/swc/tests/tsc-references/ambient_es5.2.minified.js index eed7ca896ebd..6845732041ee 100644 --- a/crates/swc/tests/tsc-references/ambient_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/ambient_es5.2.minified.js @@ -3,3 +3,4 @@ export var A = function() { "use strict"; _class_call_check(this, A); }; +export { }; diff --git a/crates/swc/tests/tsc-references/amdImportAsPrimaryExpression_es2015.1.normal.js b/crates/swc/tests/tsc-references/amdImportAsPrimaryExpression_es2015.1.normal.js index c4dcc2ed340c..2815e2170a61 100644 --- a/crates/swc/tests/tsc-references/amdImportAsPrimaryExpression_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/amdImportAsPrimaryExpression_es2015.1.normal.js @@ -11,3 +11,4 @@ const foo = require("./foo_0"); if (foo.E1.A === 0) { // Should cause runtime import - interesting optimization possibility, as gets inlined to 0. } +export { }; diff --git a/crates/swc/tests/tsc-references/amdImportAsPrimaryExpression_es2015.2.minified.js b/crates/swc/tests/tsc-references/amdImportAsPrimaryExpression_es2015.2.minified.js index 0b028a216c82..e59890a43c98 100644 --- a/crates/swc/tests/tsc-references/amdImportAsPrimaryExpression_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/amdImportAsPrimaryExpression_es2015.2.minified.js @@ -4,3 +4,4 @@ export var E1; }(E1 || (E1 = {})); let foo = require("./foo_0"); foo.E1.A; +export { }; diff --git a/crates/swc/tests/tsc-references/amdImportAsPrimaryExpression_es5.1.normal.js b/crates/swc/tests/tsc-references/amdImportAsPrimaryExpression_es5.1.normal.js index b2645e730ccd..578263688a48 100644 --- a/crates/swc/tests/tsc-references/amdImportAsPrimaryExpression_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/amdImportAsPrimaryExpression_es5.1.normal.js @@ -11,3 +11,4 @@ var foo = require("./foo_0"); if (foo.E1.A === 0) { // Should cause runtime import - interesting optimization possibility, as gets inlined to 0. } +export { }; diff --git a/crates/swc/tests/tsc-references/amdImportAsPrimaryExpression_es5.2.minified.js b/crates/swc/tests/tsc-references/amdImportAsPrimaryExpression_es5.2.minified.js index c86836c0ad95..4b4ffe32998f 100644 --- a/crates/swc/tests/tsc-references/amdImportAsPrimaryExpression_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/amdImportAsPrimaryExpression_es5.2.minified.js @@ -1,4 +1,6 @@ export var E1; !function(E1) { E1[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C"; -}(E1 || (E1 = {})), require("./foo_0").E1.A; +}(E1 || (E1 = {})); +require("./foo_0").E1.A; +export { }; diff --git a/crates/swc/tests/tsc-references/amdImportNotAsPrimaryExpression_es2015.1.normal.js b/crates/swc/tests/tsc-references/amdImportNotAsPrimaryExpression_es2015.1.normal.js index be75dee606be..cc8508d78afd 100644 --- a/crates/swc/tests/tsc-references/amdImportNotAsPrimaryExpression_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/amdImportNotAsPrimaryExpression_es2015.1.normal.js @@ -19,3 +19,4 @@ var x = {}; var y = false; var z; var e = 0; +export { }; diff --git a/crates/swc/tests/tsc-references/amdImportNotAsPrimaryExpression_es2015.2.minified.js b/crates/swc/tests/tsc-references/amdImportNotAsPrimaryExpression_es2015.2.minified.js index eaf1c391d878..f1ccbfd75263 100644 --- a/crates/swc/tests/tsc-references/amdImportNotAsPrimaryExpression_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/amdImportNotAsPrimaryExpression_es2015.2.minified.js @@ -7,4 +7,6 @@ C1.s1 = !0; export var E1; !function(E1) { E1[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C"; -}(E1 || (E1 = {})), require("./foo_0"); +}(E1 || (E1 = {})); +require("./foo_0"); +export { }; diff --git a/crates/swc/tests/tsc-references/amdImportNotAsPrimaryExpression_es5.1.normal.js b/crates/swc/tests/tsc-references/amdImportNotAsPrimaryExpression_es5.1.normal.js index 380b0825d274..48346c881dfc 100644 --- a/crates/swc/tests/tsc-references/amdImportNotAsPrimaryExpression_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/amdImportNotAsPrimaryExpression_es5.1.normal.js @@ -20,3 +20,4 @@ var x = {}; var y = false; var z; var e = 0; +export { }; diff --git a/crates/swc/tests/tsc-references/amdImportNotAsPrimaryExpression_es5.2.minified.js b/crates/swc/tests/tsc-references/amdImportNotAsPrimaryExpression_es5.2.minified.js index 3acdefb2f68c..0891291d0a84 100644 --- a/crates/swc/tests/tsc-references/amdImportNotAsPrimaryExpression_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/amdImportNotAsPrimaryExpression_es5.2.minified.js @@ -7,4 +7,6 @@ C1.s1 = !0; export var E1; !function(E1) { E1[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C"; -}(E1 || (E1 = {})), require("./foo_0"); +}(E1 || (E1 = {})); +require("./foo_0"); +export { }; diff --git a/crates/swc/tests/tsc-references/anonymousDefaultExportsAmd_es5.2.minified.js b/crates/swc/tests/tsc-references/anonymousDefaultExportsAmd_es5.2.minified.js index ed1ce7393db5..789a760181d1 100644 --- a/crates/swc/tests/tsc-references/anonymousDefaultExportsAmd_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/anonymousDefaultExportsAmd_es5.2.minified.js @@ -3,5 +3,5 @@ var _default = function() { "use strict"; _class_call_check(this, _default); }; -export default function() {}; export { _default as default }; +export default function() {}; diff --git a/crates/swc/tests/tsc-references/anonymousDefaultExportsCommonjs_es5.2.minified.js b/crates/swc/tests/tsc-references/anonymousDefaultExportsCommonjs_es5.2.minified.js index ed1ce7393db5..789a760181d1 100644 --- a/crates/swc/tests/tsc-references/anonymousDefaultExportsCommonjs_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/anonymousDefaultExportsCommonjs_es5.2.minified.js @@ -3,5 +3,5 @@ var _default = function() { "use strict"; _class_call_check(this, _default); }; -export default function() {}; export { _default as default }; +export default function() {}; diff --git a/crates/swc/tests/tsc-references/anonymousDefaultExportsSystem_es5.2.minified.js b/crates/swc/tests/tsc-references/anonymousDefaultExportsSystem_es5.2.minified.js index ed1ce7393db5..789a760181d1 100644 --- a/crates/swc/tests/tsc-references/anonymousDefaultExportsSystem_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/anonymousDefaultExportsSystem_es5.2.minified.js @@ -3,5 +3,5 @@ var _default = function() { "use strict"; _class_call_check(this, _default); }; -export default function() {}; export { _default as default }; +export default function() {}; diff --git a/crates/swc/tests/tsc-references/anonymousDefaultExportsUmd_es5.2.minified.js b/crates/swc/tests/tsc-references/anonymousDefaultExportsUmd_es5.2.minified.js index ed1ce7393db5..789a760181d1 100644 --- a/crates/swc/tests/tsc-references/anonymousDefaultExportsUmd_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/anonymousDefaultExportsUmd_es5.2.minified.js @@ -3,5 +3,5 @@ var _default = function() { "use strict"; _class_call_check(this, _default); }; -export default function() {}; export { _default as default }; +export default function() {}; diff --git a/crates/swc/tests/tsc-references/arraySpreadImportHelpers_es2015.1.normal.js b/crates/swc/tests/tsc-references/arraySpreadImportHelpers_es2015.1.normal.js index b03517e3555c..c7e49cdec9cd 100644 --- a/crates/swc/tests/tsc-references/arraySpreadImportHelpers_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/arraySpreadImportHelpers_es2015.1.normal.js @@ -15,3 +15,5 @@ const o = [ 4 ]; export { }; +// @filename: tslib.d.ts +// this is a pre-TS4.4 versions of emit helper, which always forced array packing diff --git a/crates/swc/tests/tsc-references/arraySpreadImportHelpers_es5.1.normal.js b/crates/swc/tests/tsc-references/arraySpreadImportHelpers_es5.1.normal.js index a9a345207de6..841d81195213 100644 --- a/crates/swc/tests/tsc-references/arraySpreadImportHelpers_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/arraySpreadImportHelpers_es5.1.normal.js @@ -16,3 +16,5 @@ var o = [ 4 ]); export { }; +// @filename: tslib.d.ts +// this is a pre-TS4.4 versions of emit helper, which always forced array packing diff --git a/crates/swc/tests/tsc-references/asOperator4_es2015.1.normal.js b/crates/swc/tests/tsc-references/asOperator4_es2015.1.normal.js index baa8c6d8553a..08cf1060ae54 100644 --- a/crates/swc/tests/tsc-references/asOperator4_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/asOperator4_es2015.1.normal.js @@ -1,6 +1,8 @@ //@module: commonjs //@filename: foo.ts export function foo() {} +//@filename: bar.ts +import { foo } from './foo'; // These should emit identically foo; foo; diff --git a/crates/swc/tests/tsc-references/asOperator4_es2015.2.minified.js b/crates/swc/tests/tsc-references/asOperator4_es2015.2.minified.js index f99d4277774f..fe4d27f67517 100644 --- a/crates/swc/tests/tsc-references/asOperator4_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/asOperator4_es2015.2.minified.js @@ -1 +1,2 @@ export function foo() {} +import { foo } from './foo'; diff --git a/crates/swc/tests/tsc-references/asOperator4_es5.1.normal.js b/crates/swc/tests/tsc-references/asOperator4_es5.1.normal.js index baa8c6d8553a..f5238ebfbc6b 100644 --- a/crates/swc/tests/tsc-references/asOperator4_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/asOperator4_es5.1.normal.js @@ -1,6 +1,8 @@ //@module: commonjs //@filename: foo.ts export function foo() {} +//@filename: bar.ts +import { foo } from "./foo"; // These should emit identically foo; foo; diff --git a/crates/swc/tests/tsc-references/asOperator4_es5.2.minified.js b/crates/swc/tests/tsc-references/asOperator4_es5.2.minified.js index f99d4277774f..272eb4d15cd7 100644 --- a/crates/swc/tests/tsc-references/asOperator4_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/asOperator4_es5.2.minified.js @@ -1 +1,2 @@ export function foo() {} +import { foo } from "./foo"; diff --git a/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface01_es2015.1.normal.js b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface01_es2015.1.normal.js new file mode 100644 index 000000000000..59ab4ed39b42 --- /dev/null +++ b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface01_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | var interface: number, I: string; +//! : ^^^^^^^^^ +//! `---- +//! +//! x Unexpected token `interface`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, +//! | regexp, ` for template literal, (, or an identifier +//! ,---- +//! 4 | interface // This should be the identifier 'interface' +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface01_es2015.2.minified.js b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface01_es2015.2.minified.js new file mode 100644 index 000000000000..59ab4ed39b42 --- /dev/null +++ b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface01_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | var interface: number, I: string; +//! : ^^^^^^^^^ +//! `---- +//! +//! x Unexpected token `interface`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, +//! | regexp, ` for template literal, (, or an identifier +//! ,---- +//! 4 | interface // This should be the identifier 'interface' +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface01_es5.1.normal.js b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface01_es5.1.normal.js new file mode 100644 index 000000000000..59ab4ed39b42 --- /dev/null +++ b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface01_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | var interface: number, I: string; +//! : ^^^^^^^^^ +//! `---- +//! +//! x Unexpected token `interface`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, +//! | regexp, ` for template literal, (, or an identifier +//! ,---- +//! 4 | interface // This should be the identifier 'interface' +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface01_es5.2.minified.js b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface01_es5.2.minified.js new file mode 100644 index 000000000000..59ab4ed39b42 --- /dev/null +++ b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface01_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | var interface: number, I: string; +//! : ^^^^^^^^^ +//! `---- +//! +//! x Unexpected token `interface`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, +//! | regexp, ` for template literal, (, or an identifier +//! ,---- +//! 4 | interface // This should be the identifier 'interface' +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface02_es2015.1.normal.js b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface02_es2015.1.normal.js new file mode 100644 index 000000000000..628fd3e3a679 --- /dev/null +++ b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface02_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | function f(interface: number, I: string) { +//! : ^^^^^^^^^ +//! `---- +//! +//! x Unexpected token `interface`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, +//! | regexp, ` for template literal, (, or an identifier +//! ,---- +//! 3 | interface // This should be the identifier 'interface' +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface02_es2015.2.minified.js b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface02_es2015.2.minified.js new file mode 100644 index 000000000000..628fd3e3a679 --- /dev/null +++ b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface02_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | function f(interface: number, I: string) { +//! : ^^^^^^^^^ +//! `---- +//! +//! x Unexpected token `interface`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, +//! | regexp, ` for template literal, (, or an identifier +//! ,---- +//! 3 | interface // This should be the identifier 'interface' +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface02_es5.1.normal.js b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface02_es5.1.normal.js new file mode 100644 index 000000000000..628fd3e3a679 --- /dev/null +++ b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface02_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | function f(interface: number, I: string) { +//! : ^^^^^^^^^ +//! `---- +//! +//! x Unexpected token `interface`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, +//! | regexp, ` for template literal, (, or an identifier +//! ,---- +//! 3 | interface // This should be the identifier 'interface' +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface02_es5.2.minified.js b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface02_es5.2.minified.js new file mode 100644 index 000000000000..628fd3e3a679 --- /dev/null +++ b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface02_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | function f(interface: number, I: string) { +//! : ^^^^^^^^^ +//! `---- +//! +//! x Unexpected token `interface`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, +//! | regexp, ` for template literal, (, or an identifier +//! ,---- +//! 3 | interface // This should be the identifier 'interface' +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface03_es2015.1.normal.js b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface03_es2015.1.normal.js new file mode 100644 index 000000000000..3e320a323314 --- /dev/null +++ b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface03_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | var interface: number, I: string; +//! : ^^^^^^^^^ +//! `---- +//! +//! x Unexpected token `interface`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, +//! | regexp, ` for template literal, (, or an identifier +//! ,---- +//! 5 | interface // This should be the identifier 'interface' +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface03_es2015.2.minified.js b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface03_es2015.2.minified.js new file mode 100644 index 000000000000..3e320a323314 --- /dev/null +++ b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface03_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | var interface: number, I: string; +//! : ^^^^^^^^^ +//! `---- +//! +//! x Unexpected token `interface`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, +//! | regexp, ` for template literal, (, or an identifier +//! ,---- +//! 5 | interface // This should be the identifier 'interface' +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface03_es5.1.normal.js b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface03_es5.1.normal.js new file mode 100644 index 000000000000..3e320a323314 --- /dev/null +++ b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface03_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | var interface: number, I: string; +//! : ^^^^^^^^^ +//! `---- +//! +//! x Unexpected token `interface`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, +//! | regexp, ` for template literal, (, or an identifier +//! ,---- +//! 5 | interface // This should be the identifier 'interface' +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface03_es5.2.minified.js b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface03_es5.2.minified.js new file mode 100644 index 000000000000..3e320a323314 --- /dev/null +++ b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface03_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | var interface: number, I: string; +//! : ^^^^^^^^^ +//! `---- +//! +//! x Unexpected token `interface`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, +//! | regexp, ` for template literal, (, or an identifier +//! ,---- +//! 5 | interface // This should be the identifier 'interface' +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface04_es2015.1.normal.js b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface04_es2015.1.normal.js new file mode 100644 index 000000000000..e9278518e3e5 --- /dev/null +++ b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface04_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | var declare: boolean, interface: number, I: string; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface04_es2015.2.minified.js b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface04_es2015.2.minified.js new file mode 100644 index 000000000000..e9278518e3e5 --- /dev/null +++ b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface04_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | var declare: boolean, interface: number, I: string; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface04_es5.1.normal.js b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface04_es5.1.normal.js new file mode 100644 index 000000000000..e9278518e3e5 --- /dev/null +++ b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface04_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | var declare: boolean, interface: number, I: string; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface04_es5.2.minified.js b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface04_es5.2.minified.js new file mode 100644 index 000000000000..e9278518e3e5 --- /dev/null +++ b/crates/swc/tests/tsc-references/asiPreventsParsingAsInterface04_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | var declare: boolean, interface: number, I: string; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/asyncImportedPromise_es5_es2015.1.normal.js b/crates/swc/tests/tsc-references/asyncImportedPromise_es5_es2015.1.normal.js index 35594773ce8c..01bd5770ae9c 100644 --- a/crates/swc/tests/tsc-references/asyncImportedPromise_es5_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/asyncImportedPromise_es5_es2015.1.normal.js @@ -2,9 +2,10 @@ // @lib: es5,es2015.promise // @module: commonjs // @filename: task.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class Task extends Promise { } +// @filename: test.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; class Test { example() { return _async_to_generator(function*() { @@ -12,3 +13,4 @@ class Test { })(); } } +export { }; diff --git a/crates/swc/tests/tsc-references/asyncImportedPromise_es5_es2015.2.minified.js b/crates/swc/tests/tsc-references/asyncImportedPromise_es5_es2015.2.minified.js index 7e6ceb8db282..2a437c376134 100644 --- a/crates/swc/tests/tsc-references/asyncImportedPromise_es5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/asyncImportedPromise_es5_es2015.2.minified.js @@ -1,3 +1,3 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class Task extends Promise { } +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/asyncImportedPromise_es5_es5.1.normal.js b/crates/swc/tests/tsc-references/asyncImportedPromise_es5_es5.1.normal.js index 64d230fa4ad0..19ca79d0bf75 100644 --- a/crates/swc/tests/tsc-references/asyncImportedPromise_es5_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/asyncImportedPromise_es5_es5.1.normal.js @@ -2,12 +2,10 @@ // @lib: es5,es2015.promise // @module: commonjs // @filename: task.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _wrap_native_super from "@swc/helpers/src/_wrap_native_super.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var Task = /*#__PURE__*/ function(Promise1) { "use strict"; _inherits(Task, Promise1); @@ -18,6 +16,10 @@ export var Task = /*#__PURE__*/ function(Promise1) { } return Task; }(_wrap_native_super(Promise)); +// @filename: test.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var Test = /*#__PURE__*/ function() { "use strict"; function Test() { @@ -39,3 +41,4 @@ var Test = /*#__PURE__*/ function() { }; return Test; }(); +export { }; diff --git a/crates/swc/tests/tsc-references/asyncImportedPromise_es5_es5.2.minified.js b/crates/swc/tests/tsc-references/asyncImportedPromise_es5_es5.2.minified.js index 4a9c70bc3a52..4871122def83 100644 --- a/crates/swc/tests/tsc-references/asyncImportedPromise_es5_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/asyncImportedPromise_es5_es5.2.minified.js @@ -1,9 +1,7 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _wrap_native_super from "@swc/helpers/src/_wrap_native_super.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var Task = function(Promise1) { "use strict"; _inherits(Task, Promise1); @@ -13,6 +11,9 @@ export var Task = function(Promise1) { } return Task; }(_wrap_native_super(Promise)); +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var Test = function() { "use strict"; function Test() { diff --git a/crates/swc/tests/tsc-references/asyncImportedPromise_es6_es2015.1.normal.js b/crates/swc/tests/tsc-references/asyncImportedPromise_es6_es2015.1.normal.js index d88b742dfacf..f16459ec64c0 100644 --- a/crates/swc/tests/tsc-references/asyncImportedPromise_es6_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/asyncImportedPromise_es6_es2015.1.normal.js @@ -1,9 +1,10 @@ // @target: es6 // @module: commonjs // @filename: task.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class Task extends Promise { } +// @filename: test.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; class Test { example() { return _async_to_generator(function*() { @@ -11,3 +12,4 @@ class Test { })(); } } +export { }; diff --git a/crates/swc/tests/tsc-references/asyncImportedPromise_es6_es2015.2.minified.js b/crates/swc/tests/tsc-references/asyncImportedPromise_es6_es2015.2.minified.js index 7e6ceb8db282..2a437c376134 100644 --- a/crates/swc/tests/tsc-references/asyncImportedPromise_es6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/asyncImportedPromise_es6_es2015.2.minified.js @@ -1,3 +1,3 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class Task extends Promise { } +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/asyncImportedPromise_es6_es5.1.normal.js b/crates/swc/tests/tsc-references/asyncImportedPromise_es6_es5.1.normal.js index a4a955a4d641..16f94ef8d7f6 100644 --- a/crates/swc/tests/tsc-references/asyncImportedPromise_es6_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/asyncImportedPromise_es6_es5.1.normal.js @@ -1,12 +1,10 @@ // @target: es6 // @module: commonjs // @filename: task.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _wrap_native_super from "@swc/helpers/src/_wrap_native_super.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var Task = /*#__PURE__*/ function(Promise1) { "use strict"; _inherits(Task, Promise1); @@ -17,6 +15,10 @@ export var Task = /*#__PURE__*/ function(Promise1) { } return Task; }(_wrap_native_super(Promise)); +// @filename: test.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var Test = /*#__PURE__*/ function() { "use strict"; function Test() { @@ -38,3 +40,4 @@ var Test = /*#__PURE__*/ function() { }; return Test; }(); +export { }; diff --git a/crates/swc/tests/tsc-references/asyncImportedPromise_es6_es5.2.minified.js b/crates/swc/tests/tsc-references/asyncImportedPromise_es6_es5.2.minified.js index 4a9c70bc3a52..4871122def83 100644 --- a/crates/swc/tests/tsc-references/asyncImportedPromise_es6_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/asyncImportedPromise_es6_es5.2.minified.js @@ -1,9 +1,7 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _wrap_native_super from "@swc/helpers/src/_wrap_native_super.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var Task = function(Promise1) { "use strict"; _inherits(Task, Promise1); @@ -13,6 +11,9 @@ export var Task = function(Promise1) { } return Task; }(_wrap_native_super(Promise)); +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var Test = function() { "use strict"; function Test() { diff --git a/crates/swc/tests/tsc-references/await_unaryExpression_es2017_1_es2015.1.normal.js b/crates/swc/tests/tsc-references/await_unaryExpression_es2017_1_es2015.1.normal.js new file mode 100644 index 000000000000..26c0801a7a02 --- /dev/null +++ b/crates/swc/tests/tsc-references/await_unaryExpression_es2017_1_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 8 | delete await 42; // OK +//! : ^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 12 | delete await 42; // OK +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/await_unaryExpression_es2017_1_es2015.2.minified.js b/crates/swc/tests/tsc-references/await_unaryExpression_es2017_1_es2015.2.minified.js new file mode 100644 index 000000000000..26c0801a7a02 --- /dev/null +++ b/crates/swc/tests/tsc-references/await_unaryExpression_es2017_1_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 8 | delete await 42; // OK +//! : ^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 12 | delete await 42; // OK +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/await_unaryExpression_es2017_1_es5.1.normal.js b/crates/swc/tests/tsc-references/await_unaryExpression_es2017_1_es5.1.normal.js new file mode 100644 index 000000000000..26c0801a7a02 --- /dev/null +++ b/crates/swc/tests/tsc-references/await_unaryExpression_es2017_1_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 8 | delete await 42; // OK +//! : ^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 12 | delete await 42; // OK +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/await_unaryExpression_es2017_1_es5.2.minified.js b/crates/swc/tests/tsc-references/await_unaryExpression_es2017_1_es5.2.minified.js new file mode 100644 index 000000000000..26c0801a7a02 --- /dev/null +++ b/crates/swc/tests/tsc-references/await_unaryExpression_es2017_1_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 8 | delete await 42; // OK +//! : ^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 12 | delete await 42; // OK +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/await_unaryExpression_es2017_2_es2015.1.normal.js b/crates/swc/tests/tsc-references/await_unaryExpression_es2017_2_es2015.1.normal.js new file mode 100644 index 000000000000..accd7d6c7c08 --- /dev/null +++ b/crates/swc/tests/tsc-references/await_unaryExpression_es2017_2_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 4 | delete await 42; +//! : ^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 8 | delete await 42; +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/await_unaryExpression_es2017_2_es2015.2.minified.js b/crates/swc/tests/tsc-references/await_unaryExpression_es2017_2_es2015.2.minified.js new file mode 100644 index 000000000000..accd7d6c7c08 --- /dev/null +++ b/crates/swc/tests/tsc-references/await_unaryExpression_es2017_2_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 4 | delete await 42; +//! : ^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 8 | delete await 42; +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/await_unaryExpression_es2017_2_es5.1.normal.js b/crates/swc/tests/tsc-references/await_unaryExpression_es2017_2_es5.1.normal.js new file mode 100644 index 000000000000..accd7d6c7c08 --- /dev/null +++ b/crates/swc/tests/tsc-references/await_unaryExpression_es2017_2_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 4 | delete await 42; +//! : ^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 8 | delete await 42; +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/await_unaryExpression_es2017_2_es5.2.minified.js b/crates/swc/tests/tsc-references/await_unaryExpression_es2017_2_es5.2.minified.js new file mode 100644 index 000000000000..accd7d6c7c08 --- /dev/null +++ b/crates/swc/tests/tsc-references/await_unaryExpression_es2017_2_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 4 | delete await 42; +//! : ^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 8 | delete await 42; +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/await_unaryExpression_es6_1_es2015.1.normal.js b/crates/swc/tests/tsc-references/await_unaryExpression_es6_1_es2015.1.normal.js new file mode 100644 index 000000000000..26c0801a7a02 --- /dev/null +++ b/crates/swc/tests/tsc-references/await_unaryExpression_es6_1_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 8 | delete await 42; // OK +//! : ^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 12 | delete await 42; // OK +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/await_unaryExpression_es6_1_es2015.2.minified.js b/crates/swc/tests/tsc-references/await_unaryExpression_es6_1_es2015.2.minified.js new file mode 100644 index 000000000000..26c0801a7a02 --- /dev/null +++ b/crates/swc/tests/tsc-references/await_unaryExpression_es6_1_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 8 | delete await 42; // OK +//! : ^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 12 | delete await 42; // OK +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/await_unaryExpression_es6_1_es5.1.normal.js b/crates/swc/tests/tsc-references/await_unaryExpression_es6_1_es5.1.normal.js new file mode 100644 index 000000000000..26c0801a7a02 --- /dev/null +++ b/crates/swc/tests/tsc-references/await_unaryExpression_es6_1_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 8 | delete await 42; // OK +//! : ^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 12 | delete await 42; // OK +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/await_unaryExpression_es6_1_es5.2.minified.js b/crates/swc/tests/tsc-references/await_unaryExpression_es6_1_es5.2.minified.js new file mode 100644 index 000000000000..26c0801a7a02 --- /dev/null +++ b/crates/swc/tests/tsc-references/await_unaryExpression_es6_1_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 8 | delete await 42; // OK +//! : ^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 12 | delete await 42; // OK +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/await_unaryExpression_es6_2_es2015.1.normal.js b/crates/swc/tests/tsc-references/await_unaryExpression_es6_2_es2015.1.normal.js new file mode 100644 index 000000000000..accd7d6c7c08 --- /dev/null +++ b/crates/swc/tests/tsc-references/await_unaryExpression_es6_2_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 4 | delete await 42; +//! : ^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 8 | delete await 42; +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/await_unaryExpression_es6_2_es2015.2.minified.js b/crates/swc/tests/tsc-references/await_unaryExpression_es6_2_es2015.2.minified.js new file mode 100644 index 000000000000..accd7d6c7c08 --- /dev/null +++ b/crates/swc/tests/tsc-references/await_unaryExpression_es6_2_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 4 | delete await 42; +//! : ^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 8 | delete await 42; +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/await_unaryExpression_es6_2_es5.1.normal.js b/crates/swc/tests/tsc-references/await_unaryExpression_es6_2_es5.1.normal.js new file mode 100644 index 000000000000..accd7d6c7c08 --- /dev/null +++ b/crates/swc/tests/tsc-references/await_unaryExpression_es6_2_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 4 | delete await 42; +//! : ^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 8 | delete await 42; +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/await_unaryExpression_es6_2_es5.2.minified.js b/crates/swc/tests/tsc-references/await_unaryExpression_es6_2_es5.2.minified.js new file mode 100644 index 000000000000..accd7d6c7c08 --- /dev/null +++ b/crates/swc/tests/tsc-references/await_unaryExpression_es6_2_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 4 | delete await 42; +//! : ^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 8 | delete await 42; +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/callSignaturesWithAccessibilityModifiersOnParameters_es2015.1.normal.js b/crates/swc/tests/tsc-references/callSignaturesWithAccessibilityModifiersOnParameters_es2015.1.normal.js new file mode 100644 index 000000000000..a2a3bdfc68ad --- /dev/null +++ b/crates/swc/tests/tsc-references/callSignaturesWithAccessibilityModifiersOnParameters_es2015.1.normal.js @@ -0,0 +1,216 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 3 | function foo(public x, private y) { } +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 3 | function foo(public x, private y) { } +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 4 | var f = function foo(public x, private y) { } +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 4 | var f = function foo(public x, private y) { } +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 5 | var f2 = function (public x, private y) { } +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 5 | var f2 = function (public x, private y) { } +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 6 | var f3 = (x, private y) => { } +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 9 | function foo2(private x: string, public y: number) { } +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 9 | function foo2(private x: string, public y: number) { } +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 10 | var f5 = function foo(private x: string, public y: number) { } +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 10 | var f5 = function foo(private x: string, public y: number) { } +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 11 | var f6 = function (private x: string, public y: number) { } +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 11 | var f6 = function (private x: string, public y: number) { } +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 12 | var f7 = (private x: string, public y: number) => { } +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 12 | var f7 = (private x: string, public y: number) => { } +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 16 | foo(public x, private y) { } +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 16 | foo(public x, private y) { } +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 17 | foo2(public x: number, private y: string) { } +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 17 | foo2(public x: number, private y: string) { } +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 18 | foo3(public x: T, private y: T) { } +//! : ^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 18 | foo3(public x: T, private y: T) { } +//! : ^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 22 | (private x, public y); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 22 | (private x, public y); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 23 | (private x: string, public y: number); +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 23 | (private x: string, public y: number); +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 24 | foo(private x, public y); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 24 | foo(private x, public y); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 25 | foo(public x: number, y: string); +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 26 | foo3(x: T, private y: T); +//! : ^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 30 | foo(public x, private y); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 30 | foo(public x, private y); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 31 | foo2(private x: number, public y: string); +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 31 | foo2(private x: number, public y: string); +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 35 | foo(public x, y) { }, +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 36 | a: function foo(x: number, private y: string) { }, +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/callSignaturesWithAccessibilityModifiersOnParameters_es2015.2.minified.js b/crates/swc/tests/tsc-references/callSignaturesWithAccessibilityModifiersOnParameters_es2015.2.minified.js new file mode 100644 index 000000000000..a2a3bdfc68ad --- /dev/null +++ b/crates/swc/tests/tsc-references/callSignaturesWithAccessibilityModifiersOnParameters_es2015.2.minified.js @@ -0,0 +1,216 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 3 | function foo(public x, private y) { } +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 3 | function foo(public x, private y) { } +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 4 | var f = function foo(public x, private y) { } +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 4 | var f = function foo(public x, private y) { } +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 5 | var f2 = function (public x, private y) { } +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 5 | var f2 = function (public x, private y) { } +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 6 | var f3 = (x, private y) => { } +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 9 | function foo2(private x: string, public y: number) { } +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 9 | function foo2(private x: string, public y: number) { } +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 10 | var f5 = function foo(private x: string, public y: number) { } +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 10 | var f5 = function foo(private x: string, public y: number) { } +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 11 | var f6 = function (private x: string, public y: number) { } +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 11 | var f6 = function (private x: string, public y: number) { } +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 12 | var f7 = (private x: string, public y: number) => { } +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 12 | var f7 = (private x: string, public y: number) => { } +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 16 | foo(public x, private y) { } +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 16 | foo(public x, private y) { } +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 17 | foo2(public x: number, private y: string) { } +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 17 | foo2(public x: number, private y: string) { } +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 18 | foo3(public x: T, private y: T) { } +//! : ^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 18 | foo3(public x: T, private y: T) { } +//! : ^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 22 | (private x, public y); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 22 | (private x, public y); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 23 | (private x: string, public y: number); +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 23 | (private x: string, public y: number); +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 24 | foo(private x, public y); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 24 | foo(private x, public y); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 25 | foo(public x: number, y: string); +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 26 | foo3(x: T, private y: T); +//! : ^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 30 | foo(public x, private y); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 30 | foo(public x, private y); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 31 | foo2(private x: number, public y: string); +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 31 | foo2(private x: number, public y: string); +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 35 | foo(public x, y) { }, +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 36 | a: function foo(x: number, private y: string) { }, +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/callSignaturesWithAccessibilityModifiersOnParameters_es5.1.normal.js b/crates/swc/tests/tsc-references/callSignaturesWithAccessibilityModifiersOnParameters_es5.1.normal.js new file mode 100644 index 000000000000..a2a3bdfc68ad --- /dev/null +++ b/crates/swc/tests/tsc-references/callSignaturesWithAccessibilityModifiersOnParameters_es5.1.normal.js @@ -0,0 +1,216 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 3 | function foo(public x, private y) { } +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 3 | function foo(public x, private y) { } +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 4 | var f = function foo(public x, private y) { } +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 4 | var f = function foo(public x, private y) { } +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 5 | var f2 = function (public x, private y) { } +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 5 | var f2 = function (public x, private y) { } +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 6 | var f3 = (x, private y) => { } +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 9 | function foo2(private x: string, public y: number) { } +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 9 | function foo2(private x: string, public y: number) { } +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 10 | var f5 = function foo(private x: string, public y: number) { } +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 10 | var f5 = function foo(private x: string, public y: number) { } +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 11 | var f6 = function (private x: string, public y: number) { } +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 11 | var f6 = function (private x: string, public y: number) { } +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 12 | var f7 = (private x: string, public y: number) => { } +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 12 | var f7 = (private x: string, public y: number) => { } +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 16 | foo(public x, private y) { } +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 16 | foo(public x, private y) { } +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 17 | foo2(public x: number, private y: string) { } +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 17 | foo2(public x: number, private y: string) { } +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 18 | foo3(public x: T, private y: T) { } +//! : ^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 18 | foo3(public x: T, private y: T) { } +//! : ^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 22 | (private x, public y); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 22 | (private x, public y); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 23 | (private x: string, public y: number); +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 23 | (private x: string, public y: number); +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 24 | foo(private x, public y); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 24 | foo(private x, public y); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 25 | foo(public x: number, y: string); +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 26 | foo3(x: T, private y: T); +//! : ^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 30 | foo(public x, private y); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 30 | foo(public x, private y); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 31 | foo2(private x: number, public y: string); +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 31 | foo2(private x: number, public y: string); +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 35 | foo(public x, y) { }, +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 36 | a: function foo(x: number, private y: string) { }, +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/callSignaturesWithAccessibilityModifiersOnParameters_es5.2.minified.js b/crates/swc/tests/tsc-references/callSignaturesWithAccessibilityModifiersOnParameters_es5.2.minified.js new file mode 100644 index 000000000000..a2a3bdfc68ad --- /dev/null +++ b/crates/swc/tests/tsc-references/callSignaturesWithAccessibilityModifiersOnParameters_es5.2.minified.js @@ -0,0 +1,216 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 3 | function foo(public x, private y) { } +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 3 | function foo(public x, private y) { } +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 4 | var f = function foo(public x, private y) { } +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 4 | var f = function foo(public x, private y) { } +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 5 | var f2 = function (public x, private y) { } +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 5 | var f2 = function (public x, private y) { } +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 6 | var f3 = (x, private y) => { } +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 9 | function foo2(private x: string, public y: number) { } +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 9 | function foo2(private x: string, public y: number) { } +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 10 | var f5 = function foo(private x: string, public y: number) { } +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 10 | var f5 = function foo(private x: string, public y: number) { } +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 11 | var f6 = function (private x: string, public y: number) { } +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 11 | var f6 = function (private x: string, public y: number) { } +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 12 | var f7 = (private x: string, public y: number) => { } +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 12 | var f7 = (private x: string, public y: number) => { } +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 16 | foo(public x, private y) { } +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 16 | foo(public x, private y) { } +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 17 | foo2(public x: number, private y: string) { } +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 17 | foo2(public x: number, private y: string) { } +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 18 | foo3(public x: T, private y: T) { } +//! : ^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 18 | foo3(public x: T, private y: T) { } +//! : ^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 22 | (private x, public y); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 22 | (private x, public y); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 23 | (private x: string, public y: number); +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 23 | (private x: string, public y: number); +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 24 | foo(private x, public y); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 24 | foo(private x, public y); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 25 | foo(public x: number, y: string); +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 26 | foo3(x: T, private y: T); +//! : ^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 30 | foo(public x, private y); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 30 | foo(public x, private y); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 31 | foo2(private x: number, public y: string); +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 31 | foo2(private x: number, public y: string); +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 35 | foo(public x, y) { }, +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 36 | a: function foo(x: number, private y: string) { }, +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/callSignaturesWithDuplicateParameters_es2015.1.normal.js b/crates/swc/tests/tsc-references/callSignaturesWithDuplicateParameters_es2015.1.normal.js index 3d045f748278..5b424c18c269 100644 --- a/crates/swc/tests/tsc-references/callSignaturesWithDuplicateParameters_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/callSignaturesWithDuplicateParameters_es2015.1.normal.js @@ -1,22 +1,120 @@ -// Duplicate parameter names are always an error -function foo(x, x) {} -var f = function foo(x, x) {}; -var f2 = function(x, x) {}; -var f3 = (x, x)=>{}; -var f4 = (x, x)=>{}; -function foo2(x, x) {} -var f5 = function foo(x, x) {}; -var f6 = function(x, x) {}; -var f7 = (x, x)=>{}; -var f8 = (x, y)=>{}; -class C { - foo(x, x) {} - foo2(x, x) {} - foo3(x, x) {} -} -var a; -var b = { - foo (x, x) {}, - a: function foo(x, x) {}, - b: (x, x)=>{} -}; +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 3 | function foo(x, x) { } +//! : | | +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 4 | var f = function foo(x, x) { } +//! : | | +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 5 | var f2 = function (x, x) { } +//! : | | +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 6 | var f3 = (x, x) => { } +//! : | | +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 7 | var f4 = (x: T, x: T) => { } +//! : ^^|^ ^^|^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 9 | function foo2(x: string, x: number) { } +//! : ^^^^|^^^^ ^^^^|^^^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 10 | var f5 = function foo(x: string, x: number) { } +//! : ^^^^|^^^^ ^^^^|^^^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 11 | var f6 = function (x: string, x: number) { } +//! : ^^^^|^^^^ ^^^^|^^^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 12 | var f7 = (x: string, x: number) => { } +//! : ^^^^|^^^^ ^^^^|^^^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 16 | foo(x, x) { } +//! : | | +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 17 | foo2(x: number, x: string) { } +//! : ^^^^|^^^^ ^^^^|^^^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 18 | foo3(x: T, x: T) { } +//! : ^^|^ ^^|^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 35 | foo(x, x) { }, +//! : | | +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 36 | a: function foo(x: number, x: string) { }, +//! : ^^^^|^^^^ ^^^^|^^^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 37 | b: (x: T, x: T) => { } +//! : ^^|^ ^^|^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- diff --git a/crates/swc/tests/tsc-references/callSignaturesWithDuplicateParameters_es2015.2.minified.js b/crates/swc/tests/tsc-references/callSignaturesWithDuplicateParameters_es2015.2.minified.js new file mode 100644 index 000000000000..5b424c18c269 --- /dev/null +++ b/crates/swc/tests/tsc-references/callSignaturesWithDuplicateParameters_es2015.2.minified.js @@ -0,0 +1,120 @@ +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 3 | function foo(x, x) { } +//! : | | +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 4 | var f = function foo(x, x) { } +//! : | | +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 5 | var f2 = function (x, x) { } +//! : | | +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 6 | var f3 = (x, x) => { } +//! : | | +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 7 | var f4 = (x: T, x: T) => { } +//! : ^^|^ ^^|^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 9 | function foo2(x: string, x: number) { } +//! : ^^^^|^^^^ ^^^^|^^^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 10 | var f5 = function foo(x: string, x: number) { } +//! : ^^^^|^^^^ ^^^^|^^^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 11 | var f6 = function (x: string, x: number) { } +//! : ^^^^|^^^^ ^^^^|^^^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 12 | var f7 = (x: string, x: number) => { } +//! : ^^^^|^^^^ ^^^^|^^^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 16 | foo(x, x) { } +//! : | | +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 17 | foo2(x: number, x: string) { } +//! : ^^^^|^^^^ ^^^^|^^^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 18 | foo3(x: T, x: T) { } +//! : ^^|^ ^^|^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 35 | foo(x, x) { }, +//! : | | +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 36 | a: function foo(x: number, x: string) { }, +//! : ^^^^|^^^^ ^^^^|^^^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 37 | b: (x: T, x: T) => { } +//! : ^^|^ ^^|^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- diff --git a/crates/swc/tests/tsc-references/callSignaturesWithDuplicateParameters_es5.1.normal.js b/crates/swc/tests/tsc-references/callSignaturesWithDuplicateParameters_es5.1.normal.js index ea6348e16241..5b424c18c269 100644 --- a/crates/swc/tests/tsc-references/callSignaturesWithDuplicateParameters_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/callSignaturesWithDuplicateParameters_es5.1.normal.js @@ -1,29 +1,120 @@ -// Duplicate parameter names are always an error -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -function foo(x, x) {} -var f = function foo(x, x) {}; -var f2 = function f2(x, x) {}; -var f3 = function(x, x) {}; -var f4 = function(x, x) {}; -function foo2(x, x) {} -var f5 = function foo(x, x) {}; -var f6 = function f6(x, x) {}; -var f7 = function(x, x) {}; -var f8 = function(x, y) {}; -var C = /*#__PURE__*/ function() { - "use strict"; - function C() { - _class_call_check(this, C); - } - var _proto = C.prototype; - _proto.foo = function foo(x, x) {}; - _proto.foo2 = function foo2(x, x) {}; - _proto.foo3 = function foo3(x, x) {}; - return C; -}(); -var a; -var b = { - foo: function foo(x, x) {}, - a: function foo(x, x) {}, - b: function(x, x) {} -}; +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 3 | function foo(x, x) { } +//! : | | +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 4 | var f = function foo(x, x) { } +//! : | | +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 5 | var f2 = function (x, x) { } +//! : | | +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 6 | var f3 = (x, x) => { } +//! : | | +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 7 | var f4 = (x: T, x: T) => { } +//! : ^^|^ ^^|^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 9 | function foo2(x: string, x: number) { } +//! : ^^^^|^^^^ ^^^^|^^^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 10 | var f5 = function foo(x: string, x: number) { } +//! : ^^^^|^^^^ ^^^^|^^^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 11 | var f6 = function (x: string, x: number) { } +//! : ^^^^|^^^^ ^^^^|^^^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 12 | var f7 = (x: string, x: number) => { } +//! : ^^^^|^^^^ ^^^^|^^^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 16 | foo(x, x) { } +//! : | | +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 17 | foo2(x: number, x: string) { } +//! : ^^^^|^^^^ ^^^^|^^^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 18 | foo3(x: T, x: T) { } +//! : ^^|^ ^^|^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 35 | foo(x, x) { }, +//! : | | +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 36 | a: function foo(x: number, x: string) { }, +//! : ^^^^|^^^^ ^^^^|^^^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 37 | b: (x: T, x: T) => { } +//! : ^^|^ ^^|^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- diff --git a/crates/swc/tests/tsc-references/callSignaturesWithDuplicateParameters_es5.2.minified.js b/crates/swc/tests/tsc-references/callSignaturesWithDuplicateParameters_es5.2.minified.js index 4cded96f6c03..5b424c18c269 100644 --- a/crates/swc/tests/tsc-references/callSignaturesWithDuplicateParameters_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/callSignaturesWithDuplicateParameters_es5.2.minified.js @@ -1,9 +1,120 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var C = function() { - "use strict"; - function C() { - _class_call_check(this, C); - } - var _proto = C.prototype; - return _proto.foo = function(x, x) {}, _proto.foo2 = function(x, x) {}, _proto.foo3 = function(x, x) {}, C; -}(); +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 3 | function foo(x, x) { } +//! : | | +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 4 | var f = function foo(x, x) { } +//! : | | +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 5 | var f2 = function (x, x) { } +//! : | | +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 6 | var f3 = (x, x) => { } +//! : | | +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 7 | var f4 = (x: T, x: T) => { } +//! : ^^|^ ^^|^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 9 | function foo2(x: string, x: number) { } +//! : ^^^^|^^^^ ^^^^|^^^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 10 | var f5 = function foo(x: string, x: number) { } +//! : ^^^^|^^^^ ^^^^|^^^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 11 | var f6 = function (x: string, x: number) { } +//! : ^^^^|^^^^ ^^^^|^^^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 12 | var f7 = (x: string, x: number) => { } +//! : ^^^^|^^^^ ^^^^|^^^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 16 | foo(x, x) { } +//! : | | +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 17 | foo2(x: number, x: string) { } +//! : ^^^^|^^^^ ^^^^|^^^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 18 | foo3(x: T, x: T) { } +//! : ^^|^ ^^|^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 35 | foo(x, x) { }, +//! : | | +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 36 | a: function foo(x: number, x: string) { }, +//! : ^^^^|^^^^ ^^^^|^^^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `x` is bound more than once in this parameter list +//! ,---- +//! 37 | b: (x: T, x: T) => { } +//! : ^^|^ ^^|^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- diff --git a/crates/swc/tests/tsc-references/callSignaturesWithParameterInitializers_es2015.1.normal.js b/crates/swc/tests/tsc-references/callSignaturesWithParameterInitializers_es2015.1.normal.js new file mode 100644 index 000000000000..34fbdf8a2d0d --- /dev/null +++ b/crates/swc/tests/tsc-references/callSignaturesWithParameterInitializers_es2015.1.normal.js @@ -0,0 +1,11 @@ +//! +//! x Unexpected token `)`. Expected an identifier, [ for an array pattern, { for an object patter or ... for a rest pattern +//! ,---- +//! 24 | (x = 1); +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/callSignaturesWithParameterInitializers_es2015.2.minified.js b/crates/swc/tests/tsc-references/callSignaturesWithParameterInitializers_es2015.2.minified.js new file mode 100644 index 000000000000..34fbdf8a2d0d --- /dev/null +++ b/crates/swc/tests/tsc-references/callSignaturesWithParameterInitializers_es2015.2.minified.js @@ -0,0 +1,11 @@ +//! +//! x Unexpected token `)`. Expected an identifier, [ for an array pattern, { for an object patter or ... for a rest pattern +//! ,---- +//! 24 | (x = 1); +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/callSignaturesWithParameterInitializers_es5.1.normal.js b/crates/swc/tests/tsc-references/callSignaturesWithParameterInitializers_es5.1.normal.js new file mode 100644 index 000000000000..34fbdf8a2d0d --- /dev/null +++ b/crates/swc/tests/tsc-references/callSignaturesWithParameterInitializers_es5.1.normal.js @@ -0,0 +1,11 @@ +//! +//! x Unexpected token `)`. Expected an identifier, [ for an array pattern, { for an object patter or ... for a rest pattern +//! ,---- +//! 24 | (x = 1); +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/callSignaturesWithParameterInitializers_es5.2.minified.js b/crates/swc/tests/tsc-references/callSignaturesWithParameterInitializers_es5.2.minified.js new file mode 100644 index 000000000000..34fbdf8a2d0d --- /dev/null +++ b/crates/swc/tests/tsc-references/callSignaturesWithParameterInitializers_es5.2.minified.js @@ -0,0 +1,11 @@ +//! +//! x Unexpected token `)`. Expected an identifier, [ for an array pattern, { for an object patter or ... for a rest pattern +//! ,---- +//! 24 | (x = 1); +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/callWithMissingVoidUndefinedUnknownAnyInJs_es2015.2.minified.js b/crates/swc/tests/tsc-references/callWithMissingVoidUndefinedUnknownAnyInJs_es2015.2.minified.js index 2372b8862c3c..8b2f16b90f87 100644 --- a/crates/swc/tests/tsc-references/callWithMissingVoidUndefinedUnknownAnyInJs_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/callWithMissingVoidUndefinedUnknownAnyInJs_es2015.2.minified.js @@ -1 +1,2 @@ -f1(), o1.m(), f2(), f3(), f4(), o2.m(), o3.m(), o4.m(), f1(), o1.m(), f2(), f3(), f4(), o2.m(), o3.m(), o4.m(); +f1(), o1.m(), f2(), f3(), f4(), o2.m(), o3.m(), o4.m(); +f1(), o1.m(), f2(), f3(), f4(), o2.m(), o3.m(), o4.m(); diff --git a/crates/swc/tests/tsc-references/callWithMissingVoidUndefinedUnknownAnyInJs_es5.2.minified.js b/crates/swc/tests/tsc-references/callWithMissingVoidUndefinedUnknownAnyInJs_es5.2.minified.js index 2372b8862c3c..8b2f16b90f87 100644 --- a/crates/swc/tests/tsc-references/callWithMissingVoidUndefinedUnknownAnyInJs_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/callWithMissingVoidUndefinedUnknownAnyInJs_es5.2.minified.js @@ -1 +1,2 @@ -f1(), o1.m(), f2(), f3(), f4(), o2.m(), o3.m(), o4.m(), f1(), o1.m(), f2(), f3(), f4(), o2.m(), o3.m(), o4.m(); +f1(), o1.m(), f2(), f3(), f4(), o2.m(), o3.m(), o4.m(); +f1(), o1.m(), f2(), f3(), f4(), o2.m(), o3.m(), o4.m(); diff --git a/crates/swc/tests/tsc-references/chained2_es2015.1.normal.js b/crates/swc/tests/tsc-references/chained2_es2015.1.normal.js index 92f02874f997..664690348edc 100644 --- a/crates/swc/tests/tsc-references/chained2_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/chained2_es2015.1.normal.js @@ -1,6 +1,9 @@ // @Filename: /a.ts class A { } +export { }; +// @Filename: /b.ts +import A from './a'; export { A }; // @Filename: /c.ts import * as types from './b'; diff --git a/crates/swc/tests/tsc-references/chained2_es2015.2.minified.js b/crates/swc/tests/tsc-references/chained2_es2015.2.minified.js index 7f5afe1cdf2c..6f1f81a539b8 100644 --- a/crates/swc/tests/tsc-references/chained2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/chained2_es2015.2.minified.js @@ -1,6 +1,7 @@ -class A { -} +export { }; +import A from './a'; +export { A }; import * as types from './b'; +export { types as default }; import types from './c'; new types.A(), new types.B(); -export { A, types as default }; diff --git a/crates/swc/tests/tsc-references/chained2_es5.1.normal.js b/crates/swc/tests/tsc-references/chained2_es5.1.normal.js index 8d90eba10a98..0cfaebcbb822 100644 --- a/crates/swc/tests/tsc-references/chained2_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/chained2_es5.1.normal.js @@ -4,6 +4,9 @@ var A = function A() { "use strict"; _class_call_check(this, A); }; +export { }; +// @Filename: /b.ts +import A from "./a"; export { A }; // @Filename: /c.ts import * as types from "./b"; diff --git a/crates/swc/tests/tsc-references/chained2_es5.2.minified.js b/crates/swc/tests/tsc-references/chained2_es5.2.minified.js index c9d084c268e1..40354cd9548a 100644 --- a/crates/swc/tests/tsc-references/chained2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/chained2_es5.2.minified.js @@ -3,7 +3,9 @@ var A = function() { "use strict"; _class_call_check(this, A); }; +import A from "./a"; +export { A }; import * as types from "./b"; +export { types as default }; import types from "./c"; new types.A(), new types.B(); -export { A, types as default }; diff --git a/crates/swc/tests/tsc-references/chained_es2015.1.normal.js b/crates/swc/tests/tsc-references/chained_es2015.1.normal.js index b43865cb539f..dfcc85ceb97c 100644 --- a/crates/swc/tests/tsc-references/chained_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/chained_es2015.1.normal.js @@ -1,7 +1,11 @@ // @Filename: /a.ts class A { } +export { }; +// @Filename: /b.ts export { B as C } from './a'; +// @Filename: /c.ts +export { }; // @Filename: /d.ts import { D } from './c'; new D(); diff --git a/crates/swc/tests/tsc-references/chained_es2015.2.minified.js b/crates/swc/tests/tsc-references/chained_es2015.2.minified.js index 5204b07843a1..c3a697e97a8a 100644 --- a/crates/swc/tests/tsc-references/chained_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/chained_es2015.2.minified.js @@ -1,3 +1,5 @@ +export { }; export { B as C } from './a'; +export { }; import { D } from './c'; new D(); diff --git a/crates/swc/tests/tsc-references/chained_es5.1.normal.js b/crates/swc/tests/tsc-references/chained_es5.1.normal.js index 1ff82f0b00e4..6dd7ef04d352 100644 --- a/crates/swc/tests/tsc-references/chained_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/chained_es5.1.normal.js @@ -4,7 +4,11 @@ var A = function A() { "use strict"; _class_call_check(this, A); }; +export { }; +// @Filename: /b.ts export { B as C } from "./a"; +// @Filename: /c.ts +export { }; // @Filename: /d.ts import { D } from "./c"; new D(); diff --git a/crates/swc/tests/tsc-references/chained_es5.2.minified.js b/crates/swc/tests/tsc-references/chained_es5.2.minified.js index e2bfc33c1691..1d46afd71543 100644 --- a/crates/swc/tests/tsc-references/chained_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/chained_es5.2.minified.js @@ -4,5 +4,6 @@ var A = function() { _class_call_check(this, A); }; export { B as C } from "./a"; +export { }; import { D } from "./c"; new D(); diff --git a/crates/swc/tests/tsc-references/checkExportsObjectAssignProperty_es2015.2.minified.js b/crates/swc/tests/tsc-references/checkExportsObjectAssignProperty_es2015.2.minified.js index fdc84d23e9e8..9a7bfa38da9a 100644 --- a/crates/swc/tests/tsc-references/checkExportsObjectAssignProperty_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/checkExportsObjectAssignProperty_es2015.2.minified.js @@ -13,7 +13,8 @@ Object.defineProperty(exports, "thing", { set (str) { this.rwAccessors = Number(str); } -}), Object.defineProperty(module.exports, "thing", { +}); +Object.defineProperty(module.exports, "thing", { value: "yes", writable: !0 }), Object.defineProperty(module.exports, "readonlyProp", { @@ -28,7 +29,8 @@ Object.defineProperty(exports, "thing", { set (str) { this.rwAccessors = Number(str); } -}), require("./mod1").thing, require("./mod2").thing; +}); +require("./mod1").thing, require("./mod2").thing; import "./"; let m1 = require("./mod1"); m1.thing, m1.readonlyProp, m1.rwAccessors, m1.readonlyAccessor, m1.setonlyAccessor, m1.thing = 10, m1.rwAccessors = 11, m1.setonlyAccessor = "yes", m1.readonlyProp = "name", m1.readonlyAccessor = 12, m1.thing = "no", m1.rwAccessors = "no", m1.setonlyAccessor = 0; diff --git a/crates/swc/tests/tsc-references/checkExportsObjectAssignProperty_es5.2.minified.js b/crates/swc/tests/tsc-references/checkExportsObjectAssignProperty_es5.2.minified.js index 6a57ba168b03..775ce9bce128 100644 --- a/crates/swc/tests/tsc-references/checkExportsObjectAssignProperty_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/checkExportsObjectAssignProperty_es5.2.minified.js @@ -17,7 +17,8 @@ Object.defineProperty(exports, "thing", { set: function(str) { this.rwAccessors = Number(str); } -}), Object.defineProperty(module.exports, "thing", { +}); +Object.defineProperty(module.exports, "thing", { value: "yes", writable: !0 }), Object.defineProperty(module.exports, "readonlyProp", { @@ -36,7 +37,8 @@ Object.defineProperty(exports, "thing", { set: function(str) { this.rwAccessors = Number(str); } -}), require("./mod1").thing, require("./mod2").thing; +}); +require("./mod1").thing, require("./mod2").thing; import "./"; var m1 = require("./mod1"); m1.thing, m1.readonlyProp, m1.rwAccessors, m1.readonlyAccessor, m1.setonlyAccessor, m1.thing = 10, m1.rwAccessors = 11, m1.setonlyAccessor = "yes", m1.readonlyProp = "name", m1.readonlyAccessor = 12, m1.thing = "no", m1.rwAccessors = "no", m1.setonlyAccessor = 0; diff --git a/crates/swc/tests/tsc-references/checkExportsObjectAssignPrototypeProperty_es5.2.minified.js b/crates/swc/tests/tsc-references/checkExportsObjectAssignPrototypeProperty_es5.2.minified.js index 07a83c9cf0f1..cd5f7653edbf 100644 --- a/crates/swc/tests/tsc-references/checkExportsObjectAssignPrototypeProperty_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/checkExportsObjectAssignPrototypeProperty_es5.2.minified.js @@ -24,5 +24,5 @@ Person.prototype.describe = function() { } }), module.exports = Person; import "./"; -var Person = require("./mod1"), m1 = new Person("Name"); +var m1 = new (require("./mod1"))("Name"); m1.thing, m1.readonlyProp, m1.rwAccessors, m1.readonlyAccessor, m1.setonlyAccessor, m1.thing = 10, m1.rwAccessors = 11, m1.setonlyAccessor = "yes", m1.readonlyProp = "name", m1.readonlyAccessor = 12, m1.thing = "no", m1.rwAccessors = "no", m1.setonlyAccessor = 0; diff --git a/crates/swc/tests/tsc-references/checkObjectDefineProperty_es2015.2.minified.js b/crates/swc/tests/tsc-references/checkObjectDefineProperty_es2015.2.minified.js index ae356120e76d..cd02a68a6b69 100644 --- a/crates/swc/tests/tsc-references/checkObjectDefineProperty_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/checkObjectDefineProperty_es2015.2.minified.js @@ -1,4 +1,4 @@ -let x = {}; +const x = {}; Object.defineProperty(x, "name", { value: "Charles", writable: !0 diff --git a/crates/swc/tests/tsc-references/circular1_es2015.1.normal.js b/crates/swc/tests/tsc-references/circular1_es2015.1.normal.js index a1fec531316c..5fbe9c3e04f1 100644 --- a/crates/swc/tests/tsc-references/circular1_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/circular1_es2015.1.normal.js @@ -1,3 +1,5 @@ // @noEmit: true // @Filename: /a.ts export { }; +// @Filename: /b.ts +export { }; diff --git a/crates/swc/tests/tsc-references/circular1_es2015.2.minified.js b/crates/swc/tests/tsc-references/circular1_es2015.2.minified.js index 2234b9cae16d..98fdd3114198 100644 --- a/crates/swc/tests/tsc-references/circular1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/circular1_es2015.2.minified.js @@ -1 +1,2 @@ export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/circular1_es5.1.normal.js b/crates/swc/tests/tsc-references/circular1_es5.1.normal.js index a1fec531316c..5fbe9c3e04f1 100644 --- a/crates/swc/tests/tsc-references/circular1_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/circular1_es5.1.normal.js @@ -1,3 +1,5 @@ // @noEmit: true // @Filename: /a.ts export { }; +// @Filename: /b.ts +export { }; diff --git a/crates/swc/tests/tsc-references/circular1_es5.2.minified.js b/crates/swc/tests/tsc-references/circular1_es5.2.minified.js index 2234b9cae16d..98fdd3114198 100644 --- a/crates/swc/tests/tsc-references/circular1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/circular1_es5.2.minified.js @@ -1 +1,2 @@ export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/circular2_es2015.1.normal.js b/crates/swc/tests/tsc-references/circular2_es2015.1.normal.js index a1fec531316c..5fbe9c3e04f1 100644 --- a/crates/swc/tests/tsc-references/circular2_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/circular2_es2015.1.normal.js @@ -1,3 +1,5 @@ // @noEmit: true // @Filename: /a.ts export { }; +// @Filename: /b.ts +export { }; diff --git a/crates/swc/tests/tsc-references/circular2_es2015.2.minified.js b/crates/swc/tests/tsc-references/circular2_es2015.2.minified.js index 2234b9cae16d..98fdd3114198 100644 --- a/crates/swc/tests/tsc-references/circular2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/circular2_es2015.2.minified.js @@ -1 +1,2 @@ export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/circular2_es5.1.normal.js b/crates/swc/tests/tsc-references/circular2_es5.1.normal.js index a1fec531316c..5fbe9c3e04f1 100644 --- a/crates/swc/tests/tsc-references/circular2_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/circular2_es5.1.normal.js @@ -1,3 +1,5 @@ // @noEmit: true // @Filename: /a.ts export { }; +// @Filename: /b.ts +export { }; diff --git a/crates/swc/tests/tsc-references/circular2_es5.2.minified.js b/crates/swc/tests/tsc-references/circular2_es5.2.minified.js index 2234b9cae16d..98fdd3114198 100644 --- a/crates/swc/tests/tsc-references/circular2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/circular2_es5.2.minified.js @@ -1 +1,2 @@ export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/circular3_es2015.1.normal.js b/crates/swc/tests/tsc-references/circular3_es2015.1.normal.js index a1fec531316c..5fbe9c3e04f1 100644 --- a/crates/swc/tests/tsc-references/circular3_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/circular3_es2015.1.normal.js @@ -1,3 +1,5 @@ // @noEmit: true // @Filename: /a.ts export { }; +// @Filename: /b.ts +export { }; diff --git a/crates/swc/tests/tsc-references/circular3_es2015.2.minified.js b/crates/swc/tests/tsc-references/circular3_es2015.2.minified.js index 2234b9cae16d..98fdd3114198 100644 --- a/crates/swc/tests/tsc-references/circular3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/circular3_es2015.2.minified.js @@ -1 +1,2 @@ export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/circular3_es5.1.normal.js b/crates/swc/tests/tsc-references/circular3_es5.1.normal.js index a1fec531316c..5fbe9c3e04f1 100644 --- a/crates/swc/tests/tsc-references/circular3_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/circular3_es5.1.normal.js @@ -1,3 +1,5 @@ // @noEmit: true // @Filename: /a.ts export { }; +// @Filename: /b.ts +export { }; diff --git a/crates/swc/tests/tsc-references/circular3_es5.2.minified.js b/crates/swc/tests/tsc-references/circular3_es5.2.minified.js index 2234b9cae16d..98fdd3114198 100644 --- a/crates/swc/tests/tsc-references/circular3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/circular3_es5.2.minified.js @@ -1 +1,2 @@ export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/circular4_es2015.1.normal.js b/crates/swc/tests/tsc-references/circular4_es2015.1.normal.js index a1fec531316c..5fbe9c3e04f1 100644 --- a/crates/swc/tests/tsc-references/circular4_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/circular4_es2015.1.normal.js @@ -1,3 +1,5 @@ // @noEmit: true // @Filename: /a.ts export { }; +// @Filename: /b.ts +export { }; diff --git a/crates/swc/tests/tsc-references/circular4_es2015.2.minified.js b/crates/swc/tests/tsc-references/circular4_es2015.2.minified.js index 2234b9cae16d..98fdd3114198 100644 --- a/crates/swc/tests/tsc-references/circular4_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/circular4_es2015.2.minified.js @@ -1 +1,2 @@ export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/circular4_es5.1.normal.js b/crates/swc/tests/tsc-references/circular4_es5.1.normal.js index a1fec531316c..5fbe9c3e04f1 100644 --- a/crates/swc/tests/tsc-references/circular4_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/circular4_es5.1.normal.js @@ -1,3 +1,5 @@ // @noEmit: true // @Filename: /a.ts export { }; +// @Filename: /b.ts +export { }; diff --git a/crates/swc/tests/tsc-references/circular4_es5.2.minified.js b/crates/swc/tests/tsc-references/circular4_es5.2.minified.js index 2234b9cae16d..98fdd3114198 100644 --- a/crates/swc/tests/tsc-references/circular4_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/circular4_es5.2.minified.js @@ -1 +1,2 @@ export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/circularReference_es2015.1.normal.js b/crates/swc/tests/tsc-references/circularReference_es2015.1.normal.js index e818d5cfdb08..6047024ed49f 100644 --- a/crates/swc/tests/tsc-references/circularReference_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/circularReference_es2015.1.normal.js @@ -13,6 +13,7 @@ export var M1; })(M1 || (M1 = {})); // @Filename: foo2.ts const foo1 = require('./foo1'); +export var M1; (function(M11) { class C1 { constructor(){ diff --git a/crates/swc/tests/tsc-references/circularReference_es2015.2.minified.js b/crates/swc/tests/tsc-references/circularReference_es2015.2.minified.js index 78b357108159..3f60b99cdb84 100644 --- a/crates/swc/tests/tsc-references/circularReference_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/circularReference_es2015.2.minified.js @@ -6,6 +6,7 @@ export var M1; } }; let foo1 = require('./foo1'); +export var M1; (M1 || (M1 = {})).C1 = class { constructor(){ this.m1 = new foo1.M1.C1(), this.m1.y = 10, this.m1.x = 20; diff --git a/crates/swc/tests/tsc-references/circularReference_es5.1.normal.js b/crates/swc/tests/tsc-references/circularReference_es5.1.normal.js index e007d36f2b6a..de00a47071a7 100644 --- a/crates/swc/tests/tsc-references/circularReference_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/circularReference_es5.1.normal.js @@ -13,7 +13,9 @@ export var M1; M1.C1 = C1; })(M1 || (M1 = {})); // @Filename: foo2.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var foo1 = require("./foo1"); +export var M1; (function(M11) { var C1 = function C1() { "use strict"; diff --git a/crates/swc/tests/tsc-references/circularReference_es5.2.minified.js b/crates/swc/tests/tsc-references/circularReference_es5.2.minified.js index 5170ced53d0b..2a3ac0268ec5 100644 --- a/crates/swc/tests/tsc-references/circularReference_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/circularReference_es5.2.minified.js @@ -8,7 +8,9 @@ export var M1; }; M1.C1 = C1; }(M1 || (M1 = {})); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var foo1 = require("./foo1"); +export var M1; !function(M11) { var C1 = function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/cjsImportInES2015_es2015.1.normal.js b/crates/swc/tests/tsc-references/cjsImportInES2015_es2015.1.normal.js index 96287ea9980e..6a456d7d1a4c 100644 --- a/crates/swc/tests/tsc-references/cjsImportInES2015_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/cjsImportInES2015_es2015.1.normal.js @@ -1,6 +1,8 @@ // @module: es2015 // @moduleResolution: node // @Filename: /project/node_modules/cjs-dep/index.d.ts -function handleError(err) {} module.exports = SpecialError; export { }; +// @Filename: /project/index.ts +function handleError(err) {} +export { }; diff --git a/crates/swc/tests/tsc-references/cjsImportInES2015_es2015.2.minified.js b/crates/swc/tests/tsc-references/cjsImportInES2015_es2015.2.minified.js index f824ebdd3716..44196ffc1f45 100644 --- a/crates/swc/tests/tsc-references/cjsImportInES2015_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/cjsImportInES2015_es2015.2.minified.js @@ -1,2 +1,3 @@ module.exports = SpecialError; export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/cjsImportInES2015_es5.1.normal.js b/crates/swc/tests/tsc-references/cjsImportInES2015_es5.1.normal.js index 96287ea9980e..6a456d7d1a4c 100644 --- a/crates/swc/tests/tsc-references/cjsImportInES2015_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/cjsImportInES2015_es5.1.normal.js @@ -1,6 +1,8 @@ // @module: es2015 // @moduleResolution: node // @Filename: /project/node_modules/cjs-dep/index.d.ts -function handleError(err) {} module.exports = SpecialError; export { }; +// @Filename: /project/index.ts +function handleError(err) {} +export { }; diff --git a/crates/swc/tests/tsc-references/cjsImportInES2015_es5.2.minified.js b/crates/swc/tests/tsc-references/cjsImportInES2015_es5.2.minified.js index f824ebdd3716..44196ffc1f45 100644 --- a/crates/swc/tests/tsc-references/cjsImportInES2015_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/cjsImportInES2015_es5.2.minified.js @@ -1,2 +1,3 @@ module.exports = SpecialError; export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/classAbstractMergedDeclaration_es2015.1.normal.js b/crates/swc/tests/tsc-references/classAbstractMergedDeclaration_es2015.1.normal.js index d1eabdaa9ea5..6784a774766e 100644 --- a/crates/swc/tests/tsc-references/classAbstractMergedDeclaration_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/classAbstractMergedDeclaration_es2015.1.normal.js @@ -1,26 +1,40 @@ -class CM { -} -class MC { -} -class CI { -} -class IC { -} -class CC1 { -} -class CC1 { -} -class CC2 { -} -class CC2 { -} -new CM; -new MC; -new CI; -new IC; -new CC1; -new CC2; -new DCI; -new DIC; -new DCC1; -new DCC2; +//! +//! x the name `CC1` is defined multiple times +//! ,-[13:1] +//! 13 | abstract class CC1 {} +//! : ^|^ +//! : `-- previous definition of `CC1` here +//! 14 | class CC1 {} +//! : ^|^ +//! : `-- `CC1` redefined here +//! `---- +//! +//! x the name `CC2` is defined multiple times +//! ,-[16:1] +//! 16 | class CC2 {} +//! : ^|^ +//! : `-- previous definition of `CC2` here +//! 17 | abstract class CC2 {} +//! : ^|^ +//! : `-- `CC2` redefined here +//! `---- +//! +//! x the name `DCC1` is defined multiple times +//! ,-[25:1] +//! 25 | declare abstract class DCC1 {} +//! : ^^|^ +//! : `-- previous definition of `DCC1` here +//! 26 | declare class DCC1 {} +//! : ^^|^ +//! : `-- `DCC1` redefined here +//! `---- +//! +//! x the name `DCC2` is defined multiple times +//! ,-[28:1] +//! 28 | declare class DCC2 {} +//! : ^^|^ +//! : `-- previous definition of `DCC2` here +//! 29 | declare abstract class DCC2 {} +//! : ^^|^ +//! : `-- `DCC2` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/classAbstractMergedDeclaration_es2015.2.minified.js b/crates/swc/tests/tsc-references/classAbstractMergedDeclaration_es2015.2.minified.js index a56539ace528..6784a774766e 100644 --- a/crates/swc/tests/tsc-references/classAbstractMergedDeclaration_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/classAbstractMergedDeclaration_es2015.2.minified.js @@ -1,13 +1,40 @@ -class CC1 { -} -class CC1 { -} -class CC2 { -} -class CC2 { -} -new class { -}, new class { -}, new class { -}, new class { -}, new CC1, new CC2, new DCI, new DIC, new DCC1, new DCC2; +//! +//! x the name `CC1` is defined multiple times +//! ,-[13:1] +//! 13 | abstract class CC1 {} +//! : ^|^ +//! : `-- previous definition of `CC1` here +//! 14 | class CC1 {} +//! : ^|^ +//! : `-- `CC1` redefined here +//! `---- +//! +//! x the name `CC2` is defined multiple times +//! ,-[16:1] +//! 16 | class CC2 {} +//! : ^|^ +//! : `-- previous definition of `CC2` here +//! 17 | abstract class CC2 {} +//! : ^|^ +//! : `-- `CC2` redefined here +//! `---- +//! +//! x the name `DCC1` is defined multiple times +//! ,-[25:1] +//! 25 | declare abstract class DCC1 {} +//! : ^^|^ +//! : `-- previous definition of `DCC1` here +//! 26 | declare class DCC1 {} +//! : ^^|^ +//! : `-- `DCC1` redefined here +//! `---- +//! +//! x the name `DCC2` is defined multiple times +//! ,-[28:1] +//! 28 | declare class DCC2 {} +//! : ^^|^ +//! : `-- previous definition of `DCC2` here +//! 29 | declare abstract class DCC2 {} +//! : ^^|^ +//! : `-- `DCC2` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/classAbstractMergedDeclaration_es5.1.normal.js b/crates/swc/tests/tsc-references/classAbstractMergedDeclaration_es5.1.normal.js index 0c313c709662..6784a774766e 100644 --- a/crates/swc/tests/tsc-references/classAbstractMergedDeclaration_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/classAbstractMergedDeclaration_es5.1.normal.js @@ -1,43 +1,40 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var CM = function CM() { - "use strict"; - _class_call_check(this, CM); -}; -var MC = function MC() { - "use strict"; - _class_call_check(this, MC); -}; -var CI = function CI() { - "use strict"; - _class_call_check(this, CI); -}; -var IC = function IC() { - "use strict"; - _class_call_check(this, IC); -}; -var CC1 = function CC1() { - "use strict"; - _class_call_check(this, CC1); -}; -var CC1 = function CC1() { - "use strict"; - _class_call_check(this, CC1); -}; -var CC2 = function CC2() { - "use strict"; - _class_call_check(this, CC2); -}; -var CC2 = function CC2() { - "use strict"; - _class_call_check(this, CC2); -}; -new CM; -new MC; -new CI; -new IC; -new CC1; -new CC2; -new DCI; -new DIC; -new DCC1; -new DCC2; +//! +//! x the name `CC1` is defined multiple times +//! ,-[13:1] +//! 13 | abstract class CC1 {} +//! : ^|^ +//! : `-- previous definition of `CC1` here +//! 14 | class CC1 {} +//! : ^|^ +//! : `-- `CC1` redefined here +//! `---- +//! +//! x the name `CC2` is defined multiple times +//! ,-[16:1] +//! 16 | class CC2 {} +//! : ^|^ +//! : `-- previous definition of `CC2` here +//! 17 | abstract class CC2 {} +//! : ^|^ +//! : `-- `CC2` redefined here +//! `---- +//! +//! x the name `DCC1` is defined multiple times +//! ,-[25:1] +//! 25 | declare abstract class DCC1 {} +//! : ^^|^ +//! : `-- previous definition of `DCC1` here +//! 26 | declare class DCC1 {} +//! : ^^|^ +//! : `-- `DCC1` redefined here +//! `---- +//! +//! x the name `DCC2` is defined multiple times +//! ,-[28:1] +//! 28 | declare class DCC2 {} +//! : ^^|^ +//! : `-- previous definition of `DCC2` here +//! 29 | declare abstract class DCC2 {} +//! : ^^|^ +//! : `-- `DCC2` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/classAbstractMergedDeclaration_es5.2.minified.js b/crates/swc/tests/tsc-references/classAbstractMergedDeclaration_es5.2.minified.js index 1c517ecaa310..6784a774766e 100644 --- a/crates/swc/tests/tsc-references/classAbstractMergedDeclaration_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/classAbstractMergedDeclaration_es5.2.minified.js @@ -1,27 +1,40 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var CM = function() { - "use strict"; - _class_call_check(this, CM); -}, MC = function() { - "use strict"; - _class_call_check(this, MC); -}, CI = function() { - "use strict"; - _class_call_check(this, CI); -}, IC = function() { - "use strict"; - _class_call_check(this, IC); -}, CC1 = function() { - "use strict"; - _class_call_check(this, CC1); -}, CC1 = function() { - "use strict"; - _class_call_check(this, CC1); -}, CC2 = function() { - "use strict"; - _class_call_check(this, CC2); -}, CC2 = function() { - "use strict"; - _class_call_check(this, CC2); -}; -new CM, new MC, new CI, new IC, new CC1, new CC2, new DCI, new DIC, new DCC1, new DCC2; +//! +//! x the name `CC1` is defined multiple times +//! ,-[13:1] +//! 13 | abstract class CC1 {} +//! : ^|^ +//! : `-- previous definition of `CC1` here +//! 14 | class CC1 {} +//! : ^|^ +//! : `-- `CC1` redefined here +//! `---- +//! +//! x the name `CC2` is defined multiple times +//! ,-[16:1] +//! 16 | class CC2 {} +//! : ^|^ +//! : `-- previous definition of `CC2` here +//! 17 | abstract class CC2 {} +//! : ^|^ +//! : `-- `CC2` redefined here +//! `---- +//! +//! x the name `DCC1` is defined multiple times +//! ,-[25:1] +//! 25 | declare abstract class DCC1 {} +//! : ^^|^ +//! : `-- previous definition of `DCC1` here +//! 26 | declare class DCC1 {} +//! : ^^|^ +//! : `-- `DCC1` redefined here +//! `---- +//! +//! x the name `DCC2` is defined multiple times +//! ,-[28:1] +//! 28 | declare class DCC2 {} +//! : ^^|^ +//! : `-- previous definition of `DCC2` here +//! 29 | declare abstract class DCC2 {} +//! : ^^|^ +//! : `-- `DCC2` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/classAndVariableWithSameName_es2015.1.normal.js b/crates/swc/tests/tsc-references/classAndVariableWithSameName_es2015.1.normal.js index 5a615917b015..4367816112f4 100644 --- a/crates/swc/tests/tsc-references/classAndVariableWithSameName_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/classAndVariableWithSameName_es2015.1.normal.js @@ -1,9 +1,23 @@ -class C { -} // error -var C = ''; // error -var M; -(function(M) { - class D { - } - var D = 1; // error -})(M || (M = {})); +//! +//! x the name `C` is defined multiple times +//! ,-[1:1] +//! 1 | class C { foo: string; } // error +//! : | +//! : `-- previous definition of `C` here +//! 2 | var C = ''; // error +//! : | +//! : `-- `C` redefined here +//! `---- +//! +//! x the name `D` is defined multiple times +//! ,-[5:5] +//! 5 | class D { // error +//! : | +//! : `-- previous definition of `D` here +//! 6 | bar: string; +//! 7 | } +//! 8 | +//! 9 | var D = 1; // error +//! : | +//! : `-- `D` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/classAndVariableWithSameName_es2015.2.minified.js b/crates/swc/tests/tsc-references/classAndVariableWithSameName_es2015.2.minified.js index cf77a4b72fa5..4367816112f4 100644 --- a/crates/swc/tests/tsc-references/classAndVariableWithSameName_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/classAndVariableWithSameName_es2015.2.minified.js @@ -1,2 +1,23 @@ -var M; -M || (M = {}); +//! +//! x the name `C` is defined multiple times +//! ,-[1:1] +//! 1 | class C { foo: string; } // error +//! : | +//! : `-- previous definition of `C` here +//! 2 | var C = ''; // error +//! : | +//! : `-- `C` redefined here +//! `---- +//! +//! x the name `D` is defined multiple times +//! ,-[5:5] +//! 5 | class D { // error +//! : | +//! : `-- previous definition of `D` here +//! 6 | bar: string; +//! 7 | } +//! 8 | +//! 9 | var D = 1; // error +//! : | +//! : `-- `D` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/classAndVariableWithSameName_es5.1.normal.js b/crates/swc/tests/tsc-references/classAndVariableWithSameName_es5.1.normal.js index fa132213ae49..4367816112f4 100644 --- a/crates/swc/tests/tsc-references/classAndVariableWithSameName_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/classAndVariableWithSameName_es5.1.normal.js @@ -1,15 +1,23 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var C = function C() { - "use strict"; - _class_call_check(this, C); -} // error -; -var C = ""; // error -var M; -(function(M) { - var D = function D() { - "use strict"; - _class_call_check(this, D); - }; - var D = 1; // error -})(M || (M = {})); +//! +//! x the name `C` is defined multiple times +//! ,-[1:1] +//! 1 | class C { foo: string; } // error +//! : | +//! : `-- previous definition of `C` here +//! 2 | var C = ''; // error +//! : | +//! : `-- `C` redefined here +//! `---- +//! +//! x the name `D` is defined multiple times +//! ,-[5:5] +//! 5 | class D { // error +//! : | +//! : `-- previous definition of `D` here +//! 6 | bar: string; +//! 7 | } +//! 8 | +//! 9 | var D = 1; // error +//! : | +//! : `-- `D` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/classAndVariableWithSameName_es5.2.minified.js b/crates/swc/tests/tsc-references/classAndVariableWithSameName_es5.2.minified.js index a4fca60a8088..4367816112f4 100644 --- a/crates/swc/tests/tsc-references/classAndVariableWithSameName_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/classAndVariableWithSameName_es5.2.minified.js @@ -1,3 +1,23 @@ -var M; -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -M || (M = {}); +//! +//! x the name `C` is defined multiple times +//! ,-[1:1] +//! 1 | class C { foo: string; } // error +//! : | +//! : `-- previous definition of `C` here +//! 2 | var C = ''; // error +//! : | +//! : `-- `C` redefined here +//! `---- +//! +//! x the name `D` is defined multiple times +//! ,-[5:5] +//! 5 | class D { // error +//! : | +//! : `-- previous definition of `D` here +//! 6 | bar: string; +//! 7 | } +//! 8 | +//! 9 | var D = 1; // error +//! : | +//! : `-- `D` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/classCanExtendConstructorFunction_es2015.2.minified.js b/crates/swc/tests/tsc-references/classCanExtendConstructorFunction_es2015.2.minified.js index 0ff83813be94..b1e07ff28d49 100644 --- a/crates/swc/tests/tsc-references/classCanExtendConstructorFunction_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/classCanExtendConstructorFunction_es2015.2.minified.js @@ -16,18 +16,21 @@ var db = new class extends Wagon { } }(); db.numberOxen = db.foonly; -var c = new class extends Wagon { +class Drakkhen extends Dragon { +} +class Conestoga extends Wagon { static circle(others) { return others.length; } constructor(drunkOO){ super('nope'), this.drunkOO = drunkOO; } -}(!0); +} +var c = new Conestoga(!0); +c.drunkOO, c.numberOxen; function Soup(flavour) { this.flavour = flavour; } -c.drunkOO, c.numberOxen; class Chowder extends Soup { log() { return this.flavour; diff --git a/crates/swc/tests/tsc-references/classCanExtendConstructorFunction_es5.1.normal.js b/crates/swc/tests/tsc-references/classCanExtendConstructorFunction_es5.1.normal.js index 3614f4d937bf..eeae33a1818d 100644 --- a/crates/swc/tests/tsc-references/classCanExtendConstructorFunction_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/classCanExtendConstructorFunction_es5.1.normal.js @@ -55,9 +55,9 @@ var Sql = /*#__PURE__*/ function(Wagon) { var db = new Sql(); db.numberOxen = db.foonly; // error, can't extend a TS constructor function -var Drakkhen = /*#__PURE__*/ function(Dragon) { +var Drakkhen = /*#__PURE__*/ function(Dragon1) { "use strict"; - _inherits(Drakkhen, Dragon); + _inherits(Drakkhen, Dragon1); var _super = _create_super(Drakkhen); function Drakkhen() { _class_call_check(this, Drakkhen); @@ -68,7 +68,10 @@ var Drakkhen = /*#__PURE__*/ function(Dragon) { // @Filename: second.ts /** * @constructor - */ function Dragon(numberEaten) { + */ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +function Dragon(numberEaten) { this.numberEaten = numberEaten; } // error! @@ -83,9 +86,9 @@ var Firedrake = /*#__PURE__*/ function(Dragon) { return Firedrake; }(Dragon); // ok -var Conestoga = /*#__PURE__*/ function(Wagon) { +var Conestoga = /*#__PURE__*/ function(Wagon1) { "use strict"; - _inherits(Conestoga, Wagon); + _inherits(Conestoga, Wagon1); var _super = _create_super(Conestoga); function Conestoga(drunkOO) { _class_call_check(this, Conestoga); @@ -107,7 +110,10 @@ c.numberOxen; /** * @template T * @param {T} flavour - */ function Soup(flavour) { + */ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +function Soup(flavour) { this.flavour = flavour; } /** @extends {Soup<{ claim: "ignorant" | "malicious" }>} */ var Chowder = /*#__PURE__*/ function(Soup) { diff --git a/crates/swc/tests/tsc-references/classCanExtendConstructorFunction_es5.2.minified.js b/crates/swc/tests/tsc-references/classCanExtendConstructorFunction_es5.2.minified.js index 08b213f8cae2..66c0bffb705d 100644 --- a/crates/swc/tests/tsc-references/classCanExtendConstructorFunction_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/classCanExtendConstructorFunction_es5.2.minified.js @@ -27,18 +27,18 @@ var Sql = function(Wagon) { }, Sql; }(Wagon), db = new Sql(); db.numberOxen = db.foonly; -var Drakkhen = function(Dragon) { +var Drakkhen = function(Dragon1) { "use strict"; - _inherits(Drakkhen, Dragon); + _inherits(Drakkhen, Dragon1); var _super = _create_super(Drakkhen); function Drakkhen() { return _class_call_check(this, Drakkhen), _super.apply(this, arguments); } return Drakkhen; }(Dragon); -function Dragon(numberEaten) { - this.numberEaten = numberEaten; -} +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var Firedrake = function(Dragon) { "use strict"; _inherits(Firedrake, Dragon); @@ -47,9 +47,11 @@ var Firedrake = function(Dragon) { return _class_call_check(this, Firedrake), _super.call(this); } return Firedrake; -}(Dragon), Conestoga = function(Wagon) { +}(function(numberEaten) { + this.numberEaten = numberEaten; +}), Conestoga = function(Wagon1) { "use strict"; - _inherits(Conestoga, Wagon); + _inherits(Conestoga, Wagon1); var _super = _create_super(Conestoga); function Conestoga(drunkOO) { var _this; @@ -59,10 +61,13 @@ var Firedrake = function(Dragon) { return others.length; }, Conestoga; }(Wagon), c = new Conestoga(!0); +c.drunkOO, c.numberOxen; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; function Soup(flavour) { this.flavour = flavour; } -c.drunkOO, c.numberOxen; var Chowder = function(Soup) { "use strict"; _inherits(Chowder, Soup); diff --git a/crates/swc/tests/tsc-references/classExtendingOptionalChain_es2015.1.normal.js b/crates/swc/tests/tsc-references/classExtendingOptionalChain_es2015.1.normal.js new file mode 100644 index 000000000000..e1ae68003d2b --- /dev/null +++ b/crates/swc/tests/tsc-references/classExtendingOptionalChain_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x An interface can only extend an identifier/qualified-name with optional type arguments. +//! ,---- +//! 9 | class C2 implements A?.B {} +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/classExtendingOptionalChain_es2015.2.minified.js b/crates/swc/tests/tsc-references/classExtendingOptionalChain_es2015.2.minified.js new file mode 100644 index 000000000000..e1ae68003d2b --- /dev/null +++ b/crates/swc/tests/tsc-references/classExtendingOptionalChain_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x An interface can only extend an identifier/qualified-name with optional type arguments. +//! ,---- +//! 9 | class C2 implements A?.B {} +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/classExtendingOptionalChain_es5.1.normal.js b/crates/swc/tests/tsc-references/classExtendingOptionalChain_es5.1.normal.js new file mode 100644 index 000000000000..e1ae68003d2b --- /dev/null +++ b/crates/swc/tests/tsc-references/classExtendingOptionalChain_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x An interface can only extend an identifier/qualified-name with optional type arguments. +//! ,---- +//! 9 | class C2 implements A?.B {} +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/classExtendingOptionalChain_es5.2.minified.js b/crates/swc/tests/tsc-references/classExtendingOptionalChain_es5.2.minified.js new file mode 100644 index 000000000000..e1ae68003d2b --- /dev/null +++ b/crates/swc/tests/tsc-references/classExtendingOptionalChain_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x An interface can only extend an identifier/qualified-name with optional type arguments. +//! ,---- +//! 9 | class C2 implements A?.B {} +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/classExtendsItselfIndirectly3_es5.1.normal.js b/crates/swc/tests/tsc-references/classExtendsItselfIndirectly3_es5.1.normal.js index d12c805b9d05..cb248578b030 100644 --- a/crates/swc/tests/tsc-references/classExtendsItselfIndirectly3_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/classExtendsItselfIndirectly3_es5.1.normal.js @@ -2,9 +2,9 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; -var C = /*#__PURE__*/ function(E) { +var C = /*#__PURE__*/ function(E1) { "use strict"; - _inherits(C, E); + _inherits(C, E1); var _super = _create_super(C); function C() { _class_call_check(this, C); @@ -14,9 +14,12 @@ var C = /*#__PURE__*/ function(E) { } // error (E); // @Filename: classExtendsItselfIndirectly_file2.ts -var D = /*#__PURE__*/ function(C) { +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var D = /*#__PURE__*/ function(C1) { "use strict"; - _inherits(D, C); + _inherits(D, C1); var _super = _create_super(D); function D() { _class_call_check(this, D); @@ -25,9 +28,12 @@ var D = /*#__PURE__*/ function(C) { return D; }(C); // @Filename: classExtendsItselfIndirectly_file3.ts -var E = /*#__PURE__*/ function(D) { +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var E = /*#__PURE__*/ function(D1) { "use strict"; - _inherits(E, D); + _inherits(E, D1); var _super = _create_super(E); function E() { _class_call_check(this, E); @@ -36,9 +42,12 @@ var E = /*#__PURE__*/ function(D) { return E; }(D); // @Filename: classExtendsItselfIndirectly_file4.ts -var C2 = /*#__PURE__*/ function(E2) { +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var C2 = /*#__PURE__*/ function(E21) { "use strict"; - _inherits(C2, E2); + _inherits(C2, E21); var _super = _create_super(C2); function C2() { _class_call_check(this, C2); @@ -48,9 +57,12 @@ var C2 = /*#__PURE__*/ function(E2) { } // error (E2); // @Filename: classExtendsItselfIndirectly_file5.ts -var D2 = /*#__PURE__*/ function(C2) { +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var D2 = /*#__PURE__*/ function(C21) { "use strict"; - _inherits(D2, C2); + _inherits(D2, C21); var _super = _create_super(D2); function D2() { _class_call_check(this, D2); @@ -59,9 +71,12 @@ var D2 = /*#__PURE__*/ function(C2) { return D2; }(C2); // @Filename: classExtendsItselfIndirectly_file6.ts -var E2 = /*#__PURE__*/ function(D2) { +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var E2 = /*#__PURE__*/ function(D21) { "use strict"; - _inherits(E2, D2); + _inherits(E2, D21); var _super = _create_super(E2); function E2() { _class_call_check(this, E2); diff --git a/crates/swc/tests/tsc-references/classExtendsItselfIndirectly3_es5.2.minified.js b/crates/swc/tests/tsc-references/classExtendsItselfIndirectly3_es5.2.minified.js index 56fd24b7fa28..a76ae4f2d71b 100644 --- a/crates/swc/tests/tsc-references/classExtendsItselfIndirectly3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/classExtendsItselfIndirectly3_es5.2.minified.js @@ -1,49 +1,69 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; -var C = function(E) { +var C = function(E1) { "use strict"; - _inherits(C, E); + _inherits(C, E1); var _super = _create_super(C); function C() { return _class_call_check(this, C), _super.apply(this, arguments); } return C; -}(E), D = function(C) { +}(E); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var D = function(C1) { "use strict"; - _inherits(D, C); + _inherits(D, C1); var _super = _create_super(D); function D() { return _class_call_check(this, D), _super.apply(this, arguments); } return D; -}(C), E = function(D) { +}(C); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var E = function(D1) { "use strict"; - _inherits(E, D); + _inherits(E, D1); var _super = _create_super(E); function E() { return _class_call_check(this, E), _super.apply(this, arguments); } return E; -}(D), C2 = function(E2) { +}(D); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var C2 = function(E21) { "use strict"; - _inherits(C2, E2); + _inherits(C2, E21); var _super = _create_super(C2); function C2() { return _class_call_check(this, C2), _super.apply(this, arguments); } return C2; -}(E2), D2 = function(C2) { +}(E2); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var D2 = function(C21) { "use strict"; - _inherits(D2, C2); + _inherits(D2, C21); var _super = _create_super(D2); function D2() { return _class_call_check(this, D2), _super.apply(this, arguments); } return D2; -}(C2), E2 = function(D2) { +}(C2); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var E2 = function(D21) { "use strict"; - _inherits(E2, D2); + _inherits(E2, D21); var _super = _create_super(E2); function E2() { return _class_call_check(this, E2), _super.apply(this, arguments); diff --git a/crates/swc/tests/tsc-references/classWithPredefinedTypesAsNames_es2015.1.normal.js b/crates/swc/tests/tsc-references/classWithPredefinedTypesAsNames_es2015.1.normal.js new file mode 100644 index 000000000000..7be68e4199bc --- /dev/null +++ b/crates/swc/tests/tsc-references/classWithPredefinedTypesAsNames_es2015.1.normal.js @@ -0,0 +1,30 @@ +//! +//! x Invalid class name +//! ,---- +//! 3 | class any { } +//! : ^^^ +//! `---- +//! +//! x Invalid class name +//! ,---- +//! 4 | class number { } +//! : ^^^^^^ +//! `---- +//! +//! x Invalid class name +//! ,---- +//! 5 | class boolean { } +//! : ^^^^^^^ +//! `---- +//! +//! x Invalid class name +//! ,---- +//! 6 | class string { } +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/classWithPredefinedTypesAsNames_es2015.2.minified.js b/crates/swc/tests/tsc-references/classWithPredefinedTypesAsNames_es2015.2.minified.js new file mode 100644 index 000000000000..7be68e4199bc --- /dev/null +++ b/crates/swc/tests/tsc-references/classWithPredefinedTypesAsNames_es2015.2.minified.js @@ -0,0 +1,30 @@ +//! +//! x Invalid class name +//! ,---- +//! 3 | class any { } +//! : ^^^ +//! `---- +//! +//! x Invalid class name +//! ,---- +//! 4 | class number { } +//! : ^^^^^^ +//! `---- +//! +//! x Invalid class name +//! ,---- +//! 5 | class boolean { } +//! : ^^^^^^^ +//! `---- +//! +//! x Invalid class name +//! ,---- +//! 6 | class string { } +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/classWithPredefinedTypesAsNames_es5.1.normal.js b/crates/swc/tests/tsc-references/classWithPredefinedTypesAsNames_es5.1.normal.js new file mode 100644 index 000000000000..7be68e4199bc --- /dev/null +++ b/crates/swc/tests/tsc-references/classWithPredefinedTypesAsNames_es5.1.normal.js @@ -0,0 +1,30 @@ +//! +//! x Invalid class name +//! ,---- +//! 3 | class any { } +//! : ^^^ +//! `---- +//! +//! x Invalid class name +//! ,---- +//! 4 | class number { } +//! : ^^^^^^ +//! `---- +//! +//! x Invalid class name +//! ,---- +//! 5 | class boolean { } +//! : ^^^^^^^ +//! `---- +//! +//! x Invalid class name +//! ,---- +//! 6 | class string { } +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/classWithPredefinedTypesAsNames_es5.2.minified.js b/crates/swc/tests/tsc-references/classWithPredefinedTypesAsNames_es5.2.minified.js new file mode 100644 index 000000000000..7be68e4199bc --- /dev/null +++ b/crates/swc/tests/tsc-references/classWithPredefinedTypesAsNames_es5.2.minified.js @@ -0,0 +1,30 @@ +//! +//! x Invalid class name +//! ,---- +//! 3 | class any { } +//! : ^^^ +//! `---- +//! +//! x Invalid class name +//! ,---- +//! 4 | class number { } +//! : ^^^^^^ +//! `---- +//! +//! x Invalid class name +//! ,---- +//! 5 | class boolean { } +//! : ^^^^^^^ +//! `---- +//! +//! x Invalid class name +//! ,---- +//! 6 | class string { } +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/classWithTwoConstructorDefinitions_es2015.1.normal.js b/crates/swc/tests/tsc-references/classWithTwoConstructorDefinitions_es2015.1.normal.js index 0d8d9cf90cf0..30cabe435795 100644 --- a/crates/swc/tests/tsc-references/classWithTwoConstructorDefinitions_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/classWithTwoConstructorDefinitions_es2015.1.normal.js @@ -1,6 +1,18 @@ -class C { - constructor(x){} -} -class D { - constructor(x, y){} -} +//! +//! x A class can only have one constructor +//! ,---- +//! 3 | constructor(x) { } // error +//! : ^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A class can only have one constructor +//! ,---- +//! 8 | constructor(x: T, y: T) { } // error +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/classWithTwoConstructorDefinitions_es2015.2.minified.js b/crates/swc/tests/tsc-references/classWithTwoConstructorDefinitions_es2015.2.minified.js new file mode 100644 index 000000000000..30cabe435795 --- /dev/null +++ b/crates/swc/tests/tsc-references/classWithTwoConstructorDefinitions_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x A class can only have one constructor +//! ,---- +//! 3 | constructor(x) { } // error +//! : ^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A class can only have one constructor +//! ,---- +//! 8 | constructor(x: T, y: T) { } // error +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/classWithTwoConstructorDefinitions_es5.1.normal.js b/crates/swc/tests/tsc-references/classWithTwoConstructorDefinitions_es5.1.normal.js index 2fcac915a6fe..30cabe435795 100644 --- a/crates/swc/tests/tsc-references/classWithTwoConstructorDefinitions_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/classWithTwoConstructorDefinitions_es5.1.normal.js @@ -1,9 +1,18 @@ -import * as swcHelpers from "@swc/helpers"; -var C = function C(x) { - "use strict"; - swcHelpers.classCallCheck(this, C); -}; -var D = function D(x, y) { - "use strict"; - swcHelpers.classCallCheck(this, D); -}; +//! +//! x A class can only have one constructor +//! ,---- +//! 3 | constructor(x) { } // error +//! : ^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A class can only have one constructor +//! ,---- +//! 8 | constructor(x: T, y: T) { } // error +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/classWithTwoConstructorDefinitions_es5.2.minified.js b/crates/swc/tests/tsc-references/classWithTwoConstructorDefinitions_es5.2.minified.js index 4134f8d6bf9e..30cabe435795 100644 --- a/crates/swc/tests/tsc-references/classWithTwoConstructorDefinitions_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/classWithTwoConstructorDefinitions_es5.2.minified.js @@ -1,8 +1,18 @@ -import * as swcHelpers from "@swc/helpers"; -var C = function(x) { - "use strict"; - swcHelpers.classCallCheck(this, C); -}, D = function(x, y) { - "use strict"; - swcHelpers.classCallCheck(this, D); -}; +//! +//! x A class can only have one constructor +//! ,---- +//! 3 | constructor(x) { } // error +//! : ^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A class can only have one constructor +//! ,---- +//! 8 | constructor(x: T, y: T) { } // error +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/commonJSAliasedExport_es5.2.minified.js b/crates/swc/tests/tsc-references/commonJSAliasedExport_es5.2.minified.js index 73a8b065c35b..53677d732bbb 100644 --- a/crates/swc/tests/tsc-references/commonJSAliasedExport_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/commonJSAliasedExport_es5.2.minified.js @@ -5,5 +5,4 @@ function funky(declaration) { return !1; } module.exports = donkey, module.exports.funky = funky; -var funky = require("./commonJSAliasedExport").funky; -funky(1); +(0, require("./commonJSAliasedExport").funky)(1); diff --git a/crates/swc/tests/tsc-references/commonJSImportAsPrimaryExpression_es2015.1.normal.js b/crates/swc/tests/tsc-references/commonJSImportAsPrimaryExpression_es2015.1.normal.js index 47d5d4524e1c..3867b8c134f7 100644 --- a/crates/swc/tests/tsc-references/commonJSImportAsPrimaryExpression_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/commonJSImportAsPrimaryExpression_es2015.1.normal.js @@ -11,3 +11,4 @@ const foo = require("./foo_0"); if (foo.C1.s1) { // Should cause runtime import } +export { }; diff --git a/crates/swc/tests/tsc-references/commonJSImportAsPrimaryExpression_es2015.2.minified.js b/crates/swc/tests/tsc-references/commonJSImportAsPrimaryExpression_es2015.2.minified.js index 7dacad4d605c..faebb83b2430 100644 --- a/crates/swc/tests/tsc-references/commonJSImportAsPrimaryExpression_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/commonJSImportAsPrimaryExpression_es2015.2.minified.js @@ -6,3 +6,4 @@ export class C1 { C1.s1 = !0; let foo = require("./foo_0"); foo.C1.s1; +export { }; diff --git a/crates/swc/tests/tsc-references/commonJSImportAsPrimaryExpression_es5.1.normal.js b/crates/swc/tests/tsc-references/commonJSImportAsPrimaryExpression_es5.1.normal.js index bb9e914c6bfd..e2ac20c042cf 100644 --- a/crates/swc/tests/tsc-references/commonJSImportAsPrimaryExpression_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/commonJSImportAsPrimaryExpression_es5.1.normal.js @@ -12,3 +12,4 @@ var foo = require("./foo_0"); if (foo.C1.s1) { // Should cause runtime import } +export { }; diff --git a/crates/swc/tests/tsc-references/commonJSImportAsPrimaryExpression_es5.2.minified.js b/crates/swc/tests/tsc-references/commonJSImportAsPrimaryExpression_es5.2.minified.js index 68afd7fac142..3fa8a991d7eb 100644 --- a/crates/swc/tests/tsc-references/commonJSImportAsPrimaryExpression_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/commonJSImportAsPrimaryExpression_es5.2.minified.js @@ -3,4 +3,6 @@ export var C1 = function() { "use strict"; _class_call_check(this, C1), this.m1 = 42; }; -C1.s1 = !0, require("./foo_0").C1.s1; +C1.s1 = !0; +require("./foo_0").C1.s1; +export { }; diff --git a/crates/swc/tests/tsc-references/commonJSImportClassTypeReference_es5.1.normal.js b/crates/swc/tests/tsc-references/commonJSImportClassTypeReference_es5.1.normal.js index ef4ec76657ce..b7df66db9201 100644 --- a/crates/swc/tests/tsc-references/commonJSImportClassTypeReference_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/commonJSImportClassTypeReference_es5.1.normal.js @@ -4,12 +4,12 @@ // @outDir: out // @declaration: true // @filename: main.js -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var K = require("./mod1").K; /** @param {K} k */ function f(k) { k.values(); } // @filename: mod1.js +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var K = /*#__PURE__*/ function() { "use strict"; function K() { diff --git a/crates/swc/tests/tsc-references/commonJSImportClassTypeReference_es5.2.minified.js b/crates/swc/tests/tsc-references/commonJSImportClassTypeReference_es5.2.minified.js index 3c9e83f6d46e..4533cc132040 100644 --- a/crates/swc/tests/tsc-references/commonJSImportClassTypeReference_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/commonJSImportClassTypeReference_es5.2.minified.js @@ -1,5 +1,6 @@ +require("./mod1").K; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var K = require("./mod1").K, K = function() { +var K = function() { "use strict"; function K() { _class_call_check(this, K); diff --git a/crates/swc/tests/tsc-references/commonJSImportExportedClassExpression_es5.1.normal.js b/crates/swc/tests/tsc-references/commonJSImportExportedClassExpression_es5.1.normal.js index d012b9faddfe..89b3eae1f195 100644 --- a/crates/swc/tests/tsc-references/commonJSImportExportedClassExpression_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/commonJSImportExportedClassExpression_es5.1.normal.js @@ -4,12 +4,12 @@ // @outDir: out // @declaration: true // @filename: main.js -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var K = require("./mod1").K; /** @param {K} k */ function f(k) { k.values(); } // @filename: mod1.js +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; exports.K = /*#__PURE__*/ function() { "use strict"; function K() { diff --git a/crates/swc/tests/tsc-references/commonJSImportExportedClassExpression_es5.2.minified.js b/crates/swc/tests/tsc-references/commonJSImportExportedClassExpression_es5.2.minified.js index b70ab64ad1ff..032f296019f3 100644 --- a/crates/swc/tests/tsc-references/commonJSImportExportedClassExpression_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/commonJSImportExportedClassExpression_es5.2.minified.js @@ -1,5 +1,6 @@ +require("./mod1").K; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -require("./mod1").K, exports.K = function() { +exports.K = function() { "use strict"; function K() { _class_call_check(this, K); diff --git a/crates/swc/tests/tsc-references/commonJSImportNestedClassTypeReference_es5.1.normal.js b/crates/swc/tests/tsc-references/commonJSImportNestedClassTypeReference_es5.1.normal.js index 7babc2d0f490..b6230fe0c2ca 100644 --- a/crates/swc/tests/tsc-references/commonJSImportNestedClassTypeReference_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/commonJSImportNestedClassTypeReference_es5.1.normal.js @@ -4,12 +4,12 @@ // @outDir: out // @declaration: true // @filename: main.js -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var K = require("./mod1").K; /** @param {K} k */ function f(k) { k.values(); } // @filename: mod1.js +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var NS = {}; NS.K = /*#__PURE__*/ function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/commonJSImportNestedClassTypeReference_es5.2.minified.js b/crates/swc/tests/tsc-references/commonJSImportNestedClassTypeReference_es5.2.minified.js index 90ba5897781b..3aafa6b78ca2 100644 --- a/crates/swc/tests/tsc-references/commonJSImportNestedClassTypeReference_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/commonJSImportNestedClassTypeReference_es5.2.minified.js @@ -1,5 +1,5 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; require("./mod1").K; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var NS = {}; NS.K = function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/commonJSImportNotAsPrimaryExpression_es2015.1.normal.js b/crates/swc/tests/tsc-references/commonJSImportNotAsPrimaryExpression_es2015.1.normal.js index 228e6e5461d9..31e66f729893 100644 --- a/crates/swc/tests/tsc-references/commonJSImportNotAsPrimaryExpression_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/commonJSImportNotAsPrimaryExpression_es2015.1.normal.js @@ -19,3 +19,4 @@ var x = {}; var y = false; var z; var e = 0; +export { }; diff --git a/crates/swc/tests/tsc-references/commonJSImportNotAsPrimaryExpression_es2015.2.minified.js b/crates/swc/tests/tsc-references/commonJSImportNotAsPrimaryExpression_es2015.2.minified.js index eaf1c391d878..f1ccbfd75263 100644 --- a/crates/swc/tests/tsc-references/commonJSImportNotAsPrimaryExpression_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/commonJSImportNotAsPrimaryExpression_es2015.2.minified.js @@ -7,4 +7,6 @@ C1.s1 = !0; export var E1; !function(E1) { E1[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C"; -}(E1 || (E1 = {})), require("./foo_0"); +}(E1 || (E1 = {})); +require("./foo_0"); +export { }; diff --git a/crates/swc/tests/tsc-references/commonJSImportNotAsPrimaryExpression_es5.1.normal.js b/crates/swc/tests/tsc-references/commonJSImportNotAsPrimaryExpression_es5.1.normal.js index b62cbc70eeec..c3c03e295c6e 100644 --- a/crates/swc/tests/tsc-references/commonJSImportNotAsPrimaryExpression_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/commonJSImportNotAsPrimaryExpression_es5.1.normal.js @@ -20,3 +20,4 @@ var x = {}; var y = false; var z; var e = 0; +export { }; diff --git a/crates/swc/tests/tsc-references/commonJSImportNotAsPrimaryExpression_es5.2.minified.js b/crates/swc/tests/tsc-references/commonJSImportNotAsPrimaryExpression_es5.2.minified.js index 3acdefb2f68c..0891291d0a84 100644 --- a/crates/swc/tests/tsc-references/commonJSImportNotAsPrimaryExpression_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/commonJSImportNotAsPrimaryExpression_es5.2.minified.js @@ -7,4 +7,6 @@ C1.s1 = !0; export var E1; !function(E1) { E1[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C"; -}(E1 || (E1 = {})), require("./foo_0"); +}(E1 || (E1 = {})); +require("./foo_0"); +export { }; diff --git a/crates/swc/tests/tsc-references/commonJSReexport_es2015.2.minified.js b/crates/swc/tests/tsc-references/commonJSReexport_es2015.2.minified.js index cad63d49c58a..870f2a7a235c 100644 --- a/crates/swc/tests/tsc-references/commonJSReexport_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/commonJSReexport_es2015.2.minified.js @@ -1,9 +1,9 @@ -const hardline = { - type: "hard" +module.exports = { + hardline: { + type: "hard" + } }; module.exports = { - hardline -}, module.exports = { nested: require('./first') }; const { hardline } = require('./second').nested; diff --git a/crates/swc/tests/tsc-references/commonJSReexport_es5.2.minified.js b/crates/swc/tests/tsc-references/commonJSReexport_es5.2.minified.js index 9aaf19a6c5dd..4f27f9ea0758 100644 --- a/crates/swc/tests/tsc-references/commonJSReexport_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/commonJSReexport_es5.2.minified.js @@ -1,9 +1,9 @@ -var hardline = { - type: "hard" +module.exports = { + hardline: { + type: "hard" + } }; module.exports = { - hardline: hardline -}, module.exports = { nested: require("./first") }; -var hardline = require("./second").nested.hardline; +require("./second").nested.hardline; diff --git a/crates/swc/tests/tsc-references/conflictingCommonJSES2015Exports_es2015.1.normal.js b/crates/swc/tests/tsc-references/conflictingCommonJSES2015Exports_es2015.1.normal.js index f49d1395aafb..52d8c4c6670f 100644 --- a/crates/swc/tests/tsc-references/conflictingCommonJSES2015Exports_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/conflictingCommonJSES2015Exports_es2015.1.normal.js @@ -8,4 +8,6 @@ export function abc(a, b, c) { module.exports = { abc }; +// @Filename: use.js +import { abc } from './bug24934'; abc(1, 2, 3); diff --git a/crates/swc/tests/tsc-references/conflictingCommonJSES2015Exports_es2015.2.minified.js b/crates/swc/tests/tsc-references/conflictingCommonJSES2015Exports_es2015.2.minified.js index 7d11c125bd46..b2a40b5488ba 100644 --- a/crates/swc/tests/tsc-references/conflictingCommonJSES2015Exports_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/conflictingCommonJSES2015Exports_es2015.2.minified.js @@ -3,4 +3,6 @@ export function abc() { } module.exports = { abc -}, abc(1, 2, 3); +}; +import { abc } from './bug24934'; +abc(1, 2, 3); diff --git a/crates/swc/tests/tsc-references/conflictingCommonJSES2015Exports_es5.1.normal.js b/crates/swc/tests/tsc-references/conflictingCommonJSES2015Exports_es5.1.normal.js index 1abe27db7deb..8323aa72aaa5 100644 --- a/crates/swc/tests/tsc-references/conflictingCommonJSES2015Exports_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/conflictingCommonJSES2015Exports_es5.1.normal.js @@ -8,4 +8,6 @@ export function abc(a, b, c) { module.exports = { abc: abc }; +// @Filename: use.js +import { abc } from "./bug24934"; abc(1, 2, 3); diff --git a/crates/swc/tests/tsc-references/conflictingCommonJSES2015Exports_es5.2.minified.js b/crates/swc/tests/tsc-references/conflictingCommonJSES2015Exports_es5.2.minified.js index 0bc5b33516f1..21a565b55fde 100644 --- a/crates/swc/tests/tsc-references/conflictingCommonJSES2015Exports_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/conflictingCommonJSES2015Exports_es5.2.minified.js @@ -3,4 +3,6 @@ export function abc() { } module.exports = { abc: abc -}, abc(1, 2, 3); +}; +import { abc } from "./bug24934"; +abc(1, 2, 3); diff --git a/crates/swc/tests/tsc-references/constAssertionOnEnum_es2015.1.normal.js b/crates/swc/tests/tsc-references/constAssertionOnEnum_es2015.1.normal.js index 704e8a0f38f0..3d28951ab95e 100644 --- a/crates/swc/tests/tsc-references/constAssertionOnEnum_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/constAssertionOnEnum_es2015.1.normal.js @@ -6,6 +6,8 @@ export var Foo; Foo[Foo["A"] = 0] = "A"; Foo[Foo["B"] = 1] = "B"; })(Foo || (Foo = {})); +// @filename: test.ts +import { Foo } from './enum'; var Bar; (function(Bar) { Bar[Bar["A"] = 0] = "A"; @@ -22,6 +24,8 @@ var ns; })(Foo = ns1.Foo || (ns1.Foo = {})); ns.Foo.X; })(ns || (ns = {})); +// @filename: more.ts +export var Foo; (function(Foo) { Foo[Foo["X"] = 0] = "X"; })(Foo || (Foo = {})); diff --git a/crates/swc/tests/tsc-references/constAssertionOnEnum_es2015.2.minified.js b/crates/swc/tests/tsc-references/constAssertionOnEnum_es2015.2.minified.js index ed13358bc967..1f5024f196a0 100644 --- a/crates/swc/tests/tsc-references/constAssertionOnEnum_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/constAssertionOnEnum_es2015.2.minified.js @@ -1,12 +1,18 @@ -var Bar, ns; export var Foo; !function(Foo) { Foo[Foo.A = 0] = "A", Foo[Foo.B = 1] = "B"; -}(Foo || (Foo = {})), function(Bar) { +}(Foo || (Foo = {})); +var Bar; +import { Foo } from './enum'; +!function(Bar) { Bar[Bar.A = 0] = "A", Bar[Bar.B = 1] = "B"; -}(Bar || (Bar = {})), Foo.A, Bar.A, function(ns1) { +}(Bar || (Bar = {})), Foo.A, Bar.A; +var ns; +!function(ns1) { var Foo; (Foo = ns1.Foo || (ns1.Foo = {}))[Foo.X = 0] = "X", ns.Foo.X; -}(ns || (ns = {})), function(Foo) { +}(ns || (ns = {})); +export var Foo; +!function(Foo) { Foo[Foo.X = 0] = "X"; }(Foo || (Foo = {})), Foo.X; diff --git a/crates/swc/tests/tsc-references/constAssertionOnEnum_es5.1.normal.js b/crates/swc/tests/tsc-references/constAssertionOnEnum_es5.1.normal.js index b3b79369c709..ceee03f3a203 100644 --- a/crates/swc/tests/tsc-references/constAssertionOnEnum_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/constAssertionOnEnum_es5.1.normal.js @@ -6,6 +6,8 @@ export var Foo; Foo[Foo["A"] = 0] = "A"; Foo[Foo["B"] = 1] = "B"; })(Foo || (Foo = {})); +// @filename: test.ts +import { Foo } from "./enum"; var Bar; (function(Bar) { Bar[Bar["A"] = 0] = "A"; @@ -22,6 +24,8 @@ var ns; })(Foo = ns1.Foo || (ns1.Foo = {})); ns.Foo.X; })(ns || (ns = {})); +// @filename: more.ts +export var Foo; (function(Foo) { Foo[Foo["X"] = 0] = "X"; })(Foo || (Foo = {})); diff --git a/crates/swc/tests/tsc-references/constAssertionOnEnum_es5.2.minified.js b/crates/swc/tests/tsc-references/constAssertionOnEnum_es5.2.minified.js index ed13358bc967..f46f4cb13e3c 100644 --- a/crates/swc/tests/tsc-references/constAssertionOnEnum_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/constAssertionOnEnum_es5.2.minified.js @@ -1,12 +1,18 @@ -var Bar, ns; export var Foo; !function(Foo) { Foo[Foo.A = 0] = "A", Foo[Foo.B = 1] = "B"; -}(Foo || (Foo = {})), function(Bar) { +}(Foo || (Foo = {})); +var Bar; +import { Foo } from "./enum"; +!function(Bar) { Bar[Bar.A = 0] = "A", Bar[Bar.B = 1] = "B"; -}(Bar || (Bar = {})), Foo.A, Bar.A, function(ns1) { +}(Bar || (Bar = {})), Foo.A, Bar.A; +var ns; +!function(ns1) { var Foo; (Foo = ns1.Foo || (ns1.Foo = {}))[Foo.X = 0] = "X", ns.Foo.X; -}(ns || (ns = {})), function(Foo) { +}(ns || (ns = {})); +export var Foo; +!function(Foo) { Foo[Foo.X = 0] = "X"; }(Foo || (Foo = {})), Foo.X; diff --git a/crates/swc/tests/tsc-references/constructSignatureWithAccessibilityModifiersOnParameters2_es2015.1.normal.js b/crates/swc/tests/tsc-references/constructSignatureWithAccessibilityModifiersOnParameters2_es2015.1.normal.js new file mode 100644 index 000000000000..aee0c22e3889 --- /dev/null +++ b/crates/swc/tests/tsc-references/constructSignatureWithAccessibilityModifiersOnParameters2_es2015.1.normal.js @@ -0,0 +1,78 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 4 | constructor(public x, private y); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 4 | constructor(public x, private y); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 9 | constructor(private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 14 | constructor(private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 19 | new (public x); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 20 | new (public x); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 24 | new (private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 25 | new (private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 29 | new (public x); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 30 | new (public y); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 34 | new (private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 35 | new (private y); +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/constructSignatureWithAccessibilityModifiersOnParameters2_es2015.2.minified.js b/crates/swc/tests/tsc-references/constructSignatureWithAccessibilityModifiersOnParameters2_es2015.2.minified.js new file mode 100644 index 000000000000..aee0c22e3889 --- /dev/null +++ b/crates/swc/tests/tsc-references/constructSignatureWithAccessibilityModifiersOnParameters2_es2015.2.minified.js @@ -0,0 +1,78 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 4 | constructor(public x, private y); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 4 | constructor(public x, private y); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 9 | constructor(private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 14 | constructor(private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 19 | new (public x); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 20 | new (public x); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 24 | new (private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 25 | new (private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 29 | new (public x); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 30 | new (public y); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 34 | new (private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 35 | new (private y); +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/constructSignatureWithAccessibilityModifiersOnParameters2_es5.1.normal.js b/crates/swc/tests/tsc-references/constructSignatureWithAccessibilityModifiersOnParameters2_es5.1.normal.js new file mode 100644 index 000000000000..aee0c22e3889 --- /dev/null +++ b/crates/swc/tests/tsc-references/constructSignatureWithAccessibilityModifiersOnParameters2_es5.1.normal.js @@ -0,0 +1,78 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 4 | constructor(public x, private y); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 4 | constructor(public x, private y); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 9 | constructor(private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 14 | constructor(private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 19 | new (public x); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 20 | new (public x); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 24 | new (private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 25 | new (private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 29 | new (public x); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 30 | new (public y); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 34 | new (private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 35 | new (private y); +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/constructSignatureWithAccessibilityModifiersOnParameters2_es5.2.minified.js b/crates/swc/tests/tsc-references/constructSignatureWithAccessibilityModifiersOnParameters2_es5.2.minified.js new file mode 100644 index 000000000000..aee0c22e3889 --- /dev/null +++ b/crates/swc/tests/tsc-references/constructSignatureWithAccessibilityModifiersOnParameters2_es5.2.minified.js @@ -0,0 +1,78 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 4 | constructor(public x, private y); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 4 | constructor(public x, private y); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 9 | constructor(private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 14 | constructor(private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 19 | new (public x); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 20 | new (public x); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 24 | new (private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 25 | new (private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 29 | new (public x); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 30 | new (public y); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 34 | new (private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 35 | new (private y); +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/constructSignatureWithAccessibilityModifiersOnParameters_es2015.1.normal.js b/crates/swc/tests/tsc-references/constructSignatureWithAccessibilityModifiersOnParameters_es2015.1.normal.js new file mode 100644 index 000000000000..34351c81996f --- /dev/null +++ b/crates/swc/tests/tsc-references/constructSignatureWithAccessibilityModifiersOnParameters_es2015.1.normal.js @@ -0,0 +1,30 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 16 | new (public x); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 20 | new (private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 24 | new (public x); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 28 | new (private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/constructSignatureWithAccessibilityModifiersOnParameters_es2015.2.minified.js b/crates/swc/tests/tsc-references/constructSignatureWithAccessibilityModifiersOnParameters_es2015.2.minified.js new file mode 100644 index 000000000000..34351c81996f --- /dev/null +++ b/crates/swc/tests/tsc-references/constructSignatureWithAccessibilityModifiersOnParameters_es2015.2.minified.js @@ -0,0 +1,30 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 16 | new (public x); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 20 | new (private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 24 | new (public x); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 28 | new (private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/constructSignatureWithAccessibilityModifiersOnParameters_es5.1.normal.js b/crates/swc/tests/tsc-references/constructSignatureWithAccessibilityModifiersOnParameters_es5.1.normal.js new file mode 100644 index 000000000000..34351c81996f --- /dev/null +++ b/crates/swc/tests/tsc-references/constructSignatureWithAccessibilityModifiersOnParameters_es5.1.normal.js @@ -0,0 +1,30 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 16 | new (public x); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 20 | new (private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 24 | new (public x); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 28 | new (private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/constructSignatureWithAccessibilityModifiersOnParameters_es5.2.minified.js b/crates/swc/tests/tsc-references/constructSignatureWithAccessibilityModifiersOnParameters_es5.2.minified.js new file mode 100644 index 000000000000..34351c81996f --- /dev/null +++ b/crates/swc/tests/tsc-references/constructSignatureWithAccessibilityModifiersOnParameters_es5.2.minified.js @@ -0,0 +1,30 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 16 | new (public x); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 20 | new (private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 24 | new (public x); +//! : ^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 28 | new (private x); +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/constructorFunctionMergeWithClass_es2015.2.minified.js b/crates/swc/tests/tsc-references/constructorFunctionMergeWithClass_es2015.2.minified.js index 0d1112e147df..bfd1d6415a8a 100644 --- a/crates/swc/tests/tsc-references/constructorFunctionMergeWithClass_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/constructorFunctionMergeWithClass_es2015.2.minified.js @@ -1,7 +1,5 @@ -var SomeClass = function() { +new function() { this.otherProp = 0; -}; -new SomeClass(); -class SomeClass { -} -SomeClass.prop = 0; +}(); +(class { +}).prop = 0; diff --git a/crates/swc/tests/tsc-references/constructorFunctionMergeWithClass_es5.1.normal.js b/crates/swc/tests/tsc-references/constructorFunctionMergeWithClass_es5.1.normal.js index cf233eb39306..d33f56ab7216 100644 --- a/crates/swc/tests/tsc-references/constructorFunctionMergeWithClass_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/constructorFunctionMergeWithClass_es5.1.normal.js @@ -2,12 +2,12 @@ // @noEmit: true // @checkJs: true // @Filename: file1.js -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var SomeClass = function SomeClass() { this.otherProp = 0; }; new SomeClass(); // @Filename: file2.js +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var SomeClass = function SomeClass() { "use strict"; _class_call_check(this, SomeClass); diff --git a/crates/swc/tests/tsc-references/constructorFunctionMergeWithClass_es5.2.minified.js b/crates/swc/tests/tsc-references/constructorFunctionMergeWithClass_es5.2.minified.js index 76541eaaf277..a41c906805b7 100644 --- a/crates/swc/tests/tsc-references/constructorFunctionMergeWithClass_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/constructorFunctionMergeWithClass_es5.2.minified.js @@ -1,8 +1,7 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var SomeClass = function() { +new function() { this.otherProp = 0; -}; -new SomeClass(); +}(); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var SomeClass = function() { "use strict"; _class_call_check(this, SomeClass); diff --git a/crates/swc/tests/tsc-references/constructorFunctions2_es2015.2.minified.js b/crates/swc/tests/tsc-references/constructorFunctions2_es2015.2.minified.js index 6cdf57953774..65f2d785ed87 100644 --- a/crates/swc/tests/tsc-references/constructorFunctions2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/constructorFunctions2_es2015.2.minified.js @@ -7,4 +7,7 @@ B.prototype.m = function() { this.x = 2; }; const b = new B(); -b.id, b.x, module.exports = A; +b.id, b.x; +module.exports = function() { + this.id = 1; +}; diff --git a/crates/swc/tests/tsc-references/constructorFunctions2_es5.2.minified.js b/crates/swc/tests/tsc-references/constructorFunctions2_es5.2.minified.js index c381a4e359b9..765435f1a4ed 100644 --- a/crates/swc/tests/tsc-references/constructorFunctions2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/constructorFunctions2_es5.2.minified.js @@ -1,5 +1,4 @@ -var A = require("./other"); -new A().id; +new (require("./other"))().id; var B = function() { this.id = 1; }; @@ -7,4 +6,7 @@ B.prototype.m = function() { this.x = 2; }; var b = new B(); -b.id, b.x, module.exports = A; +b.id, b.x; +module.exports = function() { + this.id = 1; +}; diff --git a/crates/swc/tests/tsc-references/constructorOverloadsWithDefaultValues_es2015.1.normal.js b/crates/swc/tests/tsc-references/constructorOverloadsWithDefaultValues_es2015.1.normal.js new file mode 100644 index 000000000000..dc681979cbf8 --- /dev/null +++ b/crates/swc/tests/tsc-references/constructorOverloadsWithDefaultValues_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 3 | constructor(x = 1); // error +//! : ^^^^^ +//! `---- +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 10 | constructor(x = 1); // error +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/constructorOverloadsWithDefaultValues_es2015.2.minified.js b/crates/swc/tests/tsc-references/constructorOverloadsWithDefaultValues_es2015.2.minified.js new file mode 100644 index 000000000000..dc681979cbf8 --- /dev/null +++ b/crates/swc/tests/tsc-references/constructorOverloadsWithDefaultValues_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 3 | constructor(x = 1); // error +//! : ^^^^^ +//! `---- +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 10 | constructor(x = 1); // error +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/constructorOverloadsWithDefaultValues_es5.1.normal.js b/crates/swc/tests/tsc-references/constructorOverloadsWithDefaultValues_es5.1.normal.js new file mode 100644 index 000000000000..dc681979cbf8 --- /dev/null +++ b/crates/swc/tests/tsc-references/constructorOverloadsWithDefaultValues_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 3 | constructor(x = 1); // error +//! : ^^^^^ +//! `---- +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 10 | constructor(x = 1); // error +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/constructorOverloadsWithDefaultValues_es5.2.minified.js b/crates/swc/tests/tsc-references/constructorOverloadsWithDefaultValues_es5.2.minified.js new file mode 100644 index 000000000000..dc681979cbf8 --- /dev/null +++ b/crates/swc/tests/tsc-references/constructorOverloadsWithDefaultValues_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 3 | constructor(x = 1); // error +//! : ^^^^^ +//! `---- +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 10 | constructor(x = 1); // error +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/contextualTypedSpecialAssignment_es2015.2.minified.js b/crates/swc/tests/tsc-references/contextualTypedSpecialAssignment_es2015.2.minified.js index e9dc3cdd2220..82d79eef1579 100644 --- a/crates/swc/tests/tsc-references/contextualTypedSpecialAssignment_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/contextualTypedSpecialAssignment_es2015.2.minified.js @@ -32,7 +32,8 @@ exports.x = { }, Thing.prototype.x, (function() {}).prototype = { status: "done", m (n) {} -}, module.exports = { +}; +module.exports = { status: "done", m (n) {} }; diff --git a/crates/swc/tests/tsc-references/contextualTypedSpecialAssignment_es5.2.minified.js b/crates/swc/tests/tsc-references/contextualTypedSpecialAssignment_es5.2.minified.js index e651356857c5..92e9abd7b5b9 100644 --- a/crates/swc/tests/tsc-references/contextualTypedSpecialAssignment_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/contextualTypedSpecialAssignment_es5.2.minified.js @@ -34,7 +34,8 @@ exports.x = { }, Thing.prototype.x, (function() {}).prototype = { status: "done", m: function(n) {} -}, module.exports = { +}; +module.exports = { status: "done", m: function(n) {} }; diff --git a/crates/swc/tests/tsc-references/controlFlowDeleteOperator_es2015.1.normal.js b/crates/swc/tests/tsc-references/controlFlowDeleteOperator_es2015.1.normal.js new file mode 100644 index 000000000000..b8990400820d --- /dev/null +++ b/crates/swc/tests/tsc-references/controlFlowDeleteOperator_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 16 | delete x; // No effect +//! : ^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 16 | delete x; // No effect +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/controlFlowDeleteOperator_es2015.2.minified.js b/crates/swc/tests/tsc-references/controlFlowDeleteOperator_es2015.2.minified.js new file mode 100644 index 000000000000..b8990400820d --- /dev/null +++ b/crates/swc/tests/tsc-references/controlFlowDeleteOperator_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 16 | delete x; // No effect +//! : ^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 16 | delete x; // No effect +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/controlFlowDeleteOperator_es5.1.normal.js b/crates/swc/tests/tsc-references/controlFlowDeleteOperator_es5.1.normal.js new file mode 100644 index 000000000000..b8990400820d --- /dev/null +++ b/crates/swc/tests/tsc-references/controlFlowDeleteOperator_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 16 | delete x; // No effect +//! : ^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 16 | delete x; // No effect +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/controlFlowDeleteOperator_es5.2.minified.js b/crates/swc/tests/tsc-references/controlFlowDeleteOperator_es5.2.minified.js new file mode 100644 index 000000000000..b8990400820d --- /dev/null +++ b/crates/swc/tests/tsc-references/controlFlowDeleteOperator_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 16 | delete x; // No effect +//! : ^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 16 | delete x; // No effect +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences1_es2015.1.normal.js b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences1_es2015.1.normal.js index 5f2dd6691d85..8960c387612a 100644 --- a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences1_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences1_es2015.1.normal.js @@ -4,9 +4,9 @@ // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts // @filename: declaration.d.ts -import _extends from "@swc/helpers/src/_extends.mjs"; // @filename: 0.tsx /// +import _extends from "@swc/helpers/src/_extends.mjs"; import * as cx from 'classnames'; import * as React from "react"; let buttonProps; // any diff --git a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences1_es5.1.normal.js b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences1_es5.1.normal.js index 11580b823b1b..d9d43b5c8569 100644 --- a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences1_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences1_es5.1.normal.js @@ -4,9 +4,9 @@ // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts // @filename: declaration.d.ts -import _extends from "@swc/helpers/src/_extends.mjs"; // @filename: 0.tsx /// +import _extends from "@swc/helpers/src/_extends.mjs"; import * as cx from "classnames"; import * as React from "react"; var buttonProps; // any diff --git a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences2_es2015.1.normal.js b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences2_es2015.1.normal.js index b0b2228a72cb..c217bf0023d0 100644 --- a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences2_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences2_es2015.1.normal.js @@ -4,9 +4,9 @@ // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts // @filename: declaration.d.ts -import _extends from "@swc/helpers/src/_extends.mjs"; // @filename: 0.tsx /// +import _extends from "@swc/helpers/src/_extends.mjs"; import * as cx from 'classnames'; import * as React from "react"; let buttonProps; diff --git a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences2_es5.1.normal.js b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences2_es5.1.normal.js index 47194e52adbe..180808a9ec0a 100644 --- a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences2_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences2_es5.1.normal.js @@ -4,9 +4,9 @@ // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts // @filename: declaration.d.ts -import _extends from "@swc/helpers/src/_extends.mjs"; // @filename: 0.tsx /// +import _extends from "@swc/helpers/src/_extends.mjs"; import * as cx from "classnames"; import * as React from "react"; var buttonProps; diff --git a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences3_es2015.1.normal.js b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences3_es2015.1.normal.js index 83488f483069..d13666f201fb 100644 --- a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences3_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences3_es2015.1.normal.js @@ -5,9 +5,9 @@ // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts // @filename: declaration.d.ts -import _extends from "@swc/helpers/src/_extends.mjs"; // @filename: 0.tsx /// +import _extends from "@swc/helpers/src/_extends.mjs"; import * as cx from 'classnames'; import * as React from "react"; let buttonProps; diff --git a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences3_es5.1.normal.js b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences3_es5.1.normal.js index ba748319e649..3e9d5e1b826e 100644 --- a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences3_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences3_es5.1.normal.js @@ -5,9 +5,9 @@ // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts // @filename: declaration.d.ts -import _extends from "@swc/helpers/src/_extends.mjs"; // @filename: 0.tsx /// +import _extends from "@swc/helpers/src/_extends.mjs"; import * as cx from "classnames"; import * as React from "react"; var buttonProps; diff --git a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences4_es2015.1.normal.js b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences4_es2015.1.normal.js index ce312eb0122d..d1fee722702d 100644 --- a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences4_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences4_es2015.1.normal.js @@ -4,9 +4,9 @@ // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts // @filename: declaration.d.ts -import _extends from "@swc/helpers/src/_extends.mjs"; // @filename: 0.tsx /// +import _extends from "@swc/helpers/src/_extends.mjs"; import * as cx from 'classnames'; import * as React from "react"; let buttonProps; diff --git a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences4_es5.1.normal.js b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences4_es5.1.normal.js index 518b9268bea7..f9e9d0bfc85d 100644 --- a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences4_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences4_es5.1.normal.js @@ -4,9 +4,9 @@ // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts // @filename: declaration.d.ts -import _extends from "@swc/helpers/src/_extends.mjs"; // @filename: 0.tsx /// +import _extends from "@swc/helpers/src/_extends.mjs"; import * as cx from "classnames"; import * as React from "react"; var buttonProps; diff --git a/crates/swc/tests/tsc-references/declaredClassMergedwithSelf_es2015.1.normal.js b/crates/swc/tests/tsc-references/declaredClassMergedwithSelf_es2015.1.normal.js index d2b39a257811..542eff207297 100644 --- a/crates/swc/tests/tsc-references/declaredClassMergedwithSelf_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/declaredClassMergedwithSelf_es2015.1.normal.js @@ -1 +1,27 @@ // @Filename: file1.ts +//! +//! x the name `C1` is defined multiple times +//! ,-[3:1] +//! 3 | declare class C1 {} +//! : ^| +//! : `-- previous definition of `C1` here +//! 4 | +//! 5 | declare class C1 {} +//! : ^| +//! : `-- `C1` redefined here +//! `---- +//! +//! x the name `C2` is defined multiple times +//! ,-[7:1] +//! 7 | declare class C2 {} +//! : ^| +//! : `-- previous definition of `C2` here +//! 8 | +//! 9 | interface C2 {} +//! 10 | +//! 11 | declare class C2 {} +//! : ^| +//! : `-- `C2` redefined here +//! `---- +// @Filename: file2.ts +// @Filename: file3.ts diff --git a/crates/swc/tests/tsc-references/declaredClassMergedwithSelf_es2015.2.minified.js b/crates/swc/tests/tsc-references/declaredClassMergedwithSelf_es2015.2.minified.js new file mode 100644 index 000000000000..d585164d13ba --- /dev/null +++ b/crates/swc/tests/tsc-references/declaredClassMergedwithSelf_es2015.2.minified.js @@ -0,0 +1,25 @@ +// @Filename: file1.ts +//! +//! x the name `C1` is defined multiple times +//! ,-[3:1] +//! 3 | declare class C1 {} +//! : ^| +//! : `-- previous definition of `C1` here +//! 4 | +//! 5 | declare class C1 {} +//! : ^| +//! : `-- `C1` redefined here +//! `---- +//! +//! x the name `C2` is defined multiple times +//! ,-[7:1] +//! 7 | declare class C2 {} +//! : ^| +//! : `-- previous definition of `C2` here +//! 8 | +//! 9 | interface C2 {} +//! 10 | +//! 11 | declare class C2 {} +//! : ^| +//! : `-- `C2` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/declaredClassMergedwithSelf_es5.1.normal.js b/crates/swc/tests/tsc-references/declaredClassMergedwithSelf_es5.1.normal.js index d2b39a257811..542eff207297 100644 --- a/crates/swc/tests/tsc-references/declaredClassMergedwithSelf_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/declaredClassMergedwithSelf_es5.1.normal.js @@ -1 +1,27 @@ // @Filename: file1.ts +//! +//! x the name `C1` is defined multiple times +//! ,-[3:1] +//! 3 | declare class C1 {} +//! : ^| +//! : `-- previous definition of `C1` here +//! 4 | +//! 5 | declare class C1 {} +//! : ^| +//! : `-- `C1` redefined here +//! `---- +//! +//! x the name `C2` is defined multiple times +//! ,-[7:1] +//! 7 | declare class C2 {} +//! : ^| +//! : `-- previous definition of `C2` here +//! 8 | +//! 9 | interface C2 {} +//! 10 | +//! 11 | declare class C2 {} +//! : ^| +//! : `-- `C2` redefined here +//! `---- +// @Filename: file2.ts +// @Filename: file3.ts diff --git a/crates/swc/tests/tsc-references/declaredClassMergedwithSelf_es5.2.minified.js b/crates/swc/tests/tsc-references/declaredClassMergedwithSelf_es5.2.minified.js new file mode 100644 index 000000000000..d585164d13ba --- /dev/null +++ b/crates/swc/tests/tsc-references/declaredClassMergedwithSelf_es5.2.minified.js @@ -0,0 +1,25 @@ +// @Filename: file1.ts +//! +//! x the name `C1` is defined multiple times +//! ,-[3:1] +//! 3 | declare class C1 {} +//! : ^| +//! : `-- previous definition of `C1` here +//! 4 | +//! 5 | declare class C1 {} +//! : ^| +//! : `-- `C1` redefined here +//! `---- +//! +//! x the name `C2` is defined multiple times +//! ,-[7:1] +//! 7 | declare class C2 {} +//! : ^| +//! : `-- previous definition of `C2` here +//! 8 | +//! 9 | interface C2 {} +//! 10 | +//! 11 | declare class C2 {} +//! : ^| +//! : `-- `C2` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/decrementOperatorWithEnumTypeInvalidOperations_es2015.1.normal.js b/crates/swc/tests/tsc-references/decrementOperatorWithEnumTypeInvalidOperations_es2015.1.normal.js index 9fcb86f92c93..f563b04d0ce5 100644 --- a/crates/swc/tests/tsc-references/decrementOperatorWithEnumTypeInvalidOperations_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/decrementOperatorWithEnumTypeInvalidOperations_es2015.1.normal.js @@ -1,22 +1,18 @@ -var // -- operator on enum type -ENUM; -(function(ENUM) {})(ENUM || (ENUM = {})); -var ENUM1; -(function(ENUM1) { - ENUM1[ENUM1["A"] = 0] = "A"; - ENUM1[ENUM1["B"] = 1] = "B"; - ENUM1[ENUM1[""] = 2] = ""; -})(ENUM1 || (ENUM1 = {})); -// enum type var -var ResultIsNumber1 = --ENUM; -var ResultIsNumber2 = --ENUM1; -var ResultIsNumber3 = ENUM--; -var ResultIsNumber4 = ENUM1--; -// enum type expressions -var ResultIsNumber5 = --ENUM["A"] + ENUM.B; -var ResultIsNumber6 = ENUM.A + ENUM["B"]--; -// miss assignment operator ---ENUM; ---ENUM1; -ENUM--; -ENUM1--; +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 14 | var ResultIsNumber5 = --(ENUM["A"] + ENUM.B); +//! : ^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 15 | var ResultIsNumber6 = (ENUM.A + ENUM["B"])--; +//! : ^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/decrementOperatorWithEnumTypeInvalidOperations_es2015.2.minified.js b/crates/swc/tests/tsc-references/decrementOperatorWithEnumTypeInvalidOperations_es2015.2.minified.js index 1db9d3dced6b..f563b04d0ce5 100644 --- a/crates/swc/tests/tsc-references/decrementOperatorWithEnumTypeInvalidOperations_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/decrementOperatorWithEnumTypeInvalidOperations_es2015.2.minified.js @@ -1,4 +1,18 @@ -var ENUM, ENUM1; -!function(ENUM1) { - ENUM1[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = ""; -}(ENUM1 || (ENUM1 = {})), --ENUM, --ENUM1, ENUM--, ENUM1--, --ENUM.A + ENUM.B, ENUM.A + ENUM.B--, --ENUM, --ENUM1, ENUM--, ENUM1--; +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 14 | var ResultIsNumber5 = --(ENUM["A"] + ENUM.B); +//! : ^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 15 | var ResultIsNumber6 = (ENUM.A + ENUM["B"])--; +//! : ^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/decrementOperatorWithEnumTypeInvalidOperations_es5.1.normal.js b/crates/swc/tests/tsc-references/decrementOperatorWithEnumTypeInvalidOperations_es5.1.normal.js index 9fcb86f92c93..f563b04d0ce5 100644 --- a/crates/swc/tests/tsc-references/decrementOperatorWithEnumTypeInvalidOperations_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/decrementOperatorWithEnumTypeInvalidOperations_es5.1.normal.js @@ -1,22 +1,18 @@ -var // -- operator on enum type -ENUM; -(function(ENUM) {})(ENUM || (ENUM = {})); -var ENUM1; -(function(ENUM1) { - ENUM1[ENUM1["A"] = 0] = "A"; - ENUM1[ENUM1["B"] = 1] = "B"; - ENUM1[ENUM1[""] = 2] = ""; -})(ENUM1 || (ENUM1 = {})); -// enum type var -var ResultIsNumber1 = --ENUM; -var ResultIsNumber2 = --ENUM1; -var ResultIsNumber3 = ENUM--; -var ResultIsNumber4 = ENUM1--; -// enum type expressions -var ResultIsNumber5 = --ENUM["A"] + ENUM.B; -var ResultIsNumber6 = ENUM.A + ENUM["B"]--; -// miss assignment operator ---ENUM; ---ENUM1; -ENUM--; -ENUM1--; +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 14 | var ResultIsNumber5 = --(ENUM["A"] + ENUM.B); +//! : ^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 15 | var ResultIsNumber6 = (ENUM.A + ENUM["B"])--; +//! : ^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/decrementOperatorWithEnumTypeInvalidOperations_es5.2.minified.js b/crates/swc/tests/tsc-references/decrementOperatorWithEnumTypeInvalidOperations_es5.2.minified.js index 1db9d3dced6b..f563b04d0ce5 100644 --- a/crates/swc/tests/tsc-references/decrementOperatorWithEnumTypeInvalidOperations_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/decrementOperatorWithEnumTypeInvalidOperations_es5.2.minified.js @@ -1,4 +1,18 @@ -var ENUM, ENUM1; -!function(ENUM1) { - ENUM1[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = ""; -}(ENUM1 || (ENUM1 = {})), --ENUM, --ENUM1, ENUM--, ENUM1--, --ENUM.A + ENUM.B, ENUM.A + ENUM.B--, --ENUM, --ENUM1, ENUM--, ENUM1--; +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 14 | var ResultIsNumber5 = --(ENUM["A"] + ENUM.B); +//! : ^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 15 | var ResultIsNumber6 = (ENUM.A + ENUM["B"])--; +//! : ^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/decrementOperatorWithNumberTypeInvalidOperations_es2015.1.normal.js b/crates/swc/tests/tsc-references/decrementOperatorWithNumberTypeInvalidOperations_es2015.1.normal.js new file mode 100644 index 000000000000..9a1d46ed1045 --- /dev/null +++ b/crates/swc/tests/tsc-references/decrementOperatorWithNumberTypeInvalidOperations_es2015.1.normal.js @@ -0,0 +1,102 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 22 | var ResultIsNumber3 = --1; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 23 | var ResultIsNumber4 = --{ x: 1, y: 2}; +//! : ^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 24 | var ResultIsNumber5 = --{ x: 1, y: (n: number) => { return n; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 26 | var ResultIsNumber6 = 1--; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 27 | var ResultIsNumber7 = { x: 1, y: 2 }--; +//! : ^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 28 | var ResultIsNumber8 = { x: 1, y: (n: number) => { return n; } }--; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 31 | var ResultIsNumber9 = --foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 32 | var ResultIsNumber10 = --A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 33 | var ResultIsNumber11 = --(NUMBER + NUMBER); +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 35 | var ResultIsNumber12 = foo()--; +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 36 | var ResultIsNumber13 = A.foo()--; +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 37 | var ResultIsNumber14 = (NUMBER + NUMBER)--; +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 40 | --1; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 42 | --foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 44 | 1--; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 46 | foo()--; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/decrementOperatorWithNumberTypeInvalidOperations_es2015.2.minified.js b/crates/swc/tests/tsc-references/decrementOperatorWithNumberTypeInvalidOperations_es2015.2.minified.js new file mode 100644 index 000000000000..9a1d46ed1045 --- /dev/null +++ b/crates/swc/tests/tsc-references/decrementOperatorWithNumberTypeInvalidOperations_es2015.2.minified.js @@ -0,0 +1,102 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 22 | var ResultIsNumber3 = --1; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 23 | var ResultIsNumber4 = --{ x: 1, y: 2}; +//! : ^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 24 | var ResultIsNumber5 = --{ x: 1, y: (n: number) => { return n; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 26 | var ResultIsNumber6 = 1--; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 27 | var ResultIsNumber7 = { x: 1, y: 2 }--; +//! : ^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 28 | var ResultIsNumber8 = { x: 1, y: (n: number) => { return n; } }--; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 31 | var ResultIsNumber9 = --foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 32 | var ResultIsNumber10 = --A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 33 | var ResultIsNumber11 = --(NUMBER + NUMBER); +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 35 | var ResultIsNumber12 = foo()--; +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 36 | var ResultIsNumber13 = A.foo()--; +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 37 | var ResultIsNumber14 = (NUMBER + NUMBER)--; +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 40 | --1; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 42 | --foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 44 | 1--; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 46 | foo()--; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/decrementOperatorWithNumberTypeInvalidOperations_es5.1.normal.js b/crates/swc/tests/tsc-references/decrementOperatorWithNumberTypeInvalidOperations_es5.1.normal.js new file mode 100644 index 000000000000..9a1d46ed1045 --- /dev/null +++ b/crates/swc/tests/tsc-references/decrementOperatorWithNumberTypeInvalidOperations_es5.1.normal.js @@ -0,0 +1,102 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 22 | var ResultIsNumber3 = --1; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 23 | var ResultIsNumber4 = --{ x: 1, y: 2}; +//! : ^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 24 | var ResultIsNumber5 = --{ x: 1, y: (n: number) => { return n; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 26 | var ResultIsNumber6 = 1--; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 27 | var ResultIsNumber7 = { x: 1, y: 2 }--; +//! : ^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 28 | var ResultIsNumber8 = { x: 1, y: (n: number) => { return n; } }--; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 31 | var ResultIsNumber9 = --foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 32 | var ResultIsNumber10 = --A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 33 | var ResultIsNumber11 = --(NUMBER + NUMBER); +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 35 | var ResultIsNumber12 = foo()--; +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 36 | var ResultIsNumber13 = A.foo()--; +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 37 | var ResultIsNumber14 = (NUMBER + NUMBER)--; +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 40 | --1; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 42 | --foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 44 | 1--; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 46 | foo()--; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/decrementOperatorWithNumberTypeInvalidOperations_es5.2.minified.js b/crates/swc/tests/tsc-references/decrementOperatorWithNumberTypeInvalidOperations_es5.2.minified.js new file mode 100644 index 000000000000..9a1d46ed1045 --- /dev/null +++ b/crates/swc/tests/tsc-references/decrementOperatorWithNumberTypeInvalidOperations_es5.2.minified.js @@ -0,0 +1,102 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 22 | var ResultIsNumber3 = --1; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 23 | var ResultIsNumber4 = --{ x: 1, y: 2}; +//! : ^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 24 | var ResultIsNumber5 = --{ x: 1, y: (n: number) => { return n; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 26 | var ResultIsNumber6 = 1--; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 27 | var ResultIsNumber7 = { x: 1, y: 2 }--; +//! : ^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 28 | var ResultIsNumber8 = { x: 1, y: (n: number) => { return n; } }--; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 31 | var ResultIsNumber9 = --foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 32 | var ResultIsNumber10 = --A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 33 | var ResultIsNumber11 = --(NUMBER + NUMBER); +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 35 | var ResultIsNumber12 = foo()--; +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 36 | var ResultIsNumber13 = A.foo()--; +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 37 | var ResultIsNumber14 = (NUMBER + NUMBER)--; +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 40 | --1; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 42 | --foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 44 | 1--; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 46 | foo()--; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/decrementOperatorWithUnsupportedBooleanType_es2015.1.normal.js b/crates/swc/tests/tsc-references/decrementOperatorWithUnsupportedBooleanType_es2015.1.normal.js new file mode 100644 index 000000000000..a8e112fc7057 --- /dev/null +++ b/crates/swc/tests/tsc-references/decrementOperatorWithUnsupportedBooleanType_es2015.1.normal.js @@ -0,0 +1,90 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 22 | var ResultIsNumber3 = --true; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 23 | var ResultIsNumber4 = --{ x: true, y: false }; +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 24 | var ResultIsNumber5 = --{ x: true, y: (n: boolean) => { return n; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 26 | var ResultIsNumber6 = true--; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 27 | var ResultIsNumber7 = { x: true, y: false }--; +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 28 | var ResultIsNumber8 = { x: true, y: (n: boolean) => { return n; } }--; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 33 | var ResultIsNumber11 = --foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 34 | var ResultIsNumber12 = --A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 36 | var ResultIsNumber13 = foo()--; +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 37 | var ResultIsNumber14 = A.foo()--; +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 42 | --true; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 44 | --foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 49 | true--; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 51 | foo()--; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/decrementOperatorWithUnsupportedBooleanType_es2015.2.minified.js b/crates/swc/tests/tsc-references/decrementOperatorWithUnsupportedBooleanType_es2015.2.minified.js new file mode 100644 index 000000000000..a8e112fc7057 --- /dev/null +++ b/crates/swc/tests/tsc-references/decrementOperatorWithUnsupportedBooleanType_es2015.2.minified.js @@ -0,0 +1,90 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 22 | var ResultIsNumber3 = --true; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 23 | var ResultIsNumber4 = --{ x: true, y: false }; +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 24 | var ResultIsNumber5 = --{ x: true, y: (n: boolean) => { return n; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 26 | var ResultIsNumber6 = true--; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 27 | var ResultIsNumber7 = { x: true, y: false }--; +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 28 | var ResultIsNumber8 = { x: true, y: (n: boolean) => { return n; } }--; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 33 | var ResultIsNumber11 = --foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 34 | var ResultIsNumber12 = --A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 36 | var ResultIsNumber13 = foo()--; +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 37 | var ResultIsNumber14 = A.foo()--; +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 42 | --true; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 44 | --foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 49 | true--; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 51 | foo()--; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/decrementOperatorWithUnsupportedBooleanType_es5.1.normal.js b/crates/swc/tests/tsc-references/decrementOperatorWithUnsupportedBooleanType_es5.1.normal.js new file mode 100644 index 000000000000..a8e112fc7057 --- /dev/null +++ b/crates/swc/tests/tsc-references/decrementOperatorWithUnsupportedBooleanType_es5.1.normal.js @@ -0,0 +1,90 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 22 | var ResultIsNumber3 = --true; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 23 | var ResultIsNumber4 = --{ x: true, y: false }; +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 24 | var ResultIsNumber5 = --{ x: true, y: (n: boolean) => { return n; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 26 | var ResultIsNumber6 = true--; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 27 | var ResultIsNumber7 = { x: true, y: false }--; +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 28 | var ResultIsNumber8 = { x: true, y: (n: boolean) => { return n; } }--; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 33 | var ResultIsNumber11 = --foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 34 | var ResultIsNumber12 = --A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 36 | var ResultIsNumber13 = foo()--; +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 37 | var ResultIsNumber14 = A.foo()--; +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 42 | --true; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 44 | --foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 49 | true--; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 51 | foo()--; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/decrementOperatorWithUnsupportedBooleanType_es5.2.minified.js b/crates/swc/tests/tsc-references/decrementOperatorWithUnsupportedBooleanType_es5.2.minified.js new file mode 100644 index 000000000000..a8e112fc7057 --- /dev/null +++ b/crates/swc/tests/tsc-references/decrementOperatorWithUnsupportedBooleanType_es5.2.minified.js @@ -0,0 +1,90 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 22 | var ResultIsNumber3 = --true; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 23 | var ResultIsNumber4 = --{ x: true, y: false }; +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 24 | var ResultIsNumber5 = --{ x: true, y: (n: boolean) => { return n; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 26 | var ResultIsNumber6 = true--; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 27 | var ResultIsNumber7 = { x: true, y: false }--; +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 28 | var ResultIsNumber8 = { x: true, y: (n: boolean) => { return n; } }--; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 33 | var ResultIsNumber11 = --foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 34 | var ResultIsNumber12 = --A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 36 | var ResultIsNumber13 = foo()--; +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 37 | var ResultIsNumber14 = A.foo()--; +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 42 | --true; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 44 | --foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 49 | true--; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 51 | foo()--; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/decrementOperatorWithUnsupportedStringType_es2015.1.normal.js b/crates/swc/tests/tsc-references/decrementOperatorWithUnsupportedStringType_es2015.1.normal.js new file mode 100644 index 000000000000..b8b341b66b5b --- /dev/null +++ b/crates/swc/tests/tsc-references/decrementOperatorWithUnsupportedStringType_es2015.1.normal.js @@ -0,0 +1,102 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 25 | var ResultIsNumber5 = --""; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 26 | var ResultIsNumber6 = --{ x: "", y: "" }; +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 27 | var ResultIsNumber7 = --{ x: "", y: (s: string) => { return s; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 29 | var ResultIsNumber8 = ""--; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 30 | var ResultIsNumber9 = { x: "", y: "" }--; +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 31 | var ResultIsNumber10 = { x: "", y: (s: string) => { return s; } }--; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 37 | var ResultIsNumber14 = --foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 38 | var ResultIsNumber15 = --A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 39 | var ResultIsNumber16 = --(STRING + STRING); +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 44 | var ResultIsNumber20 = foo()--; +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 45 | var ResultIsNumber21 = A.foo()--; +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 46 | var ResultIsNumber22 = (STRING + STRING)--; +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 49 | --""; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 53 | --foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 58 | ""--; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 62 | foo()--; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/decrementOperatorWithUnsupportedStringType_es2015.2.minified.js b/crates/swc/tests/tsc-references/decrementOperatorWithUnsupportedStringType_es2015.2.minified.js new file mode 100644 index 000000000000..b8b341b66b5b --- /dev/null +++ b/crates/swc/tests/tsc-references/decrementOperatorWithUnsupportedStringType_es2015.2.minified.js @@ -0,0 +1,102 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 25 | var ResultIsNumber5 = --""; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 26 | var ResultIsNumber6 = --{ x: "", y: "" }; +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 27 | var ResultIsNumber7 = --{ x: "", y: (s: string) => { return s; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 29 | var ResultIsNumber8 = ""--; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 30 | var ResultIsNumber9 = { x: "", y: "" }--; +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 31 | var ResultIsNumber10 = { x: "", y: (s: string) => { return s; } }--; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 37 | var ResultIsNumber14 = --foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 38 | var ResultIsNumber15 = --A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 39 | var ResultIsNumber16 = --(STRING + STRING); +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 44 | var ResultIsNumber20 = foo()--; +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 45 | var ResultIsNumber21 = A.foo()--; +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 46 | var ResultIsNumber22 = (STRING + STRING)--; +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 49 | --""; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 53 | --foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 58 | ""--; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 62 | foo()--; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/decrementOperatorWithUnsupportedStringType_es5.1.normal.js b/crates/swc/tests/tsc-references/decrementOperatorWithUnsupportedStringType_es5.1.normal.js new file mode 100644 index 000000000000..b8b341b66b5b --- /dev/null +++ b/crates/swc/tests/tsc-references/decrementOperatorWithUnsupportedStringType_es5.1.normal.js @@ -0,0 +1,102 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 25 | var ResultIsNumber5 = --""; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 26 | var ResultIsNumber6 = --{ x: "", y: "" }; +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 27 | var ResultIsNumber7 = --{ x: "", y: (s: string) => { return s; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 29 | var ResultIsNumber8 = ""--; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 30 | var ResultIsNumber9 = { x: "", y: "" }--; +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 31 | var ResultIsNumber10 = { x: "", y: (s: string) => { return s; } }--; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 37 | var ResultIsNumber14 = --foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 38 | var ResultIsNumber15 = --A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 39 | var ResultIsNumber16 = --(STRING + STRING); +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 44 | var ResultIsNumber20 = foo()--; +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 45 | var ResultIsNumber21 = A.foo()--; +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 46 | var ResultIsNumber22 = (STRING + STRING)--; +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 49 | --""; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 53 | --foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 58 | ""--; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 62 | foo()--; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/decrementOperatorWithUnsupportedStringType_es5.2.minified.js b/crates/swc/tests/tsc-references/decrementOperatorWithUnsupportedStringType_es5.2.minified.js new file mode 100644 index 000000000000..b8b341b66b5b --- /dev/null +++ b/crates/swc/tests/tsc-references/decrementOperatorWithUnsupportedStringType_es5.2.minified.js @@ -0,0 +1,102 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 25 | var ResultIsNumber5 = --""; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 26 | var ResultIsNumber6 = --{ x: "", y: "" }; +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 27 | var ResultIsNumber7 = --{ x: "", y: (s: string) => { return s; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 29 | var ResultIsNumber8 = ""--; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 30 | var ResultIsNumber9 = { x: "", y: "" }--; +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 31 | var ResultIsNumber10 = { x: "", y: (s: string) => { return s; } }--; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 37 | var ResultIsNumber14 = --foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 38 | var ResultIsNumber15 = --A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 39 | var ResultIsNumber16 = --(STRING + STRING); +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 44 | var ResultIsNumber20 = foo()--; +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 45 | var ResultIsNumber21 = A.foo()--; +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 46 | var ResultIsNumber22 = (STRING + STRING)--; +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 49 | --""; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 53 | --foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 58 | ""--; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 62 | foo()--; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/defaultExportInAwaitExpression01_es2015.1.normal.js b/crates/swc/tests/tsc-references/defaultExportInAwaitExpression01_es2015.1.normal.js index 91c92114d763..79c08279462c 100644 --- a/crates/swc/tests/tsc-references/defaultExportInAwaitExpression01_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/defaultExportInAwaitExpression01_es2015.1.normal.js @@ -1,11 +1,13 @@ // @target: ES6 // @module: umd // @filename: a.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; const x = new Promise((resolve, reject)=>{ resolve({}); }); export default x; +// @filename: b.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import x from './a'; _async_to_generator(function*() { const value = yield x; })(); diff --git a/crates/swc/tests/tsc-references/defaultExportInAwaitExpression01_es2015.2.minified.js b/crates/swc/tests/tsc-references/defaultExportInAwaitExpression01_es2015.2.minified.js index 69e836996803..29bbe60346dc 100644 --- a/crates/swc/tests/tsc-references/defaultExportInAwaitExpression01_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/defaultExportInAwaitExpression01_es2015.2.minified.js @@ -1,8 +1,9 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; let x = new Promise((resolve, reject)=>{ resolve({}); }); export default x; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import x from './a'; _async_to_generator(function*() { yield x; })(); diff --git a/crates/swc/tests/tsc-references/defaultExportInAwaitExpression01_es5.1.normal.js b/crates/swc/tests/tsc-references/defaultExportInAwaitExpression01_es5.1.normal.js index 03474dc11ec1..fb49723ecc24 100644 --- a/crates/swc/tests/tsc-references/defaultExportInAwaitExpression01_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/defaultExportInAwaitExpression01_es5.1.normal.js @@ -1,12 +1,14 @@ // @target: ES6 // @module: umd // @filename: a.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; -import regeneratorRuntime from "regenerator-runtime"; var x = new Promise(function(resolve, reject) { resolve({}); }); export default x; +// @filename: b.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import x from "./a"; _async_to_generator(regeneratorRuntime.mark(function _callee() { var value; return regeneratorRuntime.wrap(function _callee$(_ctx) { diff --git a/crates/swc/tests/tsc-references/defaultExportInAwaitExpression01_es5.2.minified.js b/crates/swc/tests/tsc-references/defaultExportInAwaitExpression01_es5.2.minified.js index 5405b696b377..938ed3fc1d03 100644 --- a/crates/swc/tests/tsc-references/defaultExportInAwaitExpression01_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/defaultExportInAwaitExpression01_es5.2.minified.js @@ -1,9 +1,10 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; -import regeneratorRuntime from "regenerator-runtime"; var x = new Promise(function(resolve, reject) { resolve({}); }); export default x; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import x from "./a"; _async_to_generator(regeneratorRuntime.mark(function _callee() { var value; return regeneratorRuntime.wrap(function(_ctx) { diff --git a/crates/swc/tests/tsc-references/defaultExportInAwaitExpression02_es2015.1.normal.js b/crates/swc/tests/tsc-references/defaultExportInAwaitExpression02_es2015.1.normal.js index 9da9a834012c..a83d43b8b51f 100644 --- a/crates/swc/tests/tsc-references/defaultExportInAwaitExpression02_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/defaultExportInAwaitExpression02_es2015.1.normal.js @@ -1,11 +1,13 @@ // @target: ES6 // @module: commonjs // @filename: a.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; const x = new Promise((resolve, reject)=>{ resolve({}); }); export default x; +// @filename: b.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import x from './a'; _async_to_generator(function*() { const value = yield x; })(); diff --git a/crates/swc/tests/tsc-references/defaultExportInAwaitExpression02_es2015.2.minified.js b/crates/swc/tests/tsc-references/defaultExportInAwaitExpression02_es2015.2.minified.js index 69e836996803..29bbe60346dc 100644 --- a/crates/swc/tests/tsc-references/defaultExportInAwaitExpression02_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/defaultExportInAwaitExpression02_es2015.2.minified.js @@ -1,8 +1,9 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; let x = new Promise((resolve, reject)=>{ resolve({}); }); export default x; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import x from './a'; _async_to_generator(function*() { yield x; })(); diff --git a/crates/swc/tests/tsc-references/defaultExportInAwaitExpression02_es5.1.normal.js b/crates/swc/tests/tsc-references/defaultExportInAwaitExpression02_es5.1.normal.js index e6626484c409..aea15dc57e80 100644 --- a/crates/swc/tests/tsc-references/defaultExportInAwaitExpression02_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/defaultExportInAwaitExpression02_es5.1.normal.js @@ -1,12 +1,14 @@ // @target: ES6 // @module: commonjs // @filename: a.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; -import regeneratorRuntime from "regenerator-runtime"; var x = new Promise(function(resolve, reject) { resolve({}); }); export default x; +// @filename: b.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import x from "./a"; _async_to_generator(regeneratorRuntime.mark(function _callee() { var value; return regeneratorRuntime.wrap(function _callee$(_ctx) { diff --git a/crates/swc/tests/tsc-references/defaultExportInAwaitExpression02_es5.2.minified.js b/crates/swc/tests/tsc-references/defaultExportInAwaitExpression02_es5.2.minified.js index 5405b696b377..938ed3fc1d03 100644 --- a/crates/swc/tests/tsc-references/defaultExportInAwaitExpression02_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/defaultExportInAwaitExpression02_es5.2.minified.js @@ -1,9 +1,10 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; -import regeneratorRuntime from "regenerator-runtime"; var x = new Promise(function(resolve, reject) { resolve({}); }); export default x; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import x from "./a"; _async_to_generator(regeneratorRuntime.mark(function _callee() { var value; return regeneratorRuntime.wrap(function(_ctx) { diff --git a/crates/swc/tests/tsc-references/defaultExportsCannotMerge02_es5.2.minified.js b/crates/swc/tests/tsc-references/defaultExportsCannotMerge02_es5.2.minified.js index 9cafe14689a5..9d5c339b9b80 100644 --- a/crates/swc/tests/tsc-references/defaultExportsCannotMerge02_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/defaultExportsCannotMerge02_es5.2.minified.js @@ -3,8 +3,8 @@ var Decl = function() { "use strict"; _class_call_check(this, Decl); }; +export { Decl as default }; import Entity from "m1"; Entity(); var z = new Entity(); z.p1, z.p2; -export { Decl as default }; diff --git a/crates/swc/tests/tsc-references/defaultExportsCannotMerge03_es5.2.minified.js b/crates/swc/tests/tsc-references/defaultExportsCannotMerge03_es5.2.minified.js index 9cafe14689a5..9d5c339b9b80 100644 --- a/crates/swc/tests/tsc-references/defaultExportsCannotMerge03_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/defaultExportsCannotMerge03_es5.2.minified.js @@ -3,8 +3,8 @@ var Decl = function() { "use strict"; _class_call_check(this, Decl); }; +export { Decl as default }; import Entity from "m1"; Entity(); var z = new Entity(); z.p1, z.p2; -export { Decl as default }; diff --git a/crates/swc/tests/tsc-references/defaultExportsGetExportedAmd_es5.2.minified.js b/crates/swc/tests/tsc-references/defaultExportsGetExportedAmd_es5.2.minified.js index 6e3289ca2099..d64e52da10f7 100644 --- a/crates/swc/tests/tsc-references/defaultExportsGetExportedAmd_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/defaultExportsGetExportedAmd_es5.2.minified.js @@ -3,5 +3,5 @@ var Foo = function() { "use strict"; _class_call_check(this, Foo); }; -export default function foo() {}; export { Foo as default }; +export default function foo() {}; diff --git a/crates/swc/tests/tsc-references/defaultExportsGetExportedCommonjs_es5.2.minified.js b/crates/swc/tests/tsc-references/defaultExportsGetExportedCommonjs_es5.2.minified.js index 6e3289ca2099..d64e52da10f7 100644 --- a/crates/swc/tests/tsc-references/defaultExportsGetExportedCommonjs_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/defaultExportsGetExportedCommonjs_es5.2.minified.js @@ -3,5 +3,5 @@ var Foo = function() { "use strict"; _class_call_check(this, Foo); }; -export default function foo() {}; export { Foo as default }; +export default function foo() {}; diff --git a/crates/swc/tests/tsc-references/defaultExportsGetExportedSystem_es5.2.minified.js b/crates/swc/tests/tsc-references/defaultExportsGetExportedSystem_es5.2.minified.js index 6e3289ca2099..d64e52da10f7 100644 --- a/crates/swc/tests/tsc-references/defaultExportsGetExportedSystem_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/defaultExportsGetExportedSystem_es5.2.minified.js @@ -3,5 +3,5 @@ var Foo = function() { "use strict"; _class_call_check(this, Foo); }; -export default function foo() {}; export { Foo as default }; +export default function foo() {}; diff --git a/crates/swc/tests/tsc-references/defaultExportsGetExportedUmd_es5.2.minified.js b/crates/swc/tests/tsc-references/defaultExportsGetExportedUmd_es5.2.minified.js index 6e3289ca2099..d64e52da10f7 100644 --- a/crates/swc/tests/tsc-references/defaultExportsGetExportedUmd_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/defaultExportsGetExportedUmd_es5.2.minified.js @@ -3,5 +3,5 @@ var Foo = function() { "use strict"; _class_call_check(this, Foo); }; -export default function foo() {}; export { Foo as default }; +export default function foo() {}; diff --git a/crates/swc/tests/tsc-references/deleteChain_es2015.1.normal.js b/crates/swc/tests/tsc-references/deleteChain_es2015.1.normal.js new file mode 100644 index 000000000000..5e7907e43edf --- /dev/null +++ b/crates/swc/tests/tsc-references/deleteChain_es2015.1.normal.js @@ -0,0 +1,42 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 5 | delete (o1?.b); +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 9 | delete (o2?.b.c); +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 13 | delete (o3.b?.c); +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 18 | delete (o4.b?.c.d?.e); +//! : ^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 22 | delete (o5.b?.().c.d?.e); +//! : ^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 26 | delete (o6.b?.['c'].d?.['e']); +//! : ^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/deleteChain_es2015.2.minified.js b/crates/swc/tests/tsc-references/deleteChain_es2015.2.minified.js new file mode 100644 index 000000000000..5e7907e43edf --- /dev/null +++ b/crates/swc/tests/tsc-references/deleteChain_es2015.2.minified.js @@ -0,0 +1,42 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 5 | delete (o1?.b); +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 9 | delete (o2?.b.c); +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 13 | delete (o3.b?.c); +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 18 | delete (o4.b?.c.d?.e); +//! : ^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 22 | delete (o5.b?.().c.d?.e); +//! : ^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 26 | delete (o6.b?.['c'].d?.['e']); +//! : ^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/deleteChain_es5.1.normal.js b/crates/swc/tests/tsc-references/deleteChain_es5.1.normal.js new file mode 100644 index 000000000000..5e7907e43edf --- /dev/null +++ b/crates/swc/tests/tsc-references/deleteChain_es5.1.normal.js @@ -0,0 +1,42 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 5 | delete (o1?.b); +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 9 | delete (o2?.b.c); +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 13 | delete (o3.b?.c); +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 18 | delete (o4.b?.c.d?.e); +//! : ^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 22 | delete (o5.b?.().c.d?.e); +//! : ^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 26 | delete (o6.b?.['c'].d?.['e']); +//! : ^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/deleteChain_es5.2.minified.js b/crates/swc/tests/tsc-references/deleteChain_es5.2.minified.js new file mode 100644 index 000000000000..5e7907e43edf --- /dev/null +++ b/crates/swc/tests/tsc-references/deleteChain_es5.2.minified.js @@ -0,0 +1,42 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 5 | delete (o1?.b); +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 9 | delete (o2?.b.c); +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 13 | delete (o3.b?.c); +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 18 | delete (o4.b?.c.d?.e); +//! : ^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 22 | delete (o5.b?.().c.d?.e); +//! : ^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 26 | delete (o6.b?.['c'].d?.['e']); +//! : ^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/deleteOperatorWithAnyOtherType_es2015.1.normal.js b/crates/swc/tests/tsc-references/deleteOperatorWithAnyOtherType_es2015.1.normal.js new file mode 100644 index 000000000000..fd2cf5d749c4 --- /dev/null +++ b/crates/swc/tests/tsc-references/deleteOperatorWithAnyOtherType_es2015.1.normal.js @@ -0,0 +1,204 @@ +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 25 | var ResultIsBoolean1 = delete ANY1; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 25 | var ResultIsBoolean1 = delete ANY1; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 26 | var ResultIsBoolean2 = delete ANY2; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 26 | var ResultIsBoolean2 = delete ANY2; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 27 | var ResultIsBoolean3 = delete A; +//! : ^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 27 | var ResultIsBoolean3 = delete A; +//! : ^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 28 | var ResultIsBoolean4 = delete M; +//! : ^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 28 | var ResultIsBoolean4 = delete M; +//! : ^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 29 | var ResultIsBoolean5 = delete obj; +//! : ^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 29 | var ResultIsBoolean5 = delete obj; +//! : ^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 30 | var ResultIsBoolean6 = delete obj1; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 30 | var ResultIsBoolean6 = delete obj1; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 33 | var ResultIsBoolean7 = delete undefined; +//! : ^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 33 | var ResultIsBoolean7 = delete undefined; +//! : ^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 34 | var ResultIsBoolean8 = delete null; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 42 | var ResultIsBoolean14 = delete foo(); +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 43 | var ResultIsBoolean15 = delete A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 44 | var ResultIsBoolean16 = delete (ANY + ANY1); +//! : ^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 45 | var ResultIsBoolean17 = delete (null + undefined); +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 46 | var ResultIsBoolean18 = delete (null + null); +//! : ^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 47 | var ResultIsBoolean19 = delete (undefined + undefined); +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 50 | var ResultIsBoolean20 = delete delete ANY; +//! : ^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 50 | var ResultIsBoolean20 = delete delete ANY; +//! : ^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 50 | var ResultIsBoolean20 = delete delete ANY; +//! : ^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 51 | var ResultIsBoolean21 = delete delete delete (ANY + ANY1); +//! : ^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 51 | var ResultIsBoolean21 = delete delete delete (ANY + ANY1); +//! : ^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 51 | var ResultIsBoolean21 = delete delete delete (ANY + ANY1); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 54 | delete ANY; +//! : ^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 54 | delete ANY; +//! : ^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 55 | delete ANY1; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 55 | delete ANY1; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 57 | delete ANY, ANY1; +//! : ^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 57 | delete ANY, ANY1; +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/deleteOperatorWithAnyOtherType_es2015.2.minified.js b/crates/swc/tests/tsc-references/deleteOperatorWithAnyOtherType_es2015.2.minified.js new file mode 100644 index 000000000000..fd2cf5d749c4 --- /dev/null +++ b/crates/swc/tests/tsc-references/deleteOperatorWithAnyOtherType_es2015.2.minified.js @@ -0,0 +1,204 @@ +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 25 | var ResultIsBoolean1 = delete ANY1; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 25 | var ResultIsBoolean1 = delete ANY1; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 26 | var ResultIsBoolean2 = delete ANY2; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 26 | var ResultIsBoolean2 = delete ANY2; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 27 | var ResultIsBoolean3 = delete A; +//! : ^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 27 | var ResultIsBoolean3 = delete A; +//! : ^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 28 | var ResultIsBoolean4 = delete M; +//! : ^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 28 | var ResultIsBoolean4 = delete M; +//! : ^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 29 | var ResultIsBoolean5 = delete obj; +//! : ^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 29 | var ResultIsBoolean5 = delete obj; +//! : ^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 30 | var ResultIsBoolean6 = delete obj1; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 30 | var ResultIsBoolean6 = delete obj1; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 33 | var ResultIsBoolean7 = delete undefined; +//! : ^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 33 | var ResultIsBoolean7 = delete undefined; +//! : ^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 34 | var ResultIsBoolean8 = delete null; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 42 | var ResultIsBoolean14 = delete foo(); +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 43 | var ResultIsBoolean15 = delete A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 44 | var ResultIsBoolean16 = delete (ANY + ANY1); +//! : ^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 45 | var ResultIsBoolean17 = delete (null + undefined); +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 46 | var ResultIsBoolean18 = delete (null + null); +//! : ^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 47 | var ResultIsBoolean19 = delete (undefined + undefined); +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 50 | var ResultIsBoolean20 = delete delete ANY; +//! : ^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 50 | var ResultIsBoolean20 = delete delete ANY; +//! : ^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 50 | var ResultIsBoolean20 = delete delete ANY; +//! : ^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 51 | var ResultIsBoolean21 = delete delete delete (ANY + ANY1); +//! : ^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 51 | var ResultIsBoolean21 = delete delete delete (ANY + ANY1); +//! : ^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 51 | var ResultIsBoolean21 = delete delete delete (ANY + ANY1); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 54 | delete ANY; +//! : ^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 54 | delete ANY; +//! : ^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 55 | delete ANY1; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 55 | delete ANY1; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 57 | delete ANY, ANY1; +//! : ^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 57 | delete ANY, ANY1; +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/deleteOperatorWithAnyOtherType_es5.1.normal.js b/crates/swc/tests/tsc-references/deleteOperatorWithAnyOtherType_es5.1.normal.js new file mode 100644 index 000000000000..fd2cf5d749c4 --- /dev/null +++ b/crates/swc/tests/tsc-references/deleteOperatorWithAnyOtherType_es5.1.normal.js @@ -0,0 +1,204 @@ +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 25 | var ResultIsBoolean1 = delete ANY1; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 25 | var ResultIsBoolean1 = delete ANY1; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 26 | var ResultIsBoolean2 = delete ANY2; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 26 | var ResultIsBoolean2 = delete ANY2; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 27 | var ResultIsBoolean3 = delete A; +//! : ^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 27 | var ResultIsBoolean3 = delete A; +//! : ^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 28 | var ResultIsBoolean4 = delete M; +//! : ^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 28 | var ResultIsBoolean4 = delete M; +//! : ^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 29 | var ResultIsBoolean5 = delete obj; +//! : ^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 29 | var ResultIsBoolean5 = delete obj; +//! : ^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 30 | var ResultIsBoolean6 = delete obj1; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 30 | var ResultIsBoolean6 = delete obj1; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 33 | var ResultIsBoolean7 = delete undefined; +//! : ^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 33 | var ResultIsBoolean7 = delete undefined; +//! : ^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 34 | var ResultIsBoolean8 = delete null; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 42 | var ResultIsBoolean14 = delete foo(); +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 43 | var ResultIsBoolean15 = delete A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 44 | var ResultIsBoolean16 = delete (ANY + ANY1); +//! : ^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 45 | var ResultIsBoolean17 = delete (null + undefined); +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 46 | var ResultIsBoolean18 = delete (null + null); +//! : ^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 47 | var ResultIsBoolean19 = delete (undefined + undefined); +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 50 | var ResultIsBoolean20 = delete delete ANY; +//! : ^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 50 | var ResultIsBoolean20 = delete delete ANY; +//! : ^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 50 | var ResultIsBoolean20 = delete delete ANY; +//! : ^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 51 | var ResultIsBoolean21 = delete delete delete (ANY + ANY1); +//! : ^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 51 | var ResultIsBoolean21 = delete delete delete (ANY + ANY1); +//! : ^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 51 | var ResultIsBoolean21 = delete delete delete (ANY + ANY1); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 54 | delete ANY; +//! : ^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 54 | delete ANY; +//! : ^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 55 | delete ANY1; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 55 | delete ANY1; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 57 | delete ANY, ANY1; +//! : ^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 57 | delete ANY, ANY1; +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/deleteOperatorWithAnyOtherType_es5.2.minified.js b/crates/swc/tests/tsc-references/deleteOperatorWithAnyOtherType_es5.2.minified.js new file mode 100644 index 000000000000..fd2cf5d749c4 --- /dev/null +++ b/crates/swc/tests/tsc-references/deleteOperatorWithAnyOtherType_es5.2.minified.js @@ -0,0 +1,204 @@ +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 25 | var ResultIsBoolean1 = delete ANY1; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 25 | var ResultIsBoolean1 = delete ANY1; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 26 | var ResultIsBoolean2 = delete ANY2; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 26 | var ResultIsBoolean2 = delete ANY2; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 27 | var ResultIsBoolean3 = delete A; +//! : ^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 27 | var ResultIsBoolean3 = delete A; +//! : ^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 28 | var ResultIsBoolean4 = delete M; +//! : ^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 28 | var ResultIsBoolean4 = delete M; +//! : ^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 29 | var ResultIsBoolean5 = delete obj; +//! : ^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 29 | var ResultIsBoolean5 = delete obj; +//! : ^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 30 | var ResultIsBoolean6 = delete obj1; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 30 | var ResultIsBoolean6 = delete obj1; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 33 | var ResultIsBoolean7 = delete undefined; +//! : ^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 33 | var ResultIsBoolean7 = delete undefined; +//! : ^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 34 | var ResultIsBoolean8 = delete null; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 42 | var ResultIsBoolean14 = delete foo(); +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 43 | var ResultIsBoolean15 = delete A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 44 | var ResultIsBoolean16 = delete (ANY + ANY1); +//! : ^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 45 | var ResultIsBoolean17 = delete (null + undefined); +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 46 | var ResultIsBoolean18 = delete (null + null); +//! : ^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 47 | var ResultIsBoolean19 = delete (undefined + undefined); +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 50 | var ResultIsBoolean20 = delete delete ANY; +//! : ^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 50 | var ResultIsBoolean20 = delete delete ANY; +//! : ^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 50 | var ResultIsBoolean20 = delete delete ANY; +//! : ^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 51 | var ResultIsBoolean21 = delete delete delete (ANY + ANY1); +//! : ^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 51 | var ResultIsBoolean21 = delete delete delete (ANY + ANY1); +//! : ^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 51 | var ResultIsBoolean21 = delete delete delete (ANY + ANY1); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 54 | delete ANY; +//! : ^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 54 | delete ANY; +//! : ^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 55 | delete ANY1; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 55 | delete ANY1; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 57 | delete ANY, ANY1; +//! : ^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 57 | delete ANY, ANY1; +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/deleteOperatorWithBooleanType_es2015.1.normal.js b/crates/swc/tests/tsc-references/deleteOperatorWithBooleanType_es2015.1.normal.js new file mode 100644 index 000000000000..227bc83447e5 --- /dev/null +++ b/crates/swc/tests/tsc-references/deleteOperatorWithBooleanType_es2015.1.normal.js @@ -0,0 +1,90 @@ +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 17 | var ResultIsBoolean1 = delete BOOLEAN; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 17 | var ResultIsBoolean1 = delete BOOLEAN; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 20 | var ResultIsBoolean2 = delete true; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 21 | var ResultIsBoolean3 = delete { x: true, y: false }; +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 26 | var ResultIsBoolean6 = delete foo(); +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 27 | var ResultIsBoolean7 = delete A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 30 | var ResultIsBoolean8 = delete delete BOOLEAN; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 30 | var ResultIsBoolean8 = delete delete BOOLEAN; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 30 | var ResultIsBoolean8 = delete delete BOOLEAN; +//! : ^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 33 | delete true; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 34 | delete BOOLEAN; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 34 | delete BOOLEAN; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 35 | delete foo(); +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | delete true, false; +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/deleteOperatorWithBooleanType_es2015.2.minified.js b/crates/swc/tests/tsc-references/deleteOperatorWithBooleanType_es2015.2.minified.js new file mode 100644 index 000000000000..227bc83447e5 --- /dev/null +++ b/crates/swc/tests/tsc-references/deleteOperatorWithBooleanType_es2015.2.minified.js @@ -0,0 +1,90 @@ +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 17 | var ResultIsBoolean1 = delete BOOLEAN; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 17 | var ResultIsBoolean1 = delete BOOLEAN; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 20 | var ResultIsBoolean2 = delete true; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 21 | var ResultIsBoolean3 = delete { x: true, y: false }; +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 26 | var ResultIsBoolean6 = delete foo(); +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 27 | var ResultIsBoolean7 = delete A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 30 | var ResultIsBoolean8 = delete delete BOOLEAN; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 30 | var ResultIsBoolean8 = delete delete BOOLEAN; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 30 | var ResultIsBoolean8 = delete delete BOOLEAN; +//! : ^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 33 | delete true; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 34 | delete BOOLEAN; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 34 | delete BOOLEAN; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 35 | delete foo(); +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | delete true, false; +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/deleteOperatorWithBooleanType_es5.1.normal.js b/crates/swc/tests/tsc-references/deleteOperatorWithBooleanType_es5.1.normal.js new file mode 100644 index 000000000000..227bc83447e5 --- /dev/null +++ b/crates/swc/tests/tsc-references/deleteOperatorWithBooleanType_es5.1.normal.js @@ -0,0 +1,90 @@ +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 17 | var ResultIsBoolean1 = delete BOOLEAN; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 17 | var ResultIsBoolean1 = delete BOOLEAN; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 20 | var ResultIsBoolean2 = delete true; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 21 | var ResultIsBoolean3 = delete { x: true, y: false }; +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 26 | var ResultIsBoolean6 = delete foo(); +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 27 | var ResultIsBoolean7 = delete A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 30 | var ResultIsBoolean8 = delete delete BOOLEAN; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 30 | var ResultIsBoolean8 = delete delete BOOLEAN; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 30 | var ResultIsBoolean8 = delete delete BOOLEAN; +//! : ^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 33 | delete true; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 34 | delete BOOLEAN; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 34 | delete BOOLEAN; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 35 | delete foo(); +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | delete true, false; +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/deleteOperatorWithBooleanType_es5.2.minified.js b/crates/swc/tests/tsc-references/deleteOperatorWithBooleanType_es5.2.minified.js new file mode 100644 index 000000000000..227bc83447e5 --- /dev/null +++ b/crates/swc/tests/tsc-references/deleteOperatorWithBooleanType_es5.2.minified.js @@ -0,0 +1,90 @@ +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 17 | var ResultIsBoolean1 = delete BOOLEAN; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 17 | var ResultIsBoolean1 = delete BOOLEAN; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 20 | var ResultIsBoolean2 = delete true; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 21 | var ResultIsBoolean3 = delete { x: true, y: false }; +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 26 | var ResultIsBoolean6 = delete foo(); +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 27 | var ResultIsBoolean7 = delete A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 30 | var ResultIsBoolean8 = delete delete BOOLEAN; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 30 | var ResultIsBoolean8 = delete delete BOOLEAN; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 30 | var ResultIsBoolean8 = delete delete BOOLEAN; +//! : ^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 33 | delete true; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 34 | delete BOOLEAN; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 34 | delete BOOLEAN; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 35 | delete foo(); +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | delete true, false; +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/deleteOperatorWithEnumType_es2015.1.normal.js b/crates/swc/tests/tsc-references/deleteOperatorWithEnumType_es2015.1.normal.js new file mode 100644 index 000000000000..6ba87d44c27c --- /dev/null +++ b/crates/swc/tests/tsc-references/deleteOperatorWithEnumType_es2015.1.normal.js @@ -0,0 +1,108 @@ +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 7 | var ResultIsBoolean1 = delete ENUM; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 7 | var ResultIsBoolean1 = delete ENUM; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 8 | var ResultIsBoolean2 = delete ENUM1; +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 8 | var ResultIsBoolean2 = delete ENUM1; +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 12 | var ResultIsBoolean4 = delete (ENUM[0] + ENUM1["B"]); +//! : ^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 15 | var ResultIsBoolean5 = delete delete ENUM; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 15 | var ResultIsBoolean5 = delete delete ENUM; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 15 | var ResultIsBoolean5 = delete delete ENUM; +//! : ^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 16 | var ResultIsBoolean6 = delete delete delete (ENUM[0] + ENUM1["B"]); +//! : ^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 16 | var ResultIsBoolean6 = delete delete delete (ENUM[0] + ENUM1["B"]); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 16 | var ResultIsBoolean6 = delete delete delete (ENUM[0] + ENUM1["B"]); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 19 | delete ENUM; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 19 | delete ENUM; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 20 | delete ENUM1; +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 20 | delete ENUM1; +//! : ^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 22 | delete ENUM, ENUM1; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 22 | delete ENUM, ENUM1; +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/deleteOperatorWithEnumType_es2015.2.minified.js b/crates/swc/tests/tsc-references/deleteOperatorWithEnumType_es2015.2.minified.js new file mode 100644 index 000000000000..6ba87d44c27c --- /dev/null +++ b/crates/swc/tests/tsc-references/deleteOperatorWithEnumType_es2015.2.minified.js @@ -0,0 +1,108 @@ +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 7 | var ResultIsBoolean1 = delete ENUM; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 7 | var ResultIsBoolean1 = delete ENUM; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 8 | var ResultIsBoolean2 = delete ENUM1; +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 8 | var ResultIsBoolean2 = delete ENUM1; +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 12 | var ResultIsBoolean4 = delete (ENUM[0] + ENUM1["B"]); +//! : ^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 15 | var ResultIsBoolean5 = delete delete ENUM; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 15 | var ResultIsBoolean5 = delete delete ENUM; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 15 | var ResultIsBoolean5 = delete delete ENUM; +//! : ^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 16 | var ResultIsBoolean6 = delete delete delete (ENUM[0] + ENUM1["B"]); +//! : ^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 16 | var ResultIsBoolean6 = delete delete delete (ENUM[0] + ENUM1["B"]); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 16 | var ResultIsBoolean6 = delete delete delete (ENUM[0] + ENUM1["B"]); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 19 | delete ENUM; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 19 | delete ENUM; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 20 | delete ENUM1; +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 20 | delete ENUM1; +//! : ^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 22 | delete ENUM, ENUM1; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 22 | delete ENUM, ENUM1; +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/deleteOperatorWithEnumType_es5.1.normal.js b/crates/swc/tests/tsc-references/deleteOperatorWithEnumType_es5.1.normal.js new file mode 100644 index 000000000000..6ba87d44c27c --- /dev/null +++ b/crates/swc/tests/tsc-references/deleteOperatorWithEnumType_es5.1.normal.js @@ -0,0 +1,108 @@ +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 7 | var ResultIsBoolean1 = delete ENUM; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 7 | var ResultIsBoolean1 = delete ENUM; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 8 | var ResultIsBoolean2 = delete ENUM1; +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 8 | var ResultIsBoolean2 = delete ENUM1; +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 12 | var ResultIsBoolean4 = delete (ENUM[0] + ENUM1["B"]); +//! : ^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 15 | var ResultIsBoolean5 = delete delete ENUM; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 15 | var ResultIsBoolean5 = delete delete ENUM; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 15 | var ResultIsBoolean5 = delete delete ENUM; +//! : ^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 16 | var ResultIsBoolean6 = delete delete delete (ENUM[0] + ENUM1["B"]); +//! : ^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 16 | var ResultIsBoolean6 = delete delete delete (ENUM[0] + ENUM1["B"]); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 16 | var ResultIsBoolean6 = delete delete delete (ENUM[0] + ENUM1["B"]); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 19 | delete ENUM; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 19 | delete ENUM; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 20 | delete ENUM1; +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 20 | delete ENUM1; +//! : ^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 22 | delete ENUM, ENUM1; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 22 | delete ENUM, ENUM1; +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/deleteOperatorWithEnumType_es5.2.minified.js b/crates/swc/tests/tsc-references/deleteOperatorWithEnumType_es5.2.minified.js new file mode 100644 index 000000000000..6ba87d44c27c --- /dev/null +++ b/crates/swc/tests/tsc-references/deleteOperatorWithEnumType_es5.2.minified.js @@ -0,0 +1,108 @@ +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 7 | var ResultIsBoolean1 = delete ENUM; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 7 | var ResultIsBoolean1 = delete ENUM; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 8 | var ResultIsBoolean2 = delete ENUM1; +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 8 | var ResultIsBoolean2 = delete ENUM1; +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 12 | var ResultIsBoolean4 = delete (ENUM[0] + ENUM1["B"]); +//! : ^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 15 | var ResultIsBoolean5 = delete delete ENUM; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 15 | var ResultIsBoolean5 = delete delete ENUM; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 15 | var ResultIsBoolean5 = delete delete ENUM; +//! : ^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 16 | var ResultIsBoolean6 = delete delete delete (ENUM[0] + ENUM1["B"]); +//! : ^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 16 | var ResultIsBoolean6 = delete delete delete (ENUM[0] + ENUM1["B"]); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 16 | var ResultIsBoolean6 = delete delete delete (ENUM[0] + ENUM1["B"]); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 19 | delete ENUM; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 19 | delete ENUM; +//! : ^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 20 | delete ENUM1; +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 20 | delete ENUM1; +//! : ^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 22 | delete ENUM, ENUM1; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 22 | delete ENUM, ENUM1; +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/deleteOperatorWithNumberType_es2015.1.normal.js b/crates/swc/tests/tsc-references/deleteOperatorWithNumberType_es2015.1.normal.js new file mode 100644 index 000000000000..78a05aa8b713 --- /dev/null +++ b/crates/swc/tests/tsc-references/deleteOperatorWithNumberType_es2015.1.normal.js @@ -0,0 +1,138 @@ +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 18 | var ResultIsBoolean1 = delete NUMBER; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 18 | var ResultIsBoolean1 = delete NUMBER; +//! : ^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 19 | var ResultIsBoolean2 = delete NUMBER1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 19 | var ResultIsBoolean2 = delete NUMBER1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 22 | var ResultIsBoolean3 = delete 1; +//! : ^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 23 | var ResultIsBoolean4 = delete { x: 1, y: 2}; +//! : ^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 24 | var ResultIsBoolean5 = delete { x: 1, y: (n: number) => { return n; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 30 | var ResultIsBoolean9 = delete foo(); +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 31 | var ResultIsBoolean10 = delete A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 32 | var ResultIsBoolean11 = delete (NUMBER + NUMBER); +//! : ^^^^^^^^^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 35 | var ResultIsBoolean12 = delete delete NUMBER; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 35 | var ResultIsBoolean12 = delete delete NUMBER; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 35 | var ResultIsBoolean12 = delete delete NUMBER; +//! : ^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | var ResultIsBoolean13 = delete delete delete (NUMBER + NUMBER); +//! : ^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | var ResultIsBoolean13 = delete delete delete (NUMBER + NUMBER); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | var ResultIsBoolean13 = delete delete delete (NUMBER + NUMBER); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 39 | delete 1; +//! : ^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 40 | delete NUMBER; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 40 | delete NUMBER; +//! : ^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 41 | delete NUMBER1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 41 | delete NUMBER1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 42 | delete foo(); +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/deleteOperatorWithNumberType_es2015.2.minified.js b/crates/swc/tests/tsc-references/deleteOperatorWithNumberType_es2015.2.minified.js new file mode 100644 index 000000000000..78a05aa8b713 --- /dev/null +++ b/crates/swc/tests/tsc-references/deleteOperatorWithNumberType_es2015.2.minified.js @@ -0,0 +1,138 @@ +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 18 | var ResultIsBoolean1 = delete NUMBER; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 18 | var ResultIsBoolean1 = delete NUMBER; +//! : ^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 19 | var ResultIsBoolean2 = delete NUMBER1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 19 | var ResultIsBoolean2 = delete NUMBER1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 22 | var ResultIsBoolean3 = delete 1; +//! : ^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 23 | var ResultIsBoolean4 = delete { x: 1, y: 2}; +//! : ^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 24 | var ResultIsBoolean5 = delete { x: 1, y: (n: number) => { return n; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 30 | var ResultIsBoolean9 = delete foo(); +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 31 | var ResultIsBoolean10 = delete A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 32 | var ResultIsBoolean11 = delete (NUMBER + NUMBER); +//! : ^^^^^^^^^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 35 | var ResultIsBoolean12 = delete delete NUMBER; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 35 | var ResultIsBoolean12 = delete delete NUMBER; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 35 | var ResultIsBoolean12 = delete delete NUMBER; +//! : ^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | var ResultIsBoolean13 = delete delete delete (NUMBER + NUMBER); +//! : ^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | var ResultIsBoolean13 = delete delete delete (NUMBER + NUMBER); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | var ResultIsBoolean13 = delete delete delete (NUMBER + NUMBER); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 39 | delete 1; +//! : ^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 40 | delete NUMBER; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 40 | delete NUMBER; +//! : ^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 41 | delete NUMBER1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 41 | delete NUMBER1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 42 | delete foo(); +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/deleteOperatorWithNumberType_es5.1.normal.js b/crates/swc/tests/tsc-references/deleteOperatorWithNumberType_es5.1.normal.js new file mode 100644 index 000000000000..78a05aa8b713 --- /dev/null +++ b/crates/swc/tests/tsc-references/deleteOperatorWithNumberType_es5.1.normal.js @@ -0,0 +1,138 @@ +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 18 | var ResultIsBoolean1 = delete NUMBER; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 18 | var ResultIsBoolean1 = delete NUMBER; +//! : ^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 19 | var ResultIsBoolean2 = delete NUMBER1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 19 | var ResultIsBoolean2 = delete NUMBER1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 22 | var ResultIsBoolean3 = delete 1; +//! : ^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 23 | var ResultIsBoolean4 = delete { x: 1, y: 2}; +//! : ^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 24 | var ResultIsBoolean5 = delete { x: 1, y: (n: number) => { return n; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 30 | var ResultIsBoolean9 = delete foo(); +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 31 | var ResultIsBoolean10 = delete A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 32 | var ResultIsBoolean11 = delete (NUMBER + NUMBER); +//! : ^^^^^^^^^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 35 | var ResultIsBoolean12 = delete delete NUMBER; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 35 | var ResultIsBoolean12 = delete delete NUMBER; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 35 | var ResultIsBoolean12 = delete delete NUMBER; +//! : ^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | var ResultIsBoolean13 = delete delete delete (NUMBER + NUMBER); +//! : ^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | var ResultIsBoolean13 = delete delete delete (NUMBER + NUMBER); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | var ResultIsBoolean13 = delete delete delete (NUMBER + NUMBER); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 39 | delete 1; +//! : ^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 40 | delete NUMBER; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 40 | delete NUMBER; +//! : ^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 41 | delete NUMBER1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 41 | delete NUMBER1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 42 | delete foo(); +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/deleteOperatorWithNumberType_es5.2.minified.js b/crates/swc/tests/tsc-references/deleteOperatorWithNumberType_es5.2.minified.js new file mode 100644 index 000000000000..78a05aa8b713 --- /dev/null +++ b/crates/swc/tests/tsc-references/deleteOperatorWithNumberType_es5.2.minified.js @@ -0,0 +1,138 @@ +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 18 | var ResultIsBoolean1 = delete NUMBER; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 18 | var ResultIsBoolean1 = delete NUMBER; +//! : ^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 19 | var ResultIsBoolean2 = delete NUMBER1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 19 | var ResultIsBoolean2 = delete NUMBER1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 22 | var ResultIsBoolean3 = delete 1; +//! : ^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 23 | var ResultIsBoolean4 = delete { x: 1, y: 2}; +//! : ^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 24 | var ResultIsBoolean5 = delete { x: 1, y: (n: number) => { return n; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 30 | var ResultIsBoolean9 = delete foo(); +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 31 | var ResultIsBoolean10 = delete A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 32 | var ResultIsBoolean11 = delete (NUMBER + NUMBER); +//! : ^^^^^^^^^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 35 | var ResultIsBoolean12 = delete delete NUMBER; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 35 | var ResultIsBoolean12 = delete delete NUMBER; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 35 | var ResultIsBoolean12 = delete delete NUMBER; +//! : ^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | var ResultIsBoolean13 = delete delete delete (NUMBER + NUMBER); +//! : ^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | var ResultIsBoolean13 = delete delete delete (NUMBER + NUMBER); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | var ResultIsBoolean13 = delete delete delete (NUMBER + NUMBER); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 39 | delete 1; +//! : ^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 40 | delete NUMBER; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 40 | delete NUMBER; +//! : ^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 41 | delete NUMBER1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 41 | delete NUMBER1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 42 | delete foo(); +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/deleteOperatorWithStringType_es2015.1.normal.js b/crates/swc/tests/tsc-references/deleteOperatorWithStringType_es2015.1.normal.js new file mode 100644 index 000000000000..b8bf36c4eaeb --- /dev/null +++ b/crates/swc/tests/tsc-references/deleteOperatorWithStringType_es2015.1.normal.js @@ -0,0 +1,144 @@ +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 18 | var ResultIsBoolean1 = delete STRING; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 18 | var ResultIsBoolean1 = delete STRING; +//! : ^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 19 | var ResultIsBoolean2 = delete STRING1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 19 | var ResultIsBoolean2 = delete STRING1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 22 | var ResultIsBoolean3 = delete ""; +//! : ^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 23 | var ResultIsBoolean4 = delete { x: "", y: "" }; +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 24 | var ResultIsBoolean5 = delete { x: "", y: (s: string) => { return s; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 30 | var ResultIsBoolean9 = delete foo(); +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 31 | var ResultIsBoolean10 = delete A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 32 | var ResultIsBoolean11 = delete (STRING + STRING); +//! : ^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 33 | var ResultIsBoolean12 = delete STRING.charAt(0); +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 36 | var ResultIsBoolean13 = delete delete STRING; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | var ResultIsBoolean13 = delete delete STRING; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | var ResultIsBoolean13 = delete delete STRING; +//! : ^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 37 | var ResultIsBoolean14 = delete delete delete (STRING + STRING); +//! : ^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 37 | var ResultIsBoolean14 = delete delete delete (STRING + STRING); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 37 | var ResultIsBoolean14 = delete delete delete (STRING + STRING); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 40 | delete ""; +//! : ^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 41 | delete STRING; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 41 | delete STRING; +//! : ^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 42 | delete STRING1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 42 | delete STRING1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 43 | delete foo(); +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/deleteOperatorWithStringType_es2015.2.minified.js b/crates/swc/tests/tsc-references/deleteOperatorWithStringType_es2015.2.minified.js new file mode 100644 index 000000000000..b8bf36c4eaeb --- /dev/null +++ b/crates/swc/tests/tsc-references/deleteOperatorWithStringType_es2015.2.minified.js @@ -0,0 +1,144 @@ +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 18 | var ResultIsBoolean1 = delete STRING; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 18 | var ResultIsBoolean1 = delete STRING; +//! : ^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 19 | var ResultIsBoolean2 = delete STRING1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 19 | var ResultIsBoolean2 = delete STRING1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 22 | var ResultIsBoolean3 = delete ""; +//! : ^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 23 | var ResultIsBoolean4 = delete { x: "", y: "" }; +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 24 | var ResultIsBoolean5 = delete { x: "", y: (s: string) => { return s; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 30 | var ResultIsBoolean9 = delete foo(); +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 31 | var ResultIsBoolean10 = delete A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 32 | var ResultIsBoolean11 = delete (STRING + STRING); +//! : ^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 33 | var ResultIsBoolean12 = delete STRING.charAt(0); +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 36 | var ResultIsBoolean13 = delete delete STRING; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | var ResultIsBoolean13 = delete delete STRING; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | var ResultIsBoolean13 = delete delete STRING; +//! : ^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 37 | var ResultIsBoolean14 = delete delete delete (STRING + STRING); +//! : ^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 37 | var ResultIsBoolean14 = delete delete delete (STRING + STRING); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 37 | var ResultIsBoolean14 = delete delete delete (STRING + STRING); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 40 | delete ""; +//! : ^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 41 | delete STRING; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 41 | delete STRING; +//! : ^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 42 | delete STRING1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 42 | delete STRING1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 43 | delete foo(); +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/deleteOperatorWithStringType_es5.1.normal.js b/crates/swc/tests/tsc-references/deleteOperatorWithStringType_es5.1.normal.js new file mode 100644 index 000000000000..b8bf36c4eaeb --- /dev/null +++ b/crates/swc/tests/tsc-references/deleteOperatorWithStringType_es5.1.normal.js @@ -0,0 +1,144 @@ +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 18 | var ResultIsBoolean1 = delete STRING; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 18 | var ResultIsBoolean1 = delete STRING; +//! : ^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 19 | var ResultIsBoolean2 = delete STRING1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 19 | var ResultIsBoolean2 = delete STRING1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 22 | var ResultIsBoolean3 = delete ""; +//! : ^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 23 | var ResultIsBoolean4 = delete { x: "", y: "" }; +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 24 | var ResultIsBoolean5 = delete { x: "", y: (s: string) => { return s; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 30 | var ResultIsBoolean9 = delete foo(); +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 31 | var ResultIsBoolean10 = delete A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 32 | var ResultIsBoolean11 = delete (STRING + STRING); +//! : ^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 33 | var ResultIsBoolean12 = delete STRING.charAt(0); +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 36 | var ResultIsBoolean13 = delete delete STRING; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | var ResultIsBoolean13 = delete delete STRING; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | var ResultIsBoolean13 = delete delete STRING; +//! : ^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 37 | var ResultIsBoolean14 = delete delete delete (STRING + STRING); +//! : ^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 37 | var ResultIsBoolean14 = delete delete delete (STRING + STRING); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 37 | var ResultIsBoolean14 = delete delete delete (STRING + STRING); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 40 | delete ""; +//! : ^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 41 | delete STRING; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 41 | delete STRING; +//! : ^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 42 | delete STRING1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 42 | delete STRING1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 43 | delete foo(); +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/deleteOperatorWithStringType_es5.2.minified.js b/crates/swc/tests/tsc-references/deleteOperatorWithStringType_es5.2.minified.js new file mode 100644 index 000000000000..b8bf36c4eaeb --- /dev/null +++ b/crates/swc/tests/tsc-references/deleteOperatorWithStringType_es5.2.minified.js @@ -0,0 +1,144 @@ +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 18 | var ResultIsBoolean1 = delete STRING; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 18 | var ResultIsBoolean1 = delete STRING; +//! : ^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 19 | var ResultIsBoolean2 = delete STRING1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 19 | var ResultIsBoolean2 = delete STRING1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 22 | var ResultIsBoolean3 = delete ""; +//! : ^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 23 | var ResultIsBoolean4 = delete { x: "", y: "" }; +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 24 | var ResultIsBoolean5 = delete { x: "", y: (s: string) => { return s; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 30 | var ResultIsBoolean9 = delete foo(); +//! : ^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 31 | var ResultIsBoolean10 = delete A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 32 | var ResultIsBoolean11 = delete (STRING + STRING); +//! : ^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 33 | var ResultIsBoolean12 = delete STRING.charAt(0); +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 36 | var ResultIsBoolean13 = delete delete STRING; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | var ResultIsBoolean13 = delete delete STRING; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | var ResultIsBoolean13 = delete delete STRING; +//! : ^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 37 | var ResultIsBoolean14 = delete delete delete (STRING + STRING); +//! : ^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 37 | var ResultIsBoolean14 = delete delete delete (STRING + STRING); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 37 | var ResultIsBoolean14 = delete delete delete (STRING + STRING); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 40 | delete ""; +//! : ^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 41 | delete STRING; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 41 | delete STRING; +//! : ^^^^^^ +//! `---- +//! +//! x 'delete' cannot be called on an identifier in strict mode +//! ,---- +//! 42 | delete STRING1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 42 | delete STRING1; +//! : ^^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 43 | delete foo(); +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5_es2015.1.normal.js b/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5_es2015.1.normal.js index 37e1d73feaa0..5a7c39cb0591 100644 --- a/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5_es2015.1.normal.js @@ -1,184 +1,10 @@ -// A parameter declaration may specify either an identifier or a binding pattern. -// The identifiers specified in parameter declarations and binding patterns -// in a parameter list must be unique within that parameter list. -// If the declaration includes a type annotation, the parameter is of that type -function a1([a, b, [[c]]]) {} -function a2(o) {} -function a3({ j , k , l: { m , n } , q: [a, b, c] }) {} -function a4({ x , a }) {} -a1([ - 1, - 2, - [ - [ - "world" - ] - ] -]); -a1([ - 1, - 2, - [ - [ - "world" - ] - ], - 3 -]); -// If the declaration includes an initializer expression (which is permitted only -// when the parameter list occurs in conjunction with a function body), -// the parameter type is the widened form (section 3.11) of the type of the initializer expression. -function b1(z = [ - undefined, - null -]) {} -function b2(z = null, o = { - x: 0, - y: undefined -}) {} -function b3({ z: { x , y: { j } } } = { - z: { - x: "hi", - y: { - j: 1 - } - } -}) {} -function b6([a, z, y] = [ - undefined, - null, - undefined -]) {} -function b7([[a], b, [[c, d]]] = [ - [ - undefined - ], - undefined, - [ - [ - undefined, - undefined - ] - ] -]) {} -b1([ - 1, - 2, - 3 -]); // z is widen to the type any[] -b2("string", { - x: 200, - y: "string" -}); -b2("string", { - x: 200, - y: true -}); -b6([ - "string", - 1, - 2 -]); // Shouldn't be an error -b7([ - [ - "string" - ], - 1, - [ - [ - true, - false - ] - ] -]); // Shouldn't be an error -var // If the declaration specifies a binding pattern, the parameter type is the implied type of that binding pattern (section 5.1.3) -Foo; -(function(Foo) { - Foo[Foo["a"] = 0] = "a"; -})(Foo || (Foo = {})); -function c0({ z: { x , y: { j } } }) {} -function c1({ z } = { - z: 10 -}) {} -function c2({ z =10 }) {} -function c3({ b } = { - b: "hello" -}) {} -function c5([a, b, [[c]]]) {} -function c6([a, b, [[c = 1]]]) {} -c0({ - z: { - x: 1, - y: { - j: "world" - } - } -}); // Implied type is { z: {x: any, y: {j: any}} } -c0({ - z: { - x: "string", - y: { - j: true - } - } -}); // Implied type is { z: {x: any, y: {j: any}} } -c1(); // Implied type is {z:number}? -c1({ - z: 1 -}) // Implied type is {z:number}? -; -c2({}); // Implied type is {z?: number} -c2({ - z: 1 -}); // Implied type is {z?: number} -c3({ - b: 1 -}); // Implied type is { b: number|string }. -c5([ - 1, - 2, - [ - [ - "string" - ] - ] -]); // Implied type is is [any, any, [[any]]] -c5([ - 1, - 2, - [ - [ - "string" - ] - ], - false, - true -]); // Implied type is is [any, any, [[any]]] -// A parameter can be marked optional by following its name or binding pattern with a question mark (?) -// or by including an initializer. -function d0(x) {} -function d0(x = 10) {} -class C2 { - d3() {} - d4() {} - e0([a, b, c]) {} - constructor(){} -} -class C3 { - d3([a, b, c]) {} - d4({ x , y , z }) {} - e0([a, b, c]) {} -} -function d5({ x , y } = { - x: 1, - y: 2 -}) {} -d5(); // Parameter is optional as its declaration included an initializer -// Destructuring parameter declarations do not permit type annotations on the individual binding patterns, -// as such annotations would conflict with the already established meaning of colons in object literals. -// Type annotations must instead be written on the top- level parameter declaration -function e1({ x: number }) {} // x has type any NOT number -function e2({ x }) {} // x is type number -function e3({ x }) {} // x is an optional with type number -function e4({ x: [number, string, any] }) {} // x has type [any, any, any] -function e5({ x: [a, b, c] }) {} // x has type [any, any, any] +//! +//! x the name `d0` is defined multiple times +//! ,-[62:1] +//! 62 | function d0(x?) { } +//! : ^| +//! : `-- previous definition of `d0` here +//! 63 | function d0(x = 10) { } +//! : ^| +//! : `-- `d0` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5_es2015.2.minified.js b/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5_es2015.2.minified.js index 50b7338956ec..5a7c39cb0591 100644 --- a/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5_es2015.2.minified.js @@ -1,115 +1,10 @@ -var Foo; -function a1([a, b, [[c]]]) {} -function b2(z = null, o = { - x: 0, - y: void 0 -}) {} -function c0({ z: { x , y: { j } } }) {} -function c1({ z } = { - z: 10 -}) {} -function c2({ z =10 }) {} -function c5([a, b, [[c]]]) {} -a1([ - 1, - 2, - [ - [ - "world" - ] - ] -]), a1([ - 1, - 2, - [ - [ - "world" - ] - ], - 3 -]), function(z = [ - void 0, - null -]) {}([ - 1, - 2, - 3 -]), b2("string", { - x: 200, - y: "string" -}), b2("string", { - x: 200, - y: !0 -}), function([a, z, y] = [ - void 0, - null, - void 0 -]) {}([ - "string", - 1, - 2 -]), function([[a], b, [[c, d]]] = [ - [ - void 0 - ], - void 0, - [ - [ - void 0, - void 0 - ] - ] -]) {}([ - [ - "string" - ], - 1, - [ - [ - !0, - !1 - ] - ] -]), function(Foo) { - Foo[Foo.a = 0] = "a"; -}(Foo || (Foo = {})), c0({ - z: { - x: 1, - y: { - j: "world" - } - } -}), c0({ - z: { - x: "string", - y: { - j: !0 - } - } -}), c1(), c1({ - z: 1 -}), c2({}), c2({ - z: 1 -}), function({ b } = { - b: "hello" -}) {}({ - b: 1 -}), c5([ - 1, - 2, - [ - [ - "string" - ] - ] -]), c5([ - 1, - 2, - [ - [ - "string" - ] - ], - !1, - !0 -]); +//! +//! x the name `d0` is defined multiple times +//! ,-[62:1] +//! 62 | function d0(x?) { } +//! : ^| +//! : `-- previous definition of `d0` here +//! 63 | function d0(x = 10) { } +//! : ^| +//! : `-- `d0` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5_es5.1.normal.js b/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5_es5.1.normal.js index 9aea2fcdddb5..5a7c39cb0591 100644 --- a/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5_es5.1.normal.js @@ -1,247 +1,10 @@ -// A parameter declaration may specify either an identifier or a binding pattern. -// The identifiers specified in parameter declarations and binding patterns -// in a parameter list must be unique within that parameter list. -// If the declaration includes a type annotation, the parameter is of that type -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; -function a1(param) { - var _param = _sliced_to_array(param, 3), a = _param[0], b = _param[1], ref = _sliced_to_array(_param[2], 1), ref1 = _sliced_to_array(ref[0], 1), c = ref1[0]; -} -function a2(o) {} -function a3(param) { - var j = param.j, k = param.k, _l = param.l, m = _l.m, n = _l.n, _q = _sliced_to_array(param.q, 3), a = _q[0], b = _q[1], c = _q[2]; -} -function a4(param) { - var x = param.x, a = param.a; -} -a1([ - 1, - 2, - [ - [ - "world" - ] - ] -]); -a1([ - 1, - 2, - [ - [ - "world" - ] - ], - 3 -]); -// If the declaration includes an initializer expression (which is permitted only -// when the parameter list occurs in conjunction with a function body), -// the parameter type is the widened form (section 3.11) of the type of the initializer expression. -function b1() { - var z = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ - undefined, - null - ]; -} -function b2() { - var z = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null, o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { - x: 0, - y: undefined - }; -} -function b3() { - var ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { - z: { - x: "hi", - y: { - j: 1 - } - } - }, _z = ref.z, x = _z.x, j = _z.y.j; -} -function b6() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ - undefined, - null, - undefined - ], 3), a = ref[0], z = ref[1], y = ref[2]; -} -function b7() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ - [ - undefined - ], - undefined, - [ - [ - undefined, - undefined - ] - ] - ], 3), ref1 = _sliced_to_array(ref[0], 1), a = ref1[0], b = ref[1], ref2 = _sliced_to_array(ref[2], 1), ref3 = _sliced_to_array(ref2[0], 2), c = ref3[0], d = ref3[1]; -} -b1([ - 1, - 2, - 3 -]); // z is widen to the type any[] -b2("string", { - x: 200, - y: "string" -}); -b2("string", { - x: 200, - y: true -}); -b6([ - "string", - 1, - 2 -]); // Shouldn't be an error -b7([ - [ - "string" - ], - 1, - [ - [ - true, - false - ] - ] -]); // Shouldn't be an error -var // If the declaration specifies a binding pattern, the parameter type is the implied type of that binding pattern (section 5.1.3) -Foo; -(function(Foo) { - Foo[Foo["a"] = 0] = "a"; -})(Foo || (Foo = {})); -function c0(param) { - var _z = param.z, x = _z.x, j = _z.y.j; -} -function c1() { - var z = (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { - z: 10 - }).z; -} -function c2(param) { - var _z = param.z, z = _z === void 0 ? 10 : _z; -} -function c3() { - var b = (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { - b: "hello" - }).b; -} -function c5(param) { - var _param = _sliced_to_array(param, 3), a = _param[0], b = _param[1], ref = _sliced_to_array(_param[2], 1), ref1 = _sliced_to_array(ref[0], 1), c = ref1[0]; -} -function c6(param) { - var _param = _sliced_to_array(param, 3), a = _param[0], b = _param[1], ref = _sliced_to_array(_param[2], 1), ref1 = _sliced_to_array(ref[0], 1), tmp = ref1[0], c = tmp === void 0 ? 1 : tmp; -} -c0({ - z: { - x: 1, - y: { - j: "world" - } - } -}); // Implied type is { z: {x: any, y: {j: any}} } -c0({ - z: { - x: "string", - y: { - j: true - } - } -}); // Implied type is { z: {x: any, y: {j: any}} } -c1(); // Implied type is {z:number}? -c1({ - z: 1 -}) // Implied type is {z:number}? -; -c2({}); // Implied type is {z?: number} -c2({ - z: 1 -}); // Implied type is {z?: number} -c3({ - b: 1 -}); // Implied type is { b: number|string }. -c5([ - 1, - 2, - [ - [ - "string" - ] - ] -]); // Implied type is is [any, any, [[any]]] -c5([ - 1, - 2, - [ - [ - "string" - ] - ], - false, - true -]); // Implied type is is [any, any, [[any]]] -// A parameter can be marked optional by following its name or binding pattern with a question mark (?) -// or by including an initializer. -function d0(x) {} -function d0() { - var x = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 10; -} -var C2 = /*#__PURE__*/ function() { - "use strict"; - function C2() { - _class_call_check(this, C2); - } - var _proto = C2.prototype; - _proto.d3 = function d3() {}; - _proto.d4 = function d4() {}; - _proto.e0 = function e0(param) { - var _param = _sliced_to_array(param, 3), a = _param[0], b = _param[1], c = _param[2]; - }; - return C2; -}(); -var C3 = /*#__PURE__*/ function() { - "use strict"; - function C3() { - _class_call_check(this, C3); - } - var _proto = C3.prototype; - _proto.d3 = function d3(param) { - var _param = _sliced_to_array(param, 3), a = _param[0], b = _param[1], c = _param[2]; - }; - _proto.d4 = function d4(param) { - var x = param.x, y = param.y, z = param.z; - }; - _proto.e0 = function e0(param) { - var _param = _sliced_to_array(param, 3), a = _param[0], b = _param[1], c = _param[2]; - }; - return C3; -}(); -function d5() { - var ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { - x: 1, - y: 2 - }, x = ref.x, y = ref.y; -} -d5(); // Parameter is optional as its declaration included an initializer -// Destructuring parameter declarations do not permit type annotations on the individual binding patterns, -// as such annotations would conflict with the already established meaning of colons in object literals. -// Type annotations must instead be written on the top- level parameter declaration -function e1(param) { - var number = param.x; -} // x has type any NOT number -function e2(param) { - var x = param.x; -} // x is type number -function e3(param) { - var x = param.x; -} // x is an optional with type number -function e4(param) { - var _x = _sliced_to_array(param.x, 3), number = _x[0], string = _x[1], any = _x[2]; -} // x has type [any, any, any] -function e5(param) { - var _x = _sliced_to_array(param.x, 3), a = _x[0], b = _x[1], c = _x[2]; -} // x has type [any, any, any] +//! +//! x the name `d0` is defined multiple times +//! ,-[62:1] +//! 62 | function d0(x?) { } +//! : ^| +//! : `-- previous definition of `d0` here +//! 63 | function d0(x = 10) { } +//! : ^| +//! : `-- `d0` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5_es5.2.minified.js b/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5_es5.2.minified.js index 08d41ee6c09c..5a7c39cb0591 100644 --- a/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5_es5.2.minified.js @@ -1,163 +1,10 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; -function a1(param) { - var _param = _sliced_to_array(param, 3), ref = (_param[0], _param[1], _sliced_to_array(_param[2], 1)), ref1 = _sliced_to_array(ref[0], 1); - ref1[0]; -} -function b2() { - arguments.length > 0 && void 0 !== arguments[0] && arguments[0], arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; -} -function c0(param) { - var _z = param.z; - _z.x, _z.y.j; -} -function c1() { - (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { - z: 10 - }).z; -} -function c5(param) { - var _param = _sliced_to_array(param, 3), ref = (_param[0], _param[1], _sliced_to_array(_param[2], 1)), ref1 = _sliced_to_array(ref[0], 1); - ref1[0]; -} -a1([ - 1, - 2, - [ - [ - "world" - ] - ] -]), a1([ - 1, - 2, - [ - [ - "world" - ] - ], - 3 -]), function() { - arguments.length > 0 && void 0 !== arguments[0] && arguments[0]; -}([ - 1, - 2, - 3 -]), b2("string", { - x: 200, - y: "string" -}), b2("string", { - x: 200, - y: !0 -}), function() { - var ref = _sliced_to_array(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [ - void 0, - null, - void 0 - ], 3); - ref[0], ref[1], ref[2]; -}([ - "string", - 1, - 2 -]), function() { - var ref = _sliced_to_array(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [ - [ - void 0 - ], - void 0, - [ - [ - void 0, - void 0 - ] - ] - ], 3), ref1 = (_sliced_to_array(ref[0], 1)[0], ref[1], _sliced_to_array(ref[2], 1)), ref2 = _sliced_to_array(ref1[0], 2); - ref2[0], ref2[1]; -}([ - [ - "string" - ], - 1, - [ - [ - !0, - !1 - ] - ] -]), function(Foo) { - Foo[Foo.a = 0] = "a"; -}(Foo || (Foo = {})), c0({ - z: { - x: 1, - y: { - j: "world" - } - } -}), c0({ - z: { - x: "string", - y: { - j: !0 - } - } -}), c1(), c1({ - z: 1 -}), ({}).z, function() { - (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { - b: "hello" - }).b; -}({ - b: 1 -}), c5([ - 1, - 2, - [ - [ - "string" - ] - ] -]), c5([ - 1, - 2, - [ - [ - "string" - ] - ], - !1, - !0 -]); -var Foo, C2 = function() { - "use strict"; - function C2() { - _class_call_check(this, C2); - } - var _proto = C2.prototype; - return _proto.d3 = function() {}, _proto.d4 = function() {}, _proto.e0 = function(param) { - var _param = _sliced_to_array(param, 3); - _param[0], _param[1], _param[2]; - }, C2; -}(), C3 = function() { - "use strict"; - function C3() { - _class_call_check(this, C3); - } - var _proto = C3.prototype; - return _proto.d3 = function(param) { - var _param = _sliced_to_array(param, 3); - _param[0], _param[1], _param[2]; - }, _proto.d4 = function(param) { - param.x, param.y, param.z; - }, _proto.e0 = function(param) { - var _param = _sliced_to_array(param, 3); - _param[0], _param[1], _param[2]; - }, C3; -}(); -!function() { - var ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { - x: 1, - y: 2 - }; - ref.x, ref.y; -}(); +//! +//! x the name `d0` is defined multiple times +//! ,-[62:1] +//! 62 | function d0(x?) { } +//! : ^| +//! : `-- previous definition of `d0` here +//! 63 | function d0(x = 10) { } +//! : ^| +//! : `-- `d0` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5iterable_es2015.1.normal.js b/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5iterable_es2015.1.normal.js index 017d56d57155..49544bc2e994 100644 --- a/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5iterable_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5iterable_es2015.1.normal.js @@ -1,185 +1,10 @@ -// @downlevelIteration: true -// A parameter declaration may specify either an identifier or a binding pattern. -// The identifiers specified in parameter declarations and binding patterns -// in a parameter list must be unique within that parameter list. -// If the declaration includes a type annotation, the parameter is of that type -function a1([a, b, [[c]]]) {} -function a2(o) {} -function a3({ j , k , l: { m , n } , q: [a, b, c] }) {} -function a4({ x , a }) {} -a1([ - 1, - 2, - [ - [ - "world" - ] - ] -]); -a1([ - 1, - 2, - [ - [ - "world" - ] - ], - 3 -]); -// If the declaration includes an initializer expression (which is permitted only -// when the parameter list occurs in conjunction with a function body), -// the parameter type is the widened form (section 3.11) of the type of the initializer expression. -function b1(z = [ - undefined, - null -]) {} -function b2(z = null, o = { - x: 0, - y: undefined -}) {} -function b3({ z: { x , y: { j } } } = { - z: { - x: "hi", - y: { - j: 1 - } - } -}) {} -function b6([a, z, y] = [ - undefined, - null, - undefined -]) {} -function b7([[a], b, [[c, d]]] = [ - [ - undefined - ], - undefined, - [ - [ - undefined, - undefined - ] - ] -]) {} -b1([ - 1, - 2, - 3 -]); // z is widen to the type any[] -b2("string", { - x: 200, - y: "string" -}); -b2("string", { - x: 200, - y: true -}); -b6([ - "string", - 1, - 2 -]); // Shouldn't be an error -b7([ - [ - "string" - ], - 1, - [ - [ - true, - false - ] - ] -]); // Shouldn't be an error -var // If the declaration specifies a binding pattern, the parameter type is the implied type of that binding pattern (section 5.1.3) -Foo; -(function(Foo) { - Foo[Foo["a"] = 0] = "a"; -})(Foo || (Foo = {})); -function c0({ z: { x , y: { j } } }) {} -function c1({ z } = { - z: 10 -}) {} -function c2({ z =10 }) {} -function c3({ b } = { - b: "hello" -}) {} -function c5([a, b, [[c]]]) {} -function c6([a, b, [[c = 1]]]) {} -c0({ - z: { - x: 1, - y: { - j: "world" - } - } -}); // Implied type is { z: {x: any, y: {j: any}} } -c0({ - z: { - x: "string", - y: { - j: true - } - } -}); // Implied type is { z: {x: any, y: {j: any}} } -c1(); // Implied type is {z:number}? -c1({ - z: 1 -}) // Implied type is {z:number}? -; -c2({}); // Implied type is {z?: number} -c2({ - z: 1 -}); // Implied type is {z?: number} -c3({ - b: 1 -}); // Implied type is { b: number|string }. -c5([ - 1, - 2, - [ - [ - "string" - ] - ] -]); // Implied type is is [any, any, [[any]]] -c5([ - 1, - 2, - [ - [ - "string" - ] - ], - false, - true -]); // Implied type is is [any, any, [[any]]] -// A parameter can be marked optional by following its name or binding pattern with a question mark (?) -// or by including an initializer. -function d0(x) {} -function d0(x = 10) {} -class C2 { - d3() {} - d4() {} - e0([a, b, c]) {} - constructor(){} -} -class C3 { - d3([a, b, c]) {} - d4({ x , y , z }) {} - e0([a, b, c]) {} -} -function d5({ x , y } = { - x: 1, - y: 2 -}) {} -d5(); // Parameter is optional as its declaration included an initializer -// Destructuring parameter declarations do not permit type annotations on the individual binding patterns, -// as such annotations would conflict with the already established meaning of colons in object literals. -// Type annotations must instead be written on the top- level parameter declaration -function e1({ x: number }) {} // x has type any NOT number -function e2({ x }) {} // x is type number -function e3({ x }) {} // x is an optional with type number -function e4({ x: [number, string, any] }) {} // x has type [any, any, any] -function e5({ x: [a, b, c] }) {} // x has type [any, any, any] +//! +//! x the name `d0` is defined multiple times +//! ,-[63:1] +//! 63 | function d0(x?) { } +//! : ^| +//! : `-- previous definition of `d0` here +//! 64 | function d0(x = 10) { } +//! : ^| +//! : `-- `d0` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5iterable_es2015.2.minified.js b/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5iterable_es2015.2.minified.js index 50b7338956ec..49544bc2e994 100644 --- a/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5iterable_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5iterable_es2015.2.minified.js @@ -1,115 +1,10 @@ -var Foo; -function a1([a, b, [[c]]]) {} -function b2(z = null, o = { - x: 0, - y: void 0 -}) {} -function c0({ z: { x , y: { j } } }) {} -function c1({ z } = { - z: 10 -}) {} -function c2({ z =10 }) {} -function c5([a, b, [[c]]]) {} -a1([ - 1, - 2, - [ - [ - "world" - ] - ] -]), a1([ - 1, - 2, - [ - [ - "world" - ] - ], - 3 -]), function(z = [ - void 0, - null -]) {}([ - 1, - 2, - 3 -]), b2("string", { - x: 200, - y: "string" -}), b2("string", { - x: 200, - y: !0 -}), function([a, z, y] = [ - void 0, - null, - void 0 -]) {}([ - "string", - 1, - 2 -]), function([[a], b, [[c, d]]] = [ - [ - void 0 - ], - void 0, - [ - [ - void 0, - void 0 - ] - ] -]) {}([ - [ - "string" - ], - 1, - [ - [ - !0, - !1 - ] - ] -]), function(Foo) { - Foo[Foo.a = 0] = "a"; -}(Foo || (Foo = {})), c0({ - z: { - x: 1, - y: { - j: "world" - } - } -}), c0({ - z: { - x: "string", - y: { - j: !0 - } - } -}), c1(), c1({ - z: 1 -}), c2({}), c2({ - z: 1 -}), function({ b } = { - b: "hello" -}) {}({ - b: 1 -}), c5([ - 1, - 2, - [ - [ - "string" - ] - ] -]), c5([ - 1, - 2, - [ - [ - "string" - ] - ], - !1, - !0 -]); +//! +//! x the name `d0` is defined multiple times +//! ,-[63:1] +//! 63 | function d0(x?) { } +//! : ^| +//! : `-- previous definition of `d0` here +//! 64 | function d0(x = 10) { } +//! : ^| +//! : `-- `d0` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5iterable_es5.1.normal.js b/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5iterable_es5.1.normal.js index 733c3c245271..49544bc2e994 100644 --- a/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5iterable_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5iterable_es5.1.normal.js @@ -1,248 +1,10 @@ -// @downlevelIteration: true -// A parameter declaration may specify either an identifier or a binding pattern. -// The identifiers specified in parameter declarations and binding patterns -// in a parameter list must be unique within that parameter list. -// If the declaration includes a type annotation, the parameter is of that type -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; -function a1(param) { - var _param = _sliced_to_array(param, 3), a = _param[0], b = _param[1], ref = _sliced_to_array(_param[2], 1), ref1 = _sliced_to_array(ref[0], 1), c = ref1[0]; -} -function a2(o) {} -function a3(param) { - var j = param.j, k = param.k, _l = param.l, m = _l.m, n = _l.n, _q = _sliced_to_array(param.q, 3), a = _q[0], b = _q[1], c = _q[2]; -} -function a4(param) { - var x = param.x, a = param.a; -} -a1([ - 1, - 2, - [ - [ - "world" - ] - ] -]); -a1([ - 1, - 2, - [ - [ - "world" - ] - ], - 3 -]); -// If the declaration includes an initializer expression (which is permitted only -// when the parameter list occurs in conjunction with a function body), -// the parameter type is the widened form (section 3.11) of the type of the initializer expression. -function b1() { - var z = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ - undefined, - null - ]; -} -function b2() { - var z = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null, o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { - x: 0, - y: undefined - }; -} -function b3() { - var ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { - z: { - x: "hi", - y: { - j: 1 - } - } - }, _z = ref.z, x = _z.x, j = _z.y.j; -} -function b6() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ - undefined, - null, - undefined - ], 3), a = ref[0], z = ref[1], y = ref[2]; -} -function b7() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ - [ - undefined - ], - undefined, - [ - [ - undefined, - undefined - ] - ] - ], 3), ref1 = _sliced_to_array(ref[0], 1), a = ref1[0], b = ref[1], ref2 = _sliced_to_array(ref[2], 1), ref3 = _sliced_to_array(ref2[0], 2), c = ref3[0], d = ref3[1]; -} -b1([ - 1, - 2, - 3 -]); // z is widen to the type any[] -b2("string", { - x: 200, - y: "string" -}); -b2("string", { - x: 200, - y: true -}); -b6([ - "string", - 1, - 2 -]); // Shouldn't be an error -b7([ - [ - "string" - ], - 1, - [ - [ - true, - false - ] - ] -]); // Shouldn't be an error -var // If the declaration specifies a binding pattern, the parameter type is the implied type of that binding pattern (section 5.1.3) -Foo; -(function(Foo) { - Foo[Foo["a"] = 0] = "a"; -})(Foo || (Foo = {})); -function c0(param) { - var _z = param.z, x = _z.x, j = _z.y.j; -} -function c1() { - var z = (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { - z: 10 - }).z; -} -function c2(param) { - var _z = param.z, z = _z === void 0 ? 10 : _z; -} -function c3() { - var b = (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { - b: "hello" - }).b; -} -function c5(param) { - var _param = _sliced_to_array(param, 3), a = _param[0], b = _param[1], ref = _sliced_to_array(_param[2], 1), ref1 = _sliced_to_array(ref[0], 1), c = ref1[0]; -} -function c6(param) { - var _param = _sliced_to_array(param, 3), a = _param[0], b = _param[1], ref = _sliced_to_array(_param[2], 1), ref1 = _sliced_to_array(ref[0], 1), tmp = ref1[0], c = tmp === void 0 ? 1 : tmp; -} -c0({ - z: { - x: 1, - y: { - j: "world" - } - } -}); // Implied type is { z: {x: any, y: {j: any}} } -c0({ - z: { - x: "string", - y: { - j: true - } - } -}); // Implied type is { z: {x: any, y: {j: any}} } -c1(); // Implied type is {z:number}? -c1({ - z: 1 -}) // Implied type is {z:number}? -; -c2({}); // Implied type is {z?: number} -c2({ - z: 1 -}); // Implied type is {z?: number} -c3({ - b: 1 -}); // Implied type is { b: number|string }. -c5([ - 1, - 2, - [ - [ - "string" - ] - ] -]); // Implied type is is [any, any, [[any]]] -c5([ - 1, - 2, - [ - [ - "string" - ] - ], - false, - true -]); // Implied type is is [any, any, [[any]]] -// A parameter can be marked optional by following its name or binding pattern with a question mark (?) -// or by including an initializer. -function d0(x) {} -function d0() { - var x = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 10; -} -var C2 = /*#__PURE__*/ function() { - "use strict"; - function C2() { - _class_call_check(this, C2); - } - var _proto = C2.prototype; - _proto.d3 = function d3() {}; - _proto.d4 = function d4() {}; - _proto.e0 = function e0(param) { - var _param = _sliced_to_array(param, 3), a = _param[0], b = _param[1], c = _param[2]; - }; - return C2; -}(); -var C3 = /*#__PURE__*/ function() { - "use strict"; - function C3() { - _class_call_check(this, C3); - } - var _proto = C3.prototype; - _proto.d3 = function d3(param) { - var _param = _sliced_to_array(param, 3), a = _param[0], b = _param[1], c = _param[2]; - }; - _proto.d4 = function d4(param) { - var x = param.x, y = param.y, z = param.z; - }; - _proto.e0 = function e0(param) { - var _param = _sliced_to_array(param, 3), a = _param[0], b = _param[1], c = _param[2]; - }; - return C3; -}(); -function d5() { - var ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { - x: 1, - y: 2 - }, x = ref.x, y = ref.y; -} -d5(); // Parameter is optional as its declaration included an initializer -// Destructuring parameter declarations do not permit type annotations on the individual binding patterns, -// as such annotations would conflict with the already established meaning of colons in object literals. -// Type annotations must instead be written on the top- level parameter declaration -function e1(param) { - var number = param.x; -} // x has type any NOT number -function e2(param) { - var x = param.x; -} // x is type number -function e3(param) { - var x = param.x; -} // x is an optional with type number -function e4(param) { - var _x = _sliced_to_array(param.x, 3), number = _x[0], string = _x[1], any = _x[2]; -} // x has type [any, any, any] -function e5(param) { - var _x = _sliced_to_array(param.x, 3), a = _x[0], b = _x[1], c = _x[2]; -} // x has type [any, any, any] +//! +//! x the name `d0` is defined multiple times +//! ,-[63:1] +//! 63 | function d0(x?) { } +//! : ^| +//! : `-- previous definition of `d0` here +//! 64 | function d0(x = 10) { } +//! : ^| +//! : `-- `d0` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5iterable_es5.2.minified.js b/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5iterable_es5.2.minified.js index 08d41ee6c09c..49544bc2e994 100644 --- a/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5iterable_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES5iterable_es5.2.minified.js @@ -1,163 +1,10 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; -function a1(param) { - var _param = _sliced_to_array(param, 3), ref = (_param[0], _param[1], _sliced_to_array(_param[2], 1)), ref1 = _sliced_to_array(ref[0], 1); - ref1[0]; -} -function b2() { - arguments.length > 0 && void 0 !== arguments[0] && arguments[0], arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; -} -function c0(param) { - var _z = param.z; - _z.x, _z.y.j; -} -function c1() { - (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { - z: 10 - }).z; -} -function c5(param) { - var _param = _sliced_to_array(param, 3), ref = (_param[0], _param[1], _sliced_to_array(_param[2], 1)), ref1 = _sliced_to_array(ref[0], 1); - ref1[0]; -} -a1([ - 1, - 2, - [ - [ - "world" - ] - ] -]), a1([ - 1, - 2, - [ - [ - "world" - ] - ], - 3 -]), function() { - arguments.length > 0 && void 0 !== arguments[0] && arguments[0]; -}([ - 1, - 2, - 3 -]), b2("string", { - x: 200, - y: "string" -}), b2("string", { - x: 200, - y: !0 -}), function() { - var ref = _sliced_to_array(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [ - void 0, - null, - void 0 - ], 3); - ref[0], ref[1], ref[2]; -}([ - "string", - 1, - 2 -]), function() { - var ref = _sliced_to_array(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [ - [ - void 0 - ], - void 0, - [ - [ - void 0, - void 0 - ] - ] - ], 3), ref1 = (_sliced_to_array(ref[0], 1)[0], ref[1], _sliced_to_array(ref[2], 1)), ref2 = _sliced_to_array(ref1[0], 2); - ref2[0], ref2[1]; -}([ - [ - "string" - ], - 1, - [ - [ - !0, - !1 - ] - ] -]), function(Foo) { - Foo[Foo.a = 0] = "a"; -}(Foo || (Foo = {})), c0({ - z: { - x: 1, - y: { - j: "world" - } - } -}), c0({ - z: { - x: "string", - y: { - j: !0 - } - } -}), c1(), c1({ - z: 1 -}), ({}).z, function() { - (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { - b: "hello" - }).b; -}({ - b: 1 -}), c5([ - 1, - 2, - [ - [ - "string" - ] - ] -]), c5([ - 1, - 2, - [ - [ - "string" - ] - ], - !1, - !0 -]); -var Foo, C2 = function() { - "use strict"; - function C2() { - _class_call_check(this, C2); - } - var _proto = C2.prototype; - return _proto.d3 = function() {}, _proto.d4 = function() {}, _proto.e0 = function(param) { - var _param = _sliced_to_array(param, 3); - _param[0], _param[1], _param[2]; - }, C2; -}(), C3 = function() { - "use strict"; - function C3() { - _class_call_check(this, C3); - } - var _proto = C3.prototype; - return _proto.d3 = function(param) { - var _param = _sliced_to_array(param, 3); - _param[0], _param[1], _param[2]; - }, _proto.d4 = function(param) { - param.x, param.y, param.z; - }, _proto.e0 = function(param) { - var _param = _sliced_to_array(param, 3); - _param[0], _param[1], _param[2]; - }, C3; -}(); -!function() { - var ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { - x: 1, - y: 2 - }; - ref.x, ref.y; -}(); +//! +//! x the name `d0` is defined multiple times +//! ,-[63:1] +//! 63 | function d0(x?) { } +//! : ^| +//! : `-- previous definition of `d0` here +//! 64 | function d0(x = 10) { } +//! : ^| +//! : `-- `d0` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES6_es2015.1.normal.js b/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES6_es2015.1.normal.js index fb88482677b2..104dfb16f09b 100644 --- a/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES6_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES6_es2015.1.normal.js @@ -1,166 +1,16 @@ -// Conformance for emitting ES6 -// @target: es6 -// A parameter declaration may specify either an identifier or a binding pattern. -// The identifiers specified in parameter declarations and binding patterns -// in a parameter list must be unique within that parameter list. -// If the declaration includes a type annotation, the parameter is of that type -function a1([a, b, [[c]]]) {} -function a2(o) {} -function a3({ j , k , l: { m , n } , q: [a, b, c] }) {} -function a4({ x , a }) {} -a1([ - 1, - 2, - [ - [ - "world" - ] - ] -]); -a1([ - 1, - 2, - [ - [ - "world" - ] - ], - 3 -]); -// If the declaration includes an initializer expression (which is permitted only -// when the parameter list occurs in conjunction with a function body), -// the parameter type is the widened form (section 3.11) of the type of the initializer expression. -function b1(z = [ - undefined, - null -]) {} -function b2(z = null, o = { - x: 0, - y: undefined -}) {} -function b3({ z: { x , y: { j } } } = { - z: { - x: "hi", - y: { - j: 1 - } - } -}) {} -function b6([a, z, y] = [ - undefined, - null, - undefined -]) {} -function b7([[a], b, [[c, d]]] = [ - [ - undefined - ], - undefined, - [ - [ - undefined, - undefined - ] - ] -]) {} -b1([ - 1, - 2, - 3 -]); // z is widen to the type any[] -b2("string", { - x: 200, - y: "string" -}); -b2("string", { - x: 200, - y: true -}); -var // If the declaration specifies a binding pattern, the parameter type is the implied type of that binding pattern (section 5.1.3) -Foo; -(function(Foo) { - Foo[Foo["a"] = 0] = "a"; -})(Foo || (Foo = {})); -function c0({ z: { x , y: { j } } }) {} -function c1({ z } = { - z: 10 -}) {} -function c2({ z =10 }) {} -function c3({ b } = { - b: "hello" -}) {} -function c5([a, b, [[c]]]) {} -function c6([a, b, [[c = 1]]]) {} -c0({ - z: { - x: 1, - y: { - j: "world" - } - } -}); // Implied type is { z: {x: any, y: {j: any}} } -c0({ - z: { - x: "string", - y: { - j: true - } - } -}); // Implied type is { z: {x: any, y: {j: any}} } -c1(); // Implied type is {z:number}? -c1({ - z: 1 -}) // Implied type is {z:number}? -; -c2({}); // Implied type is {z?: number} -c2({ - z: 1 -}); // Implied type is {z?: number} -c3({ - b: 1 -}); // Implied type is { b: number|string }. -c5([ - 1, - 2, - [ - [ - "string" - ] - ] -]); // Implied type is is [any, any, [[any]]] -c5([ - 1, - 2, - [ - [ - "string" - ] - ], - false, - true -]); // Implied type is is [any, any, [[any]]] -class C2 { - d3() {} - d4() {} - e0([a, b, c]) {} - constructor(){} -} -class C3 { - d3([a, b, c]) {} - d4({ x , y , z }) {} - e0([a, b, c]) {} -} -function d5({ x , y } = { - x: 1, - y: 2 -}) {} -d5(); // Parameter is optional as its declaration included an initializer -// Destructuring parameter declarations do not permit type annotations on the individual binding patterns, -// as such annotations would conflict with the already established meaning of colons in object literals. -// Type annotations must instead be written on the top- level parameter declaration -function e1({ x: number }) {} // x has type any NOT number -function e2({ x }) {} // x is type number -function e3({ x }) {} // x is an optional with type number -function e4({ x: [number, string, any] }) {} // x has type [any, any, any] -function e5({ x: [a, b, c] }) {} // x has type [any, any, any] -function e6({ x: [number, number, number] }) {} // error, duplicate identifier; +//! +//! x the name `number` is bound more than once in this parameter list +//! ,---- +//! 97 | function e6({x: [number, number, number]}) { } // error, duplicate identifier; +//! : ^^^|^^ ^^^|^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `number` is bound more than once in this parameter list +//! ,---- +//! 97 | function e6({x: [number, number, number]}) { } // error, duplicate identifier; +//! : ^^^|^^ ^^^|^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- diff --git a/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES6_es2015.2.minified.js index 2a33aa3258d9..104dfb16f09b 100644 --- a/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES6_es2015.2.minified.js @@ -1,85 +1,16 @@ -var Foo; -function a1([a, b, [[c]]]) {} -function b2(z = null, o = { - x: 0, - y: void 0 -}) {} -function c0({ z: { x , y: { j } } }) {} -function c1({ z } = { - z: 10 -}) {} -function c2({ z =10 }) {} -function c5([a, b, [[c]]]) {} -a1([ - 1, - 2, - [ - [ - "world" - ] - ] -]), a1([ - 1, - 2, - [ - [ - "world" - ] - ], - 3 -]), function(z = [ - void 0, - null -]) {}([ - 1, - 2, - 3 -]), b2("string", { - x: 200, - y: "string" -}), b2("string", { - x: 200, - y: !0 -}), function(Foo) { - Foo[Foo.a = 0] = "a"; -}(Foo || (Foo = {})), c0({ - z: { - x: 1, - y: { - j: "world" - } - } -}), c0({ - z: { - x: "string", - y: { - j: !0 - } - } -}), c1(), c1({ - z: 1 -}), c2({}), c2({ - z: 1 -}), function({ b } = { - b: "hello" -}) {}({ - b: 1 -}), c5([ - 1, - 2, - [ - [ - "string" - ] - ] -]), c5([ - 1, - 2, - [ - [ - "string" - ] - ], - !1, - !0 -]); +//! +//! x the name `number` is bound more than once in this parameter list +//! ,---- +//! 97 | function e6({x: [number, number, number]}) { } // error, duplicate identifier; +//! : ^^^|^^ ^^^|^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `number` is bound more than once in this parameter list +//! ,---- +//! 97 | function e6({x: [number, number, number]}) { } // error, duplicate identifier; +//! : ^^^|^^ ^^^|^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- diff --git a/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES6_es5.1.normal.js b/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES6_es5.1.normal.js index 876e334142e6..104dfb16f09b 100644 --- a/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES6_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES6_es5.1.normal.js @@ -1,229 +1,16 @@ -// Conformance for emitting ES6 -// @target: es6 -// A parameter declaration may specify either an identifier or a binding pattern. -// The identifiers specified in parameter declarations and binding patterns -// in a parameter list must be unique within that parameter list. -// If the declaration includes a type annotation, the parameter is of that type -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; -function a1(param) { - var _param = _sliced_to_array(param, 3), a = _param[0], b = _param[1], ref = _sliced_to_array(_param[2], 1), ref1 = _sliced_to_array(ref[0], 1), c = ref1[0]; -} -function a2(o) {} -function a3(param) { - var j = param.j, k = param.k, _l = param.l, m = _l.m, n = _l.n, _q = _sliced_to_array(param.q, 3), a = _q[0], b = _q[1], c = _q[2]; -} -function a4(param) { - var x = param.x, a = param.a; -} -a1([ - 1, - 2, - [ - [ - "world" - ] - ] -]); -a1([ - 1, - 2, - [ - [ - "world" - ] - ], - 3 -]); -// If the declaration includes an initializer expression (which is permitted only -// when the parameter list occurs in conjunction with a function body), -// the parameter type is the widened form (section 3.11) of the type of the initializer expression. -function b1() { - var z = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ - undefined, - null - ]; -} -function b2() { - var z = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null, o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { - x: 0, - y: undefined - }; -} -function b3() { - var ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { - z: { - x: "hi", - y: { - j: 1 - } - } - }, _z = ref.z, x = _z.x, j = _z.y.j; -} -function b6() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ - undefined, - null, - undefined - ], 3), a = ref[0], z = ref[1], y = ref[2]; -} -function b7() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ - [ - undefined - ], - undefined, - [ - [ - undefined, - undefined - ] - ] - ], 3), ref1 = _sliced_to_array(ref[0], 1), a = ref1[0], b = ref[1], ref2 = _sliced_to_array(ref[2], 1), ref3 = _sliced_to_array(ref2[0], 2), c = ref3[0], d = ref3[1]; -} -b1([ - 1, - 2, - 3 -]); // z is widen to the type any[] -b2("string", { - x: 200, - y: "string" -}); -b2("string", { - x: 200, - y: true -}); -var // If the declaration specifies a binding pattern, the parameter type is the implied type of that binding pattern (section 5.1.3) -Foo; -(function(Foo) { - Foo[Foo["a"] = 0] = "a"; -})(Foo || (Foo = {})); -function c0(param) { - var _z = param.z, x = _z.x, j = _z.y.j; -} -function c1() { - var z = (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { - z: 10 - }).z; -} -function c2(param) { - var _z = param.z, z = _z === void 0 ? 10 : _z; -} -function c3() { - var b = (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { - b: "hello" - }).b; -} -function c5(param) { - var _param = _sliced_to_array(param, 3), a = _param[0], b = _param[1], ref = _sliced_to_array(_param[2], 1), ref1 = _sliced_to_array(ref[0], 1), c = ref1[0]; -} -function c6(param) { - var _param = _sliced_to_array(param, 3), a = _param[0], b = _param[1], ref = _sliced_to_array(_param[2], 1), ref1 = _sliced_to_array(ref[0], 1), tmp = ref1[0], c = tmp === void 0 ? 1 : tmp; -} -c0({ - z: { - x: 1, - y: { - j: "world" - } - } -}); // Implied type is { z: {x: any, y: {j: any}} } -c0({ - z: { - x: "string", - y: { - j: true - } - } -}); // Implied type is { z: {x: any, y: {j: any}} } -c1(); // Implied type is {z:number}? -c1({ - z: 1 -}) // Implied type is {z:number}? -; -c2({}); // Implied type is {z?: number} -c2({ - z: 1 -}); // Implied type is {z?: number} -c3({ - b: 1 -}); // Implied type is { b: number|string }. -c5([ - 1, - 2, - [ - [ - "string" - ] - ] -]); // Implied type is is [any, any, [[any]]] -c5([ - 1, - 2, - [ - [ - "string" - ] - ], - false, - true -]); // Implied type is is [any, any, [[any]]] -var C2 = /*#__PURE__*/ function() { - "use strict"; - function C2() { - _class_call_check(this, C2); - } - var _proto = C2.prototype; - _proto.d3 = function d3() {}; - _proto.d4 = function d4() {}; - _proto.e0 = function e0(param) { - var _param = _sliced_to_array(param, 3), a = _param[0], b = _param[1], c = _param[2]; - }; - return C2; -}(); -var C3 = /*#__PURE__*/ function() { - "use strict"; - function C3() { - _class_call_check(this, C3); - } - var _proto = C3.prototype; - _proto.d3 = function d3(param) { - var _param = _sliced_to_array(param, 3), a = _param[0], b = _param[1], c = _param[2]; - }; - _proto.d4 = function d4(param) { - var x = param.x, y = param.y, z = param.z; - }; - _proto.e0 = function e0(param) { - var _param = _sliced_to_array(param, 3), a = _param[0], b = _param[1], c = _param[2]; - }; - return C3; -}(); -function d5() { - var ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { - x: 1, - y: 2 - }, x = ref.x, y = ref.y; -} -d5(); // Parameter is optional as its declaration included an initializer -// Destructuring parameter declarations do not permit type annotations on the individual binding patterns, -// as such annotations would conflict with the already established meaning of colons in object literals. -// Type annotations must instead be written on the top- level parameter declaration -function e1(param) { - var number = param.x; -} // x has type any NOT number -function e2(param) { - var x = param.x; -} // x is type number -function e3(param) { - var x = param.x; -} // x is an optional with type number -function e4(param) { - var _x = _sliced_to_array(param.x, 3), number = _x[0], string = _x[1], any = _x[2]; -} // x has type [any, any, any] -function e5(param) { - var _x = _sliced_to_array(param.x, 3), a = _x[0], b = _x[1], c = _x[2]; -} // x has type [any, any, any] -function e6(param) { - var _x = _sliced_to_array(param.x, 3), number = _x[0], number = _x[1], number = _x[2]; -} // error, duplicate identifier; +//! +//! x the name `number` is bound more than once in this parameter list +//! ,---- +//! 97 | function e6({x: [number, number, number]}) { } // error, duplicate identifier; +//! : ^^^|^^ ^^^|^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `number` is bound more than once in this parameter list +//! ,---- +//! 97 | function e6({x: [number, number, number]}) { } // error, duplicate identifier; +//! : ^^^|^^ ^^^|^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- diff --git a/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES6_es5.2.minified.js b/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES6_es5.2.minified.js index 4bf19b0b812f..104dfb16f09b 100644 --- a/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES6_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringParameterDeclaration1ES6_es5.2.minified.js @@ -1,127 +1,16 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; -function a1(param) { - var _param = _sliced_to_array(param, 3), ref = (_param[0], _param[1], _sliced_to_array(_param[2], 1)), ref1 = _sliced_to_array(ref[0], 1); - ref1[0]; -} -function b2() { - arguments.length > 0 && void 0 !== arguments[0] && arguments[0], arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; -} -function c0(param) { - var _z = param.z; - _z.x, _z.y.j; -} -function c1() { - (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { - z: 10 - }).z; -} -function c5(param) { - var _param = _sliced_to_array(param, 3), ref = (_param[0], _param[1], _sliced_to_array(_param[2], 1)), ref1 = _sliced_to_array(ref[0], 1); - ref1[0]; -} -a1([ - 1, - 2, - [ - [ - "world" - ] - ] -]), a1([ - 1, - 2, - [ - [ - "world" - ] - ], - 3 -]), function() { - arguments.length > 0 && void 0 !== arguments[0] && arguments[0]; -}([ - 1, - 2, - 3 -]), b2("string", { - x: 200, - y: "string" -}), b2("string", { - x: 200, - y: !0 -}), function(Foo) { - Foo[Foo.a = 0] = "a"; -}(Foo || (Foo = {})), c0({ - z: { - x: 1, - y: { - j: "world" - } - } -}), c0({ - z: { - x: "string", - y: { - j: !0 - } - } -}), c1(), c1({ - z: 1 -}), ({}).z, function() { - (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { - b: "hello" - }).b; -}({ - b: 1 -}), c5([ - 1, - 2, - [ - [ - "string" - ] - ] -]), c5([ - 1, - 2, - [ - [ - "string" - ] - ], - !1, - !0 -]); -var Foo, C2 = function() { - "use strict"; - function C2() { - _class_call_check(this, C2); - } - var _proto = C2.prototype; - return _proto.d3 = function() {}, _proto.d4 = function() {}, _proto.e0 = function(param) { - var _param = _sliced_to_array(param, 3); - _param[0], _param[1], _param[2]; - }, C2; -}(), C3 = function() { - "use strict"; - function C3() { - _class_call_check(this, C3); - } - var _proto = C3.prototype; - return _proto.d3 = function(param) { - var _param = _sliced_to_array(param, 3); - _param[0], _param[1], _param[2]; - }, _proto.d4 = function(param) { - param.x, param.y, param.z; - }, _proto.e0 = function(param) { - var _param = _sliced_to_array(param, 3); - _param[0], _param[1], _param[2]; - }, C3; -}(); -!function() { - var ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { - x: 1, - y: 2 - }; - ref.x, ref.y; -}(); +//! +//! x the name `number` is bound more than once in this parameter list +//! ,---- +//! 97 | function e6({x: [number, number, number]}) { } // error, duplicate identifier; +//! : ^^^|^^ ^^^|^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- +//! +//! x the name `number` is bound more than once in this parameter list +//! ,---- +//! 97 | function e6({x: [number, number, number]}) { } // error, duplicate identifier; +//! : ^^^|^^ ^^^|^^ +//! : | `-- used as parameter more than once +//! : `-- previous definition here +//! `---- diff --git a/crates/swc/tests/tsc-references/destructuringSameNames_es2015.1.normal.js b/crates/swc/tests/tsc-references/destructuringSameNames_es2015.1.normal.js index 7fff4bf1f34f..584cb11a7198 100644 --- a/crates/swc/tests/tsc-references/destructuringSameNames_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringSameNames_es2015.1.normal.js @@ -1,85 +1,64 @@ -// Valid cases -let { foo , foo: bar } = { - foo: 1 -}; -({ foo , foo } = { - foo: 2 -}); -({ foo , foo: bar } = { - foo: 3 -}); -({ foo: bar , foo } = { - foo: 4 -}); -({ foo , bar: foo } = { - foo: 3, - bar: 33 -}); -({ bar: foo , foo } = { - foo: 4, - bar: 44 -}); -({ foo: bar , foo: bar } = { - foo: 5 -}); -({ foo: bar , bar: foo } = { - foo: 6, - bar: 66 -}); -({ foo: bar , foo: bar } = { - foo: 7 -}); -[foo, foo] = [ - 111, - 1111 -]; -[foo, foo] = [ - 222, - 2222 -]; -[bar, foo, foo] = [ - 333, - 3333, - 33333 -]; -[foo, bar, foo] = [ - 333, - 3333, - 33333 -]; -[foo, foo, bar] = [ - 444, - 4444, - 44444 -]; -// Error cases -let { foo1 , foo1 } = { - foo1: 10 -}; -let { foo2 , bar2: foo2 } = { - foo2: 20, - bar2: 220 -}; -let { bar3: foo3 , foo3 } = { - foo3: 30, - bar3: 330 -}; -const { foo4 , foo4 } = { - foo4: 40 -}; -const { foo5 , bar5: foo5 } = { - foo5: 50, - bar5: 550 -}; -const { bar6: foo6 , foo6 } = { - foo6: 60, - bar6: 660 -}; -let [blah1, blah1] = [ - 111, - 222 -]; -const [blah2, blah2] = [ - 333, - 444 -]; +//! +//! x the name `foo1` is defined multiple times +//! ,---- +//! 21 | let { foo1, foo1 } = { foo1: 10 }; +//! : ^^|^ ^^|^ +//! : | `-- `foo1` redefined here +//! : `-- previous definition of `foo1` here +//! `---- +//! +//! x the name `foo2` is defined multiple times +//! ,---- +//! 22 | let { foo2, bar2: foo2 } = { foo2: 20, bar2: 220 }; +//! : ^^|^ ^^|^ +//! : | `-- `foo2` redefined here +//! : `-- previous definition of `foo2` here +//! `---- +//! +//! x the name `foo3` is defined multiple times +//! ,---- +//! 23 | let { bar3: foo3, foo3 } = { foo3: 30, bar3: 330 }; +//! : ^^|^ ^^|^ +//! : | `-- `foo3` redefined here +//! : `-- previous definition of `foo3` here +//! `---- +//! +//! x the name `foo4` is defined multiple times +//! ,---- +//! 24 | const { foo4, foo4 } = { foo4: 40 }; +//! : ^^|^ ^^|^ +//! : | `-- `foo4` redefined here +//! : `-- previous definition of `foo4` here +//! `---- +//! +//! x the name `foo5` is defined multiple times +//! ,---- +//! 25 | const { foo5, bar5: foo5 } = { foo5: 50, bar5: 550 }; +//! : ^^|^ ^^|^ +//! : | `-- `foo5` redefined here +//! : `-- previous definition of `foo5` here +//! `---- +//! +//! x the name `foo6` is defined multiple times +//! ,---- +//! 26 | const { bar6: foo6, foo6 } = { foo6: 60, bar6: 660 }; +//! : ^^|^ ^^|^ +//! : | `-- `foo6` redefined here +//! : `-- previous definition of `foo6` here +//! `---- +//! +//! x the name `blah1` is defined multiple times +//! ,---- +//! 28 | let [blah1, blah1] = [111, 222]; +//! : ^^|^^ ^^|^^ +//! : | `-- `blah1` redefined here +//! : `-- previous definition of `blah1` here +//! `---- +//! +//! x the name `blah2` is defined multiple times +//! ,---- +//! 29 | const [blah2, blah2] = [333, 444]; +//! : ^^|^^ ^^|^^ +//! : | `-- `blah2` redefined here +//! : `-- previous definition of `blah2` here +//! `---- diff --git a/crates/swc/tests/tsc-references/destructuringSameNames_es2015.2.minified.js b/crates/swc/tests/tsc-references/destructuringSameNames_es2015.2.minified.js index 2cae13c39577..584cb11a7198 100644 --- a/crates/swc/tests/tsc-references/destructuringSameNames_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringSameNames_es2015.2.minified.js @@ -1,67 +1,64 @@ -let { foo , foo: bar } = { - foo: 1 -}; -({ foo , foo } = { - foo: 2 -}), ({ foo , foo: bar } = { - foo: 3 -}), ({ foo: bar , foo } = { - foo: 4 -}), ({ foo , bar: foo } = { - foo: 3, - bar: 33 -}), ({ bar: foo , foo } = { - foo: 4, - bar: 44 -}), ({ foo: bar , foo: bar } = { - foo: 5 -}), ({ foo: bar , bar: foo } = { - foo: 6, - bar: 66 -}), ({ foo: bar , foo: bar } = { - foo: 7 -}), [foo, foo] = [ - 111, - 1111 -], [foo, foo] = [ - 222, - 2222 -], [bar, foo, foo] = [ - 333, - 3333, - 33333 -], [foo, bar, foo] = [ - 333, - 3333, - 33333 -], [foo, foo, bar] = [ - 444, - 4444, - 44444 -]; -let { foo1 , foo1 } = { - foo1: 10 -}, { foo2 , bar2: foo2 } = { - foo2: 20, - bar2: 220 -}, { bar3: foo3 , foo3 } = { - foo3: 30, - bar3: 330 -}; -const { foo4 , foo4 } = { - foo4: 40 -}, { foo5 , bar5: foo5 } = { - foo5: 50, - bar5: 550 -}, { bar6: foo6 , foo6 } = { - foo6: 60, - bar6: 660 -}; -let [blah1, blah1] = [ - 111, - 222 -]; -const [blah2, blah2] = [ - 333, - 444 -]; +//! +//! x the name `foo1` is defined multiple times +//! ,---- +//! 21 | let { foo1, foo1 } = { foo1: 10 }; +//! : ^^|^ ^^|^ +//! : | `-- `foo1` redefined here +//! : `-- previous definition of `foo1` here +//! `---- +//! +//! x the name `foo2` is defined multiple times +//! ,---- +//! 22 | let { foo2, bar2: foo2 } = { foo2: 20, bar2: 220 }; +//! : ^^|^ ^^|^ +//! : | `-- `foo2` redefined here +//! : `-- previous definition of `foo2` here +//! `---- +//! +//! x the name `foo3` is defined multiple times +//! ,---- +//! 23 | let { bar3: foo3, foo3 } = { foo3: 30, bar3: 330 }; +//! : ^^|^ ^^|^ +//! : | `-- `foo3` redefined here +//! : `-- previous definition of `foo3` here +//! `---- +//! +//! x the name `foo4` is defined multiple times +//! ,---- +//! 24 | const { foo4, foo4 } = { foo4: 40 }; +//! : ^^|^ ^^|^ +//! : | `-- `foo4` redefined here +//! : `-- previous definition of `foo4` here +//! `---- +//! +//! x the name `foo5` is defined multiple times +//! ,---- +//! 25 | const { foo5, bar5: foo5 } = { foo5: 50, bar5: 550 }; +//! : ^^|^ ^^|^ +//! : | `-- `foo5` redefined here +//! : `-- previous definition of `foo5` here +//! `---- +//! +//! x the name `foo6` is defined multiple times +//! ,---- +//! 26 | const { bar6: foo6, foo6 } = { foo6: 60, bar6: 660 }; +//! : ^^|^ ^^|^ +//! : | `-- `foo6` redefined here +//! : `-- previous definition of `foo6` here +//! `---- +//! +//! x the name `blah1` is defined multiple times +//! ,---- +//! 28 | let [blah1, blah1] = [111, 222]; +//! : ^^|^^ ^^|^^ +//! : | `-- `blah1` redefined here +//! : `-- previous definition of `blah1` here +//! `---- +//! +//! x the name `blah2` is defined multiple times +//! ,---- +//! 29 | const [blah2, blah2] = [333, 444]; +//! : ^^|^^ ^^|^^ +//! : | `-- `blah2` redefined here +//! : `-- previous definition of `blah2` here +//! `---- diff --git a/crates/swc/tests/tsc-references/destructuringSameNames_es5.1.normal.js b/crates/swc/tests/tsc-references/destructuringSameNames_es5.1.normal.js index c95a207ce330..584cb11a7198 100644 --- a/crates/swc/tests/tsc-references/destructuringSameNames_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringSameNames_es5.1.normal.js @@ -1,69 +1,64 @@ -// Valid cases -var ref = { - foo: 1 -}, foo = ref.foo, bar = ref.foo; -var ref1; -ref1 = { - foo: 2 -}, foo = ref1.foo, foo = ref1.foo, ref1; -var ref2; -ref2 = { - foo: 3 -}, foo = ref2.foo, bar = ref2.foo, ref2; -var ref3; -ref3 = { - foo: 4 -}, bar = ref3.foo, foo = ref3.foo, ref3; -var ref4; -ref4 = { - foo: 3, - bar: 33 -}, foo = ref4.foo, foo = ref4.bar, ref4; -var ref5; -ref5 = { - foo: 4, - bar: 44 -}, foo = ref5.bar, foo = ref5.foo, ref5; -var ref6; -ref6 = { - foo: 5 -}, bar = ref6.foo, bar = ref6.foo, ref6; -var ref7; -ref7 = { - foo: 6, - bar: 66 -}, bar = ref7.foo, foo = ref7.bar, ref7; -var ref8; -ref8 = { - foo: 7 -}, bar = ref8.foo, bar = ref8.foo, ref8; -foo = 111, foo = 1111; -foo = 222, foo = 2222; -bar = 333, foo = 3333, foo = 33333; -foo = 333, bar = 3333, foo = 33333; -foo = 444, foo = 4444, bar = 44444; -// Error cases -var ref9 = { - foo1: 10 -}, foo1 = ref9.foo1, foo1 = ref9.foo1; -var ref10 = { - foo2: 20, - bar2: 220 -}, foo2 = ref10.foo2, foo2 = ref10.bar2; -var ref11 = { - foo3: 30, - bar3: 330 -}, foo3 = ref11.bar3, foo3 = ref11.foo3; -var ref12 = { - foo4: 40 -}, foo4 = ref12.foo4, foo4 = ref12.foo4; -var ref13 = { - foo5: 50, - bar5: 550 -}, foo5 = ref13.foo5, foo5 = ref13.bar5; -var ref14 = { - foo6: 60, - bar6: 660 -}, foo6 = ref14.bar6, foo6 = ref14.foo6; -var blah1 = 111, blah1 = 222; -var blah2 = 333, blah2 = 444; +//! +//! x the name `foo1` is defined multiple times +//! ,---- +//! 21 | let { foo1, foo1 } = { foo1: 10 }; +//! : ^^|^ ^^|^ +//! : | `-- `foo1` redefined here +//! : `-- previous definition of `foo1` here +//! `---- +//! +//! x the name `foo2` is defined multiple times +//! ,---- +//! 22 | let { foo2, bar2: foo2 } = { foo2: 20, bar2: 220 }; +//! : ^^|^ ^^|^ +//! : | `-- `foo2` redefined here +//! : `-- previous definition of `foo2` here +//! `---- +//! +//! x the name `foo3` is defined multiple times +//! ,---- +//! 23 | let { bar3: foo3, foo3 } = { foo3: 30, bar3: 330 }; +//! : ^^|^ ^^|^ +//! : | `-- `foo3` redefined here +//! : `-- previous definition of `foo3` here +//! `---- +//! +//! x the name `foo4` is defined multiple times +//! ,---- +//! 24 | const { foo4, foo4 } = { foo4: 40 }; +//! : ^^|^ ^^|^ +//! : | `-- `foo4` redefined here +//! : `-- previous definition of `foo4` here +//! `---- +//! +//! x the name `foo5` is defined multiple times +//! ,---- +//! 25 | const { foo5, bar5: foo5 } = { foo5: 50, bar5: 550 }; +//! : ^^|^ ^^|^ +//! : | `-- `foo5` redefined here +//! : `-- previous definition of `foo5` here +//! `---- +//! +//! x the name `foo6` is defined multiple times +//! ,---- +//! 26 | const { bar6: foo6, foo6 } = { foo6: 60, bar6: 660 }; +//! : ^^|^ ^^|^ +//! : | `-- `foo6` redefined here +//! : `-- previous definition of `foo6` here +//! `---- +//! +//! x the name `blah1` is defined multiple times +//! ,---- +//! 28 | let [blah1, blah1] = [111, 222]; +//! : ^^|^^ ^^|^^ +//! : | `-- `blah1` redefined here +//! : `-- previous definition of `blah1` here +//! `---- +//! +//! x the name `blah2` is defined multiple times +//! ,---- +//! 29 | const [blah2, blah2] = [333, 444]; +//! : ^^|^^ ^^|^^ +//! : | `-- `blah2` redefined here +//! : `-- previous definition of `blah2` here +//! `---- diff --git a/crates/swc/tests/tsc-references/destructuringSameNames_es5.2.minified.js b/crates/swc/tests/tsc-references/destructuringSameNames_es5.2.minified.js index c7150afa0b6d..584cb11a7198 100644 --- a/crates/swc/tests/tsc-references/destructuringSameNames_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringSameNames_es5.2.minified.js @@ -1,51 +1,64 @@ -var ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8 = { - foo: 1 -}; -ref8.foo, ref8.foo, (ref = { - foo: 2 -}).foo, ref.foo, (ref1 = { - foo: 3 -}).foo, ref1.foo, (ref2 = { - foo: 4 -}).foo, ref2.foo, (ref3 = { - foo: 3, - bar: 33 -}).foo, ref3.bar, (ref4 = { - foo: 4, - bar: 44 -}).bar, ref4.foo, (ref5 = { - foo: 5 -}).foo, ref5.foo, (ref6 = { - foo: 6, - bar: 66 -}).foo, ref6.bar, (ref7 = { - foo: 7 -}).foo, ref7.foo; -var ref9 = { - foo1: 10 -}; -ref9.foo1, ref9.foo1; -var ref10 = { - foo2: 20, - bar2: 220 -}; -ref10.foo2, ref10.bar2; -var ref11 = { - foo3: 30, - bar3: 330 -}; -ref11.bar3, ref11.foo3; -var ref12 = { - foo4: 40 -}; -ref12.foo4, ref12.foo4; -var ref13 = { - foo5: 50, - bar5: 550 -}; -ref13.foo5, ref13.bar5; -var ref14 = { - foo6: 60, - bar6: 660 -}; -ref14.bar6, ref14.foo6; +//! +//! x the name `foo1` is defined multiple times +//! ,---- +//! 21 | let { foo1, foo1 } = { foo1: 10 }; +//! : ^^|^ ^^|^ +//! : | `-- `foo1` redefined here +//! : `-- previous definition of `foo1` here +//! `---- +//! +//! x the name `foo2` is defined multiple times +//! ,---- +//! 22 | let { foo2, bar2: foo2 } = { foo2: 20, bar2: 220 }; +//! : ^^|^ ^^|^ +//! : | `-- `foo2` redefined here +//! : `-- previous definition of `foo2` here +//! `---- +//! +//! x the name `foo3` is defined multiple times +//! ,---- +//! 23 | let { bar3: foo3, foo3 } = { foo3: 30, bar3: 330 }; +//! : ^^|^ ^^|^ +//! : | `-- `foo3` redefined here +//! : `-- previous definition of `foo3` here +//! `---- +//! +//! x the name `foo4` is defined multiple times +//! ,---- +//! 24 | const { foo4, foo4 } = { foo4: 40 }; +//! : ^^|^ ^^|^ +//! : | `-- `foo4` redefined here +//! : `-- previous definition of `foo4` here +//! `---- +//! +//! x the name `foo5` is defined multiple times +//! ,---- +//! 25 | const { foo5, bar5: foo5 } = { foo5: 50, bar5: 550 }; +//! : ^^|^ ^^|^ +//! : | `-- `foo5` redefined here +//! : `-- previous definition of `foo5` here +//! `---- +//! +//! x the name `foo6` is defined multiple times +//! ,---- +//! 26 | const { bar6: foo6, foo6 } = { foo6: 60, bar6: 660 }; +//! : ^^|^ ^^|^ +//! : | `-- `foo6` redefined here +//! : `-- previous definition of `foo6` here +//! `---- +//! +//! x the name `blah1` is defined multiple times +//! ,---- +//! 28 | let [blah1, blah1] = [111, 222]; +//! : ^^|^^ ^^|^^ +//! : | `-- `blah1` redefined here +//! : `-- previous definition of `blah1` here +//! `---- +//! +//! x the name `blah2` is defined multiple times +//! ,---- +//! 29 | const [blah2, blah2] = [333, 444]; +//! : ^^|^^ ^^|^^ +//! : | `-- `blah2` redefined here +//! : `-- previous definition of `blah2` here +//! `---- diff --git a/crates/swc/tests/tsc-references/duplicateExportAssignments_es2015.1.normal.js b/crates/swc/tests/tsc-references/duplicateExportAssignments_es2015.1.normal.js index 48bacd0781b3..3be24aa03aa4 100644 --- a/crates/swc/tests/tsc-references/duplicateExportAssignments_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/duplicateExportAssignments_es2015.1.normal.js @@ -1,24 +1,65 @@ // @Filename: foo1.ts -var x = 10; -var y = 20; +//! +//! x multiple `export =` found +//! ,-[4:1] +//! 4 | export = x; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 5 | export = y; +//! : ^^^^^^^^^^^ +//! `---- // @Filename: foo2.ts -var x = 10; -class y { -} -(function(x) { - var x1 = x.x = 10; -})(x || (x = {})); -class y { -} -function x() { - return 42; -} -function y() { - return 42; -} +//! +//! x multiple `export =` found +//! ,-[4:1] +//! 4 | export = x; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 5 | export = y; +//! : ^^^^^^^^^^^ +//! `---- +// @Filename: foo3.ts +//! +//! x multiple `export =` found +//! ,-[8:1] +//! 8 | export = x; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 9 | export = y; +//! : ^^^^^^^^^^^ +//! `---- +// @Filename: foo4.ts +//! +//! x multiple `export =` found +//! ,-[2:1] +//! 2 | export = x; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 3 | function x(){ +//! 4 | return 42; +//! 5 | } +//! 6 | function y(){ +//! 7 | return 42; +//! 8 | } +//! 9 | export = y; +//! : ^^^^^^^^^^^ +//! `---- // @Filename: foo5.ts -var x = 5; -var y = "test"; -var z = {}; -module.exports = x; -export { }; +//! +//! x multiple `export =` found +//! ,-[5:1] +//! 5 | export = x; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 6 | export = y; +//! : ^^^^^^^^^^^ +//! `---- +//! +//! x multiple `export =` found +//! ,-[6:1] +//! 6 | export = y; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 7 | export = z; +//! : ^^^^^^^^^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/duplicateExportAssignments_es2015.2.minified.js b/crates/swc/tests/tsc-references/duplicateExportAssignments_es2015.2.minified.js index 557e7618c541..3be24aa03aa4 100644 --- a/crates/swc/tests/tsc-references/duplicateExportAssignments_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/duplicateExportAssignments_es2015.2.minified.js @@ -1,5 +1,65 @@ -var x = 10; -(x || (x = {})).x = 10; -var x = 5; -module.exports = x; -export { }; +// @Filename: foo1.ts +//! +//! x multiple `export =` found +//! ,-[4:1] +//! 4 | export = x; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 5 | export = y; +//! : ^^^^^^^^^^^ +//! `---- +// @Filename: foo2.ts +//! +//! x multiple `export =` found +//! ,-[4:1] +//! 4 | export = x; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 5 | export = y; +//! : ^^^^^^^^^^^ +//! `---- +// @Filename: foo3.ts +//! +//! x multiple `export =` found +//! ,-[8:1] +//! 8 | export = x; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 9 | export = y; +//! : ^^^^^^^^^^^ +//! `---- +// @Filename: foo4.ts +//! +//! x multiple `export =` found +//! ,-[2:1] +//! 2 | export = x; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 3 | function x(){ +//! 4 | return 42; +//! 5 | } +//! 6 | function y(){ +//! 7 | return 42; +//! 8 | } +//! 9 | export = y; +//! : ^^^^^^^^^^^ +//! `---- +// @Filename: foo5.ts +//! +//! x multiple `export =` found +//! ,-[5:1] +//! 5 | export = x; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 6 | export = y; +//! : ^^^^^^^^^^^ +//! `---- +//! +//! x multiple `export =` found +//! ,-[6:1] +//! 6 | export = y; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 7 | export = z; +//! : ^^^^^^^^^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/duplicateExportAssignments_es5.1.normal.js b/crates/swc/tests/tsc-references/duplicateExportAssignments_es5.1.normal.js index ff810e62faf8..3be24aa03aa4 100644 --- a/crates/swc/tests/tsc-references/duplicateExportAssignments_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/duplicateExportAssignments_es5.1.normal.js @@ -1,29 +1,65 @@ // @Filename: foo1.ts -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var x = 10; -var y = 20; +//! +//! x multiple `export =` found +//! ,-[4:1] +//! 4 | export = x; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 5 | export = y; +//! : ^^^^^^^^^^^ +//! `---- // @Filename: foo2.ts -var x = 10; -var y = function y() { - "use strict"; - _class_call_check(this, y); -}; -(function(x) { - var _$x = x.x = 10; -})(x || (x = {})); -var y = function y() { - "use strict"; - _class_call_check(this, y); -}; -function x() { - return 42; -} -function y() { - return 42; -} +//! +//! x multiple `export =` found +//! ,-[4:1] +//! 4 | export = x; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 5 | export = y; +//! : ^^^^^^^^^^^ +//! `---- +// @Filename: foo3.ts +//! +//! x multiple `export =` found +//! ,-[8:1] +//! 8 | export = x; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 9 | export = y; +//! : ^^^^^^^^^^^ +//! `---- +// @Filename: foo4.ts +//! +//! x multiple `export =` found +//! ,-[2:1] +//! 2 | export = x; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 3 | function x(){ +//! 4 | return 42; +//! 5 | } +//! 6 | function y(){ +//! 7 | return 42; +//! 8 | } +//! 9 | export = y; +//! : ^^^^^^^^^^^ +//! `---- // @Filename: foo5.ts -var x = 5; -var y = "test"; -var z = {}; -module.exports = x; -export { }; +//! +//! x multiple `export =` found +//! ,-[5:1] +//! 5 | export = x; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 6 | export = y; +//! : ^^^^^^^^^^^ +//! `---- +//! +//! x multiple `export =` found +//! ,-[6:1] +//! 6 | export = y; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 7 | export = z; +//! : ^^^^^^^^^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/duplicateExportAssignments_es5.2.minified.js b/crates/swc/tests/tsc-references/duplicateExportAssignments_es5.2.minified.js index 2239c6aa99d5..3be24aa03aa4 100644 --- a/crates/swc/tests/tsc-references/duplicateExportAssignments_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/duplicateExportAssignments_es5.2.minified.js @@ -1,15 +1,65 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var y = 20, x = 10, y = function() { - "use strict"; - _class_call_check(this, y); -}; -(x || (x = {})).x = 10; -var y = function() { - "use strict"; - _class_call_check(this, y); -}; -function y() { - return 42; -} -var x = 5, y = "test"; -module.exports = x; +// @Filename: foo1.ts +//! +//! x multiple `export =` found +//! ,-[4:1] +//! 4 | export = x; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 5 | export = y; +//! : ^^^^^^^^^^^ +//! `---- +// @Filename: foo2.ts +//! +//! x multiple `export =` found +//! ,-[4:1] +//! 4 | export = x; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 5 | export = y; +//! : ^^^^^^^^^^^ +//! `---- +// @Filename: foo3.ts +//! +//! x multiple `export =` found +//! ,-[8:1] +//! 8 | export = x; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 9 | export = y; +//! : ^^^^^^^^^^^ +//! `---- +// @Filename: foo4.ts +//! +//! x multiple `export =` found +//! ,-[2:1] +//! 2 | export = x; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 3 | function x(){ +//! 4 | return 42; +//! 5 | } +//! 6 | function y(){ +//! 7 | return 42; +//! 8 | } +//! 9 | export = y; +//! : ^^^^^^^^^^^ +//! `---- +// @Filename: foo5.ts +//! +//! x multiple `export =` found +//! ,-[5:1] +//! 5 | export = x; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 6 | export = y; +//! : ^^^^^^^^^^^ +//! `---- +//! +//! x multiple `export =` found +//! ,-[6:1] +//! 6 | export = y; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 7 | export = z; +//! : ^^^^^^^^^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments03_ES6_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments03_ES6_es2015.1.normal.js new file mode 100644 index 000000000000..5510a04c5ba3 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments03_ES6_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | var arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments03_ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments03_ES6_es2015.2.minified.js new file mode 100644 index 000000000000..5510a04c5ba3 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments03_ES6_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | var arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments03_ES6_es5.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments03_ES6_es5.1.normal.js new file mode 100644 index 000000000000..5510a04c5ba3 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments03_ES6_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | var arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments03_ES6_es5.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments03_ES6_es5.2.minified.js new file mode 100644 index 000000000000..5510a04c5ba3 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments03_ES6_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | var arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments03_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments03_es2015.1.normal.js new file mode 100644 index 000000000000..5510a04c5ba3 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments03_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | var arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments03_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments03_es2015.2.minified.js new file mode 100644 index 000000000000..5510a04c5ba3 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments03_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | var arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments03_es5.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments03_es5.1.normal.js new file mode 100644 index 000000000000..5510a04c5ba3 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments03_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | var arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments03_es5.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments03_es5.2.minified.js new file mode 100644 index 000000000000..5510a04c5ba3 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments03_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | var arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments04_ES6_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments04_ES6_es2015.1.normal.js new file mode 100644 index 000000000000..e154b264ff1f --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments04_ES6_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments04_ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments04_ES6_es2015.2.minified.js new file mode 100644 index 000000000000..e154b264ff1f --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments04_ES6_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments04_ES6_es5.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments04_ES6_es5.1.normal.js new file mode 100644 index 000000000000..e154b264ff1f --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments04_ES6_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments04_ES6_es5.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments04_ES6_es5.2.minified.js new file mode 100644 index 000000000000..e154b264ff1f --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments04_ES6_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments04_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments04_es2015.1.normal.js new file mode 100644 index 000000000000..e154b264ff1f --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments04_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments04_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments04_es2015.2.minified.js new file mode 100644 index 000000000000..e154b264ff1f --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments04_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments04_es5.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments04_es5.1.normal.js new file mode 100644 index 000000000000..e154b264ff1f --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments04_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments04_es5.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments04_es5.2.minified.js new file mode 100644 index 000000000000..e154b264ff1f --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments04_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments05_ES6_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments05_ES6_es2015.1.normal.js new file mode 100644 index 000000000000..de3a2f334887 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments05_ES6_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments05_ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments05_ES6_es2015.2.minified.js new file mode 100644 index 000000000000..de3a2f334887 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments05_ES6_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments05_ES6_es5.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments05_ES6_es5.1.normal.js new file mode 100644 index 000000000000..de3a2f334887 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments05_ES6_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments05_ES6_es5.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments05_ES6_es5.2.minified.js new file mode 100644 index 000000000000..de3a2f334887 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments05_ES6_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments05_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments05_es2015.1.normal.js new file mode 100644 index 000000000000..de3a2f334887 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments05_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments05_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments05_es2015.2.minified.js new file mode 100644 index 000000000000..de3a2f334887 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments05_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments05_es5.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments05_es5.1.normal.js new file mode 100644 index 000000000000..de3a2f334887 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments05_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments05_es5.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments05_es5.2.minified.js new file mode 100644 index 000000000000..de3a2f334887 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments05_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments06_ES6_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments06_ES6_es2015.1.normal.js new file mode 100644 index 000000000000..de3a2f334887 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments06_ES6_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments06_ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments06_ES6_es2015.2.minified.js new file mode 100644 index 000000000000..de3a2f334887 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments06_ES6_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments06_ES6_es5.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments06_ES6_es5.1.normal.js new file mode 100644 index 000000000000..de3a2f334887 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments06_ES6_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments06_ES6_es5.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments06_ES6_es5.2.minified.js new file mode 100644 index 000000000000..de3a2f334887 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments06_ES6_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments06_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments06_es2015.1.normal.js new file mode 100644 index 000000000000..de3a2f334887 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments06_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments06_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments06_es2015.2.minified.js new file mode 100644 index 000000000000..de3a2f334887 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments06_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments06_es5.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments06_es5.1.normal.js new file mode 100644 index 000000000000..de3a2f334887 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments06_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments06_es5.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments06_es5.2.minified.js new file mode 100644 index 000000000000..de3a2f334887 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments06_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments07_ES6_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments07_ES6_es2015.1.normal.js new file mode 100644 index 000000000000..a7c6eb22af49 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments07_ES6_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var a = (arguments) => () => arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments07_ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments07_ES6_es2015.2.minified.js new file mode 100644 index 000000000000..a7c6eb22af49 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments07_ES6_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var a = (arguments) => () => arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments07_ES6_es5.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments07_ES6_es5.1.normal.js new file mode 100644 index 000000000000..a7c6eb22af49 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments07_ES6_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var a = (arguments) => () => arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments07_ES6_es5.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments07_ES6_es5.2.minified.js new file mode 100644 index 000000000000..a7c6eb22af49 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments07_ES6_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var a = (arguments) => () => arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments07_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments07_es2015.1.normal.js new file mode 100644 index 000000000000..a7c6eb22af49 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments07_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var a = (arguments) => () => arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments07_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments07_es2015.2.minified.js new file mode 100644 index 000000000000..a7c6eb22af49 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments07_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var a = (arguments) => () => arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments07_es5.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments07_es5.1.normal.js new file mode 100644 index 000000000000..a7c6eb22af49 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments07_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var a = (arguments) => () => arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments07_es5.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments07_es5.2.minified.js new file mode 100644 index 000000000000..a7c6eb22af49 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments07_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var a = (arguments) => () => arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments08_ES6_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments08_ES6_es2015.1.normal.js new file mode 100644 index 000000000000..d385199368cd --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments08_ES6_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var a = () => (arguments) => arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments08_ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments08_ES6_es2015.2.minified.js new file mode 100644 index 000000000000..d385199368cd --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments08_ES6_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var a = () => (arguments) => arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments08_ES6_es5.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments08_ES6_es5.1.normal.js new file mode 100644 index 000000000000..d385199368cd --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments08_ES6_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var a = () => (arguments) => arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments08_ES6_es5.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments08_ES6_es5.2.minified.js new file mode 100644 index 000000000000..d385199368cd --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments08_ES6_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var a = () => (arguments) => arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments08_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments08_es2015.1.normal.js new file mode 100644 index 000000000000..d385199368cd --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments08_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var a = () => (arguments) => arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments08_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments08_es2015.2.minified.js new file mode 100644 index 000000000000..d385199368cd --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments08_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var a = () => (arguments) => arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments08_es5.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments08_es5.1.normal.js new file mode 100644 index 000000000000..d385199368cd --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments08_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var a = () => (arguments) => arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments08_es5.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments08_es5.2.minified.js new file mode 100644 index 000000000000..d385199368cd --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments08_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var a = () => (arguments) => arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments11_ES6_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments11_ES6_es2015.1.normal.js new file mode 100644 index 000000000000..de3a2f334887 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments11_ES6_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments11_ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments11_ES6_es2015.2.minified.js new file mode 100644 index 000000000000..de3a2f334887 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments11_ES6_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments11_ES6_es5.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments11_ES6_es5.1.normal.js new file mode 100644 index 000000000000..de3a2f334887 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments11_ES6_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments11_ES6_es5.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments11_ES6_es5.2.minified.js new file mode 100644 index 000000000000..de3a2f334887 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments11_ES6_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments11_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments11_es2015.1.normal.js new file mode 100644 index 000000000000..de3a2f334887 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments11_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments11_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments11_es2015.2.minified.js new file mode 100644 index 000000000000..de3a2f334887 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments11_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments11_es5.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments11_es5.1.normal.js new file mode 100644 index 000000000000..de3a2f334887 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments11_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments11_es5.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments11_es5.2.minified.js new file mode 100644 index 000000000000..de3a2f334887 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments11_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 3 | function f(arguments) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_ES6_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_ES6_es2015.1.normal.js index 496637a58021..d8c819c77c62 100644 --- a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_ES6_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_ES6_es2015.1.normal.js @@ -1,5 +1,12 @@ -// @target: es6 -function f() { - var _arguments = 10; - var a = (arguments)=>()=>_arguments; -} +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 5 | var a = (arguments) => () => _arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_ES6_es2015.2.minified.js new file mode 100644 index 000000000000..d8c819c77c62 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_ES6_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 5 | var a = (arguments) => () => _arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_ES6_es5.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_ES6_es5.1.normal.js index 5f1aaa8bb9b6..d8c819c77c62 100644 --- a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_ES6_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_ES6_es5.1.normal.js @@ -1,9 +1,12 @@ -// @target: es6 -function f() { - var _arguments = 10; - var a = function(arguments) { - return function() { - return _arguments; - }; - }; -} +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 5 | var a = (arguments) => () => _arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_ES6_es5.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_ES6_es5.2.minified.js new file mode 100644 index 000000000000..d8c819c77c62 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_ES6_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 5 | var a = (arguments) => () => _arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_es2015.1.normal.js index 78c590f1fb73..d8c819c77c62 100644 --- a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_es2015.1.normal.js @@ -1,5 +1,12 @@ -// @target: es5 -function f() { - var _arguments = 10; - var a = (arguments)=>()=>_arguments; -} +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 5 | var a = (arguments) => () => _arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_es2015.2.minified.js new file mode 100644 index 000000000000..d8c819c77c62 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 5 | var a = (arguments) => () => _arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_es5.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_es5.1.normal.js index 57a5190f4b4e..d8c819c77c62 100644 --- a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_es5.1.normal.js @@ -1,9 +1,12 @@ -// @target: es5 -function f() { - var _arguments = 10; - var a = function(arguments) { - return function() { - return _arguments; - }; - }; -} +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 5 | var a = (arguments) => () => _arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_es5.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_es5.2.minified.js new file mode 100644 index 000000000000..d8c819c77c62 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments13_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 5 | var a = (arguments) => () => _arguments; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments14_ES6_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments14_ES6_es2015.1.normal.js new file mode 100644 index 000000000000..38f3d8864c40 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments14_ES6_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 5 | let arguments = 100; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments14_ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments14_ES6_es2015.2.minified.js new file mode 100644 index 000000000000..38f3d8864c40 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments14_ES6_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 5 | let arguments = 100; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments14_ES6_es5.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments14_ES6_es5.1.normal.js new file mode 100644 index 000000000000..38f3d8864c40 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments14_ES6_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 5 | let arguments = 100; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments14_ES6_es5.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments14_ES6_es5.2.minified.js new file mode 100644 index 000000000000..38f3d8864c40 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments14_ES6_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 5 | let arguments = 100; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments14_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments14_es2015.1.normal.js new file mode 100644 index 000000000000..d69d554b3cb3 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments14_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 5 | const arguments = 100; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments14_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments14_es2015.2.minified.js new file mode 100644 index 000000000000..d69d554b3cb3 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments14_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 5 | const arguments = 100; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments14_es5.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments14_es5.1.normal.js new file mode 100644 index 000000000000..d69d554b3cb3 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments14_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 5 | const arguments = 100; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments14_es5.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments14_es5.2.minified.js new file mode 100644 index 000000000000..d69d554b3cb3 --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments14_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 5 | const arguments = 100; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments15_ES6_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments15_ES6_es2015.1.normal.js new file mode 100644 index 000000000000..8d96b94bd3cf --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments15_ES6_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var arguments = "hello"; +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 6 | const arguments = 100; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments15_ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments15_ES6_es2015.2.minified.js new file mode 100644 index 000000000000..8d96b94bd3cf --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments15_ES6_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var arguments = "hello"; +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 6 | const arguments = 100; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments15_ES6_es5.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments15_ES6_es5.1.normal.js new file mode 100644 index 000000000000..8d96b94bd3cf --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments15_ES6_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var arguments = "hello"; +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 6 | const arguments = 100; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments15_ES6_es5.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments15_ES6_es5.2.minified.js new file mode 100644 index 000000000000..8d96b94bd3cf --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments15_ES6_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var arguments = "hello"; +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 6 | const arguments = 100; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments15_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments15_es2015.1.normal.js new file mode 100644 index 000000000000..8d96b94bd3cf --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments15_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var arguments = "hello"; +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 6 | const arguments = 100; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments15_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments15_es2015.2.minified.js new file mode 100644 index 000000000000..8d96b94bd3cf --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments15_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var arguments = "hello"; +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 6 | const arguments = 100; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments15_es5.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments15_es5.1.normal.js new file mode 100644 index 000000000000..8d96b94bd3cf --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments15_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var arguments = "hello"; +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 6 | const arguments = 100; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments15_es5.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments15_es5.2.minified.js new file mode 100644 index 000000000000..8d96b94bd3cf --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments15_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var arguments = "hello"; +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 6 | const arguments = 100; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments16_ES6_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments16_ES6_es2015.1.normal.js new file mode 100644 index 000000000000..630bb70659ff --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments16_ES6_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var arguments = "hello"; +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 8 | var arguments = "world"; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments16_ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments16_ES6_es2015.2.minified.js new file mode 100644 index 000000000000..630bb70659ff --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments16_ES6_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var arguments = "hello"; +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 8 | var arguments = "world"; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments16_ES6_es5.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments16_ES6_es5.1.normal.js new file mode 100644 index 000000000000..630bb70659ff --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments16_ES6_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var arguments = "hello"; +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 8 | var arguments = "world"; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments16_ES6_es5.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments16_ES6_es5.2.minified.js new file mode 100644 index 000000000000..630bb70659ff --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments16_ES6_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var arguments = "hello"; +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 8 | var arguments = "world"; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments16_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments16_es2015.1.normal.js new file mode 100644 index 000000000000..630bb70659ff --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments16_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var arguments = "hello"; +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 8 | var arguments = "world"; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments16_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments16_es2015.2.minified.js new file mode 100644 index 000000000000..630bb70659ff --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments16_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var arguments = "hello"; +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 8 | var arguments = "world"; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments16_es5.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments16_es5.1.normal.js new file mode 100644 index 000000000000..630bb70659ff --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments16_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var arguments = "hello"; +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 8 | var arguments = "world"; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments16_es5.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments16_es5.2.minified.js new file mode 100644 index 000000000000..630bb70659ff --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments16_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 4 | var arguments = "hello"; +//! : ^^^^^^^^^ +//! `---- +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 8 | var arguments = "world"; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments17_ES6_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments17_ES6_es2015.1.normal.js new file mode 100644 index 000000000000..e6e737f79f9c --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments17_ES6_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 8 | var arguments = "world"; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments17_ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments17_ES6_es2015.2.minified.js new file mode 100644 index 000000000000..e6e737f79f9c --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments17_ES6_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 8 | var arguments = "world"; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments17_ES6_es5.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments17_ES6_es5.1.normal.js new file mode 100644 index 000000000000..e6e737f79f9c --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments17_ES6_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 8 | var arguments = "world"; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments17_ES6_es5.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments17_ES6_es5.2.minified.js new file mode 100644 index 000000000000..e6e737f79f9c --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments17_ES6_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 8 | var arguments = "world"; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments17_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments17_es2015.1.normal.js new file mode 100644 index 000000000000..e6e737f79f9c --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments17_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 8 | var arguments = "world"; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments17_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments17_es2015.2.minified.js new file mode 100644 index 000000000000..e6e737f79f9c --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments17_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 8 | var arguments = "world"; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments17_es5.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments17_es5.1.normal.js new file mode 100644 index 000000000000..e6e737f79f9c --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments17_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 8 | var arguments = "world"; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments17_es5.2.minified.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments17_es5.2.minified.js new file mode 100644 index 000000000000..e6e737f79f9c --- /dev/null +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments17_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode +//! ,---- +//! 8 | var arguments = "world"; +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2015_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2015_es2015.1.normal.js index 6468e2475aa6..55f5a41c9069 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2015_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2015_es2015.1.normal.js @@ -1,9 +1,6 @@ // @target: es2015 // @lib: esnext // @filename: C1.ts -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class C1 { f() { @@ -11,6 +8,7 @@ class C1 { } } // @filename: C2.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class C2 { f() { return _wrap_async_generator(function*() { @@ -19,6 +17,7 @@ class C2 { } } // @filename: C3.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class C3 { f() { return _wrap_async_generator(function*() { @@ -27,6 +26,10 @@ class C3 { } } // @filename: C4.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class C4 { f() { return _wrap_async_generator(function*() { @@ -37,6 +40,10 @@ class C4 { } } // @filename: C5.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class C5 { f() { return _wrap_async_generator(function*() { @@ -47,6 +54,8 @@ class C5 { } } // @filename: C6.ts +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class C6 { f() { return _wrap_async_generator(function*() { @@ -55,6 +64,7 @@ class C6 { } } // @filename: C7.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class C7 { f() { return _wrap_async_generator(function*() { @@ -63,6 +73,7 @@ class C7 { } } // @filename: C8.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class C8 { g() {} f() { @@ -73,6 +84,7 @@ class C8 { } } // @filename: C9.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class B9 { g() {} } diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2015_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2015_es2015.2.minified.js index d30380729ffe..251bf7f2eedd 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2015_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2015_es2015.2.minified.js @@ -1,4 +1,16 @@ +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2015_es5.1.normal.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2015_es5.1.normal.js index 10deeb149424..7071b95a04fb 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2015_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2015_es5.1.normal.js @@ -1,15 +1,8 @@ // @target: es2015 // @lib: esnext // @filename: C1.ts -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _get from "@swc/helpers/src/_get.mjs"; -import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; import regeneratorRuntime from "regenerator-runtime"; var C1 = /*#__PURE__*/ function() { "use strict"; @@ -31,6 +24,9 @@ var C1 = /*#__PURE__*/ function() { return C1; }(); // @filename: C2.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C2 = /*#__PURE__*/ function() { "use strict"; function C2() { @@ -57,6 +53,9 @@ var C2 = /*#__PURE__*/ function() { return C2; }(); // @filename: C3.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C3 = /*#__PURE__*/ function() { "use strict"; function C3() { @@ -83,6 +82,12 @@ var C3 = /*#__PURE__*/ function() { return C3; }(); // @filename: C4.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C4 = /*#__PURE__*/ function() { "use strict"; function C4() { @@ -110,6 +115,12 @@ var C4 = /*#__PURE__*/ function() { return C4; }(); // @filename: C5.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C5 = /*#__PURE__*/ function() { "use strict"; function C5() { @@ -146,6 +157,10 @@ var C5 = /*#__PURE__*/ function() { return C5; }(); // @filename: C6.ts +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C6 = /*#__PURE__*/ function() { "use strict"; function C6() { @@ -172,6 +187,9 @@ var C6 = /*#__PURE__*/ function() { return C6; }(); // @filename: C7.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C7 = /*#__PURE__*/ function() { "use strict"; function C7() { @@ -194,6 +212,9 @@ var C7 = /*#__PURE__*/ function() { return C7; }(); // @filename: C8.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C8 = /*#__PURE__*/ function() { "use strict"; function C8() { @@ -218,6 +239,13 @@ var C8 = /*#__PURE__*/ function() { return C8; }(); // @filename: C9.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var B9 = /*#__PURE__*/ function() { "use strict"; function B9() { diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2015_es5.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2015_es5.2.minified.js index 3192a21caeb2..2090cb6683b8 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2015_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2015_es5.2.minified.js @@ -1,12 +1,5 @@ -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _get from "@swc/helpers/src/_get.mjs"; -import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; import regeneratorRuntime from "regenerator-runtime"; var C1 = function() { "use strict"; @@ -24,7 +17,11 @@ var C1 = function() { }, _callee); }))(); }, C1; -}(), C2 = function() { +}(); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +var C2 = function() { "use strict"; function C2() { _class_call_check(this, C2); @@ -46,7 +43,11 @@ var C1 = function() { }, _callee); }))(); }, C2; -}(), C3 = function() { +}(); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +var C3 = function() { "use strict"; function C3() { _class_call_check(this, C3); @@ -67,7 +68,14 @@ var C1 = function() { }, _callee); }))(); }, C3; -}(), C4 = function() { +}(); +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +var C4 = function() { "use strict"; function C4() { _class_call_check(this, C4); @@ -90,7 +98,14 @@ var C1 = function() { }, _callee); }))(); }, C4; -}(), C5 = function() { +}(); +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +var C5 = function() { "use strict"; function C5() { _class_call_check(this, C5); @@ -121,7 +136,12 @@ var C1 = function() { }, _callee); }))(); }, C5; -}(), C6 = function() { +}(); +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +var C6 = function() { "use strict"; function C6() { _class_call_check(this, C6); @@ -142,7 +162,11 @@ var C1 = function() { }, _callee); }))(); }, C6; -}(), C7 = function() { +}(); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +var C7 = function() { "use strict"; function C7() { _class_call_check(this, C7); @@ -160,7 +184,11 @@ var C1 = function() { }, _callee); }))(); }, C7; -}(), C8 = function() { +}(); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +var C8 = function() { "use strict"; function C8() { _class_call_check(this, C8); @@ -180,7 +208,15 @@ var C1 = function() { }, _callee); }))(); }, C8; -}(), B9 = function() { +}(); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +var B9 = function() { "use strict"; function B9() { _class_call_check(this, B9); diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2018_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2018_es2015.1.normal.js index d48a613f73dd..6ae576eb3eae 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2018_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2018_es2015.1.normal.js @@ -1,9 +1,6 @@ // @target: es2018 // @lib: esnext // @filename: C1.ts -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class C1 { f() { @@ -11,6 +8,7 @@ class C1 { } } // @filename: C2.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class C2 { f() { return _wrap_async_generator(function*() { @@ -19,6 +17,7 @@ class C2 { } } // @filename: C3.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class C3 { f() { return _wrap_async_generator(function*() { @@ -27,6 +26,10 @@ class C3 { } } // @filename: C4.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class C4 { f() { return _wrap_async_generator(function*() { @@ -37,6 +40,10 @@ class C4 { } } // @filename: C5.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class C5 { f() { return _wrap_async_generator(function*() { @@ -47,6 +54,8 @@ class C5 { } } // @filename: C6.ts +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class C6 { f() { return _wrap_async_generator(function*() { @@ -55,6 +64,7 @@ class C6 { } } // @filename: C7.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class C7 { f() { return _wrap_async_generator(function*() { @@ -63,6 +73,7 @@ class C7 { } } // @filename: C8.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class C8 { g() {} f() { @@ -73,6 +84,7 @@ class C8 { } } // @filename: C9.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class B9 { g() {} } diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2018_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2018_es2015.2.minified.js index d30380729ffe..251bf7f2eedd 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2018_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2018_es2015.2.minified.js @@ -1,4 +1,16 @@ +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2018_es5.1.normal.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2018_es5.1.normal.js index 0756b8756568..ae0b8a1efe31 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2018_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2018_es5.1.normal.js @@ -1,15 +1,8 @@ // @target: es2018 // @lib: esnext // @filename: C1.ts -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _get from "@swc/helpers/src/_get.mjs"; -import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; import regeneratorRuntime from "regenerator-runtime"; var C1 = /*#__PURE__*/ function() { "use strict"; @@ -31,6 +24,9 @@ var C1 = /*#__PURE__*/ function() { return C1; }(); // @filename: C2.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C2 = /*#__PURE__*/ function() { "use strict"; function C2() { @@ -57,6 +53,9 @@ var C2 = /*#__PURE__*/ function() { return C2; }(); // @filename: C3.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C3 = /*#__PURE__*/ function() { "use strict"; function C3() { @@ -83,6 +82,12 @@ var C3 = /*#__PURE__*/ function() { return C3; }(); // @filename: C4.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C4 = /*#__PURE__*/ function() { "use strict"; function C4() { @@ -110,6 +115,12 @@ var C4 = /*#__PURE__*/ function() { return C4; }(); // @filename: C5.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C5 = /*#__PURE__*/ function() { "use strict"; function C5() { @@ -146,6 +157,10 @@ var C5 = /*#__PURE__*/ function() { return C5; }(); // @filename: C6.ts +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C6 = /*#__PURE__*/ function() { "use strict"; function C6() { @@ -172,6 +187,9 @@ var C6 = /*#__PURE__*/ function() { return C6; }(); // @filename: C7.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C7 = /*#__PURE__*/ function() { "use strict"; function C7() { @@ -194,6 +212,9 @@ var C7 = /*#__PURE__*/ function() { return C7; }(); // @filename: C8.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C8 = /*#__PURE__*/ function() { "use strict"; function C8() { @@ -218,6 +239,13 @@ var C8 = /*#__PURE__*/ function() { return C8; }(); // @filename: C9.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var B9 = /*#__PURE__*/ function() { "use strict"; function B9() { diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2018_es5.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2018_es5.2.minified.js index 3192a21caeb2..2090cb6683b8 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2018_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es2018_es5.2.minified.js @@ -1,12 +1,5 @@ -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _get from "@swc/helpers/src/_get.mjs"; -import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; import regeneratorRuntime from "regenerator-runtime"; var C1 = function() { "use strict"; @@ -24,7 +17,11 @@ var C1 = function() { }, _callee); }))(); }, C1; -}(), C2 = function() { +}(); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +var C2 = function() { "use strict"; function C2() { _class_call_check(this, C2); @@ -46,7 +43,11 @@ var C1 = function() { }, _callee); }))(); }, C2; -}(), C3 = function() { +}(); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +var C3 = function() { "use strict"; function C3() { _class_call_check(this, C3); @@ -67,7 +68,14 @@ var C1 = function() { }, _callee); }))(); }, C3; -}(), C4 = function() { +}(); +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +var C4 = function() { "use strict"; function C4() { _class_call_check(this, C4); @@ -90,7 +98,14 @@ var C1 = function() { }, _callee); }))(); }, C4; -}(), C5 = function() { +}(); +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +var C5 = function() { "use strict"; function C5() { _class_call_check(this, C5); @@ -121,7 +136,12 @@ var C1 = function() { }, _callee); }))(); }, C5; -}(), C6 = function() { +}(); +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +var C6 = function() { "use strict"; function C6() { _class_call_check(this, C6); @@ -142,7 +162,11 @@ var C1 = function() { }, _callee); }))(); }, C6; -}(), C7 = function() { +}(); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +var C7 = function() { "use strict"; function C7() { _class_call_check(this, C7); @@ -160,7 +184,11 @@ var C1 = function() { }, _callee); }))(); }, C7; -}(), C8 = function() { +}(); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +var C8 = function() { "use strict"; function C8() { _class_call_check(this, C8); @@ -180,7 +208,15 @@ var C1 = function() { }, _callee); }))(); }, C8; -}(), B9 = function() { +}(); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +var B9 = function() { "use strict"; function B9() { _class_call_check(this, B9); diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es5_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es5_es2015.1.normal.js index 3210d29d1005..82a1f0e54652 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es5_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es5_es2015.1.normal.js @@ -1,9 +1,6 @@ // @target: es5 // @lib: esnext // @filename: C1.ts -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class C1 { f() { @@ -11,6 +8,7 @@ class C1 { } } // @filename: C2.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class C2 { f() { return _wrap_async_generator(function*() { @@ -19,6 +17,7 @@ class C2 { } } // @filename: C3.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class C3 { f() { return _wrap_async_generator(function*() { @@ -27,6 +26,10 @@ class C3 { } } // @filename: C4.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class C4 { f() { return _wrap_async_generator(function*() { @@ -37,6 +40,10 @@ class C4 { } } // @filename: C5.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class C5 { f() { return _wrap_async_generator(function*() { @@ -47,6 +54,8 @@ class C5 { } } // @filename: C6.ts +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class C6 { f() { return _wrap_async_generator(function*() { @@ -55,6 +64,7 @@ class C6 { } } // @filename: C7.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class C7 { f() { return _wrap_async_generator(function*() { @@ -63,6 +73,7 @@ class C7 { } } // @filename: C8.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class C8 { g() {} f() { @@ -73,6 +84,7 @@ class C8 { } } // @filename: C9.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; class B9 { g() {} } diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es5_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es5_es2015.2.minified.js index d30380729ffe..251bf7f2eedd 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es5_es2015.2.minified.js @@ -1,4 +1,16 @@ +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es5_es5.1.normal.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es5_es5.1.normal.js index 7fe31201c4bb..60265d0a6207 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es5_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es5_es5.1.normal.js @@ -1,15 +1,8 @@ // @target: es5 // @lib: esnext // @filename: C1.ts -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _get from "@swc/helpers/src/_get.mjs"; -import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; import regeneratorRuntime from "regenerator-runtime"; var C1 = /*#__PURE__*/ function() { "use strict"; @@ -31,6 +24,9 @@ var C1 = /*#__PURE__*/ function() { return C1; }(); // @filename: C2.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C2 = /*#__PURE__*/ function() { "use strict"; function C2() { @@ -57,6 +53,9 @@ var C2 = /*#__PURE__*/ function() { return C2; }(); // @filename: C3.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C3 = /*#__PURE__*/ function() { "use strict"; function C3() { @@ -83,6 +82,12 @@ var C3 = /*#__PURE__*/ function() { return C3; }(); // @filename: C4.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C4 = /*#__PURE__*/ function() { "use strict"; function C4() { @@ -110,6 +115,12 @@ var C4 = /*#__PURE__*/ function() { return C4; }(); // @filename: C5.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C5 = /*#__PURE__*/ function() { "use strict"; function C5() { @@ -146,6 +157,10 @@ var C5 = /*#__PURE__*/ function() { return C5; }(); // @filename: C6.ts +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C6 = /*#__PURE__*/ function() { "use strict"; function C6() { @@ -172,6 +187,9 @@ var C6 = /*#__PURE__*/ function() { return C6; }(); // @filename: C7.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C7 = /*#__PURE__*/ function() { "use strict"; function C7() { @@ -194,6 +212,9 @@ var C7 = /*#__PURE__*/ function() { return C7; }(); // @filename: C8.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C8 = /*#__PURE__*/ function() { "use strict"; function C8() { @@ -218,6 +239,13 @@ var C8 = /*#__PURE__*/ function() { return C8; }(); // @filename: C9.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var B9 = /*#__PURE__*/ function() { "use strict"; function B9() { diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es5_es5.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es5_es5.2.minified.js index 3192a21caeb2..2090cb6683b8 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es5_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es5_es5.2.minified.js @@ -1,12 +1,5 @@ -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _get from "@swc/helpers/src/_get.mjs"; -import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; import regeneratorRuntime from "regenerator-runtime"; var C1 = function() { "use strict"; @@ -24,7 +17,11 @@ var C1 = function() { }, _callee); }))(); }, C1; -}(), C2 = function() { +}(); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +var C2 = function() { "use strict"; function C2() { _class_call_check(this, C2); @@ -46,7 +43,11 @@ var C1 = function() { }, _callee); }))(); }, C2; -}(), C3 = function() { +}(); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +var C3 = function() { "use strict"; function C3() { _class_call_check(this, C3); @@ -67,7 +68,14 @@ var C1 = function() { }, _callee); }))(); }, C3; -}(), C4 = function() { +}(); +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +var C4 = function() { "use strict"; function C4() { _class_call_check(this, C4); @@ -90,7 +98,14 @@ var C1 = function() { }, _callee); }))(); }, C4; -}(), C5 = function() { +}(); +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +var C5 = function() { "use strict"; function C5() { _class_call_check(this, C5); @@ -121,7 +136,12 @@ var C1 = function() { }, _callee); }))(); }, C5; -}(), C6 = function() { +}(); +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +var C6 = function() { "use strict"; function C6() { _class_call_check(this, C6); @@ -142,7 +162,11 @@ var C1 = function() { }, _callee); }))(); }, C6; -}(), C7 = function() { +}(); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +var C7 = function() { "use strict"; function C7() { _class_call_check(this, C7); @@ -160,7 +184,11 @@ var C1 = function() { }, _callee); }))(); }, C7; -}(), C8 = function() { +}(); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +var C8 = function() { "use strict"; function C8() { _class_call_check(this, C8); @@ -180,7 +208,15 @@ var C1 = function() { }, _callee); }))(); }, C8; -}(), B9 = function() { +}(); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +var B9 = function() { "use strict"; function B9() { _class_call_check(this, B9); diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2015_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2015_es2015.1.normal.js index 907dce695cdb..1993c06387a6 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2015_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2015_es2015.1.normal.js @@ -1,9 +1,6 @@ // @target: es2015 // @lib: esnext // @filename: F1.ts -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f1() { return _f1.apply(this, arguments); @@ -12,66 +9,79 @@ function _f1() { _f1 = _wrap_async_generator(function*() {}); return _f1.apply(this, arguments); } +// @filename: F2.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f2() { return _f2.apply(this, arguments); } function _f2() { - _f2 = // @filename: F2.ts - _wrap_async_generator(function*() { + _f2 = _wrap_async_generator(function*() { const x = yield; }); return _f2.apply(this, arguments); } +// @filename: F3.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f3() { return _f3.apply(this, arguments); } function _f3() { - _f3 = // @filename: F3.ts - _wrap_async_generator(function*() { + _f3 = _wrap_async_generator(function*() { const x = yield 1; }); return _f3.apply(this, arguments); } +// @filename: F4.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f4() { return _f4.apply(this, arguments); } function _f4() { - _f4 = // @filename: F4.ts - _wrap_async_generator(function*() { + _f4 = _wrap_async_generator(function*() { const x = yield* _async_generator_delegate(_async_iterator([ 1 ]), _await_async_generator); }); return _f4.apply(this, arguments); } +// @filename: F5.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f5() { return _f5.apply(this, arguments); } function _f5() { - _f5 = // @filename: F5.ts - _wrap_async_generator(function*() { + _f5 = _wrap_async_generator(function*() { const x = yield* _async_generator_delegate(_async_iterator(_wrap_async_generator(function*() { yield 1; })()), _await_async_generator); }); return _f5.apply(this, arguments); } +// @filename: F6.ts +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f6() { return _f6.apply(this, arguments); } function _f6() { - _f6 = // @filename: F6.ts - _wrap_async_generator(function*() { + _f6 = _wrap_async_generator(function*() { const x = yield _await_async_generator(1); }); return _f6.apply(this, arguments); } +// @filename: F7.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f7() { return _f7.apply(this, arguments); } function _f7() { - _f7 = // @filename: F7.ts - _wrap_async_generator(function*() { + _f7 = _wrap_async_generator(function*() { return 1; }); return _f7.apply(this, arguments); diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2015_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2015_es2015.2.minified.js index d30380729ffe..cac6ecb5df5a 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2015_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2015_es2015.2.minified.js @@ -1,4 +1,14 @@ +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2015_es5.1.normal.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2015_es5.1.normal.js index eaf397d9fe59..c063a0ec6c72 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2015_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2015_es5.1.normal.js @@ -1,9 +1,6 @@ // @target: es2015 // @lib: esnext // @filename: F1.ts -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; function f1() { @@ -21,12 +18,14 @@ function _f1() { })); return _f1.apply(this, arguments); } +// @filename: F2.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function f2() { return _f2.apply(this, arguments); } function _f2() { - _f2 = // @filename: F2.ts - _wrap_async_generator(regeneratorRuntime.mark(function _callee() { + _f2 = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ @@ -43,12 +42,14 @@ function _f2() { })); return _f2.apply(this, arguments); } +// @filename: F3.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function f3() { return _f3.apply(this, arguments); } function _f3() { - _f3 = // @filename: F3.ts - _wrap_async_generator(regeneratorRuntime.mark(function _callee() { + _f3 = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ @@ -65,12 +66,17 @@ function _f3() { })); return _f3.apply(this, arguments); } +// @filename: F4.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function f4() { return _f4.apply(this, arguments); } function _f4() { - _f4 = // @filename: F4.ts - _wrap_async_generator(regeneratorRuntime.mark(function _callee() { + _f4 = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ @@ -88,12 +94,17 @@ function _f4() { })); return _f4.apply(this, arguments); } +// @filename: F5.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function f5() { return _f5.apply(this, arguments); } function _f5() { - _f5 = // @filename: F5.ts - _wrap_async_generator(regeneratorRuntime.mark(function _callee() { + _f5 = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ @@ -120,12 +131,15 @@ function _f5() { })); return _f5.apply(this, arguments); } +// @filename: F6.ts +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function f6() { return _f6.apply(this, arguments); } function _f6() { - _f6 = // @filename: F6.ts - _wrap_async_generator(regeneratorRuntime.mark(function _callee() { + _f6 = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ @@ -142,12 +156,14 @@ function _f6() { })); return _f6.apply(this, arguments); } +// @filename: F7.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function f7() { return _f7.apply(this, arguments); } function _f7() { - _f7 = // @filename: F7.ts - _wrap_async_generator(regeneratorRuntime.mark(function _callee() { + _f7 = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ case 0: diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2015_es5.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2015_es5.2.minified.js index de0d8b084151..f905629020ea 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2015_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2015_es5.2.minified.js @@ -1,5 +1,21 @@ +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2018_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2018_es2015.1.normal.js index 97e21f8e90aa..6459f4ecad4a 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2018_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2018_es2015.1.normal.js @@ -1,9 +1,6 @@ // @target: es2018 // @lib: esnext // @filename: F1.ts -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f1() { return _f1.apply(this, arguments); @@ -12,66 +9,79 @@ function _f1() { _f1 = _wrap_async_generator(function*() {}); return _f1.apply(this, arguments); } +// @filename: F2.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f2() { return _f2.apply(this, arguments); } function _f2() { - _f2 = // @filename: F2.ts - _wrap_async_generator(function*() { + _f2 = _wrap_async_generator(function*() { const x = yield; }); return _f2.apply(this, arguments); } +// @filename: F3.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f3() { return _f3.apply(this, arguments); } function _f3() { - _f3 = // @filename: F3.ts - _wrap_async_generator(function*() { + _f3 = _wrap_async_generator(function*() { const x = yield 1; }); return _f3.apply(this, arguments); } +// @filename: F4.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f4() { return _f4.apply(this, arguments); } function _f4() { - _f4 = // @filename: F4.ts - _wrap_async_generator(function*() { + _f4 = _wrap_async_generator(function*() { const x = yield* _async_generator_delegate(_async_iterator([ 1 ]), _await_async_generator); }); return _f4.apply(this, arguments); } +// @filename: F5.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f5() { return _f5.apply(this, arguments); } function _f5() { - _f5 = // @filename: F5.ts - _wrap_async_generator(function*() { + _f5 = _wrap_async_generator(function*() { const x = yield* _async_generator_delegate(_async_iterator(_wrap_async_generator(function*() { yield 1; })()), _await_async_generator); }); return _f5.apply(this, arguments); } +// @filename: F6.ts +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f6() { return _f6.apply(this, arguments); } function _f6() { - _f6 = // @filename: F6.ts - _wrap_async_generator(function*() { + _f6 = _wrap_async_generator(function*() { const x = yield _await_async_generator(1); }); return _f6.apply(this, arguments); } +// @filename: F7.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f7() { return _f7.apply(this, arguments); } function _f7() { - _f7 = // @filename: F7.ts - _wrap_async_generator(function*() { + _f7 = _wrap_async_generator(function*() { return 1; }); return _f7.apply(this, arguments); diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2018_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2018_es2015.2.minified.js index d30380729ffe..cac6ecb5df5a 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2018_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2018_es2015.2.minified.js @@ -1,4 +1,14 @@ +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2018_es5.1.normal.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2018_es5.1.normal.js index 750bef95c1de..96409d38fd03 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2018_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2018_es5.1.normal.js @@ -1,9 +1,6 @@ // @target: es2018 // @lib: esnext // @filename: F1.ts -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; function f1() { @@ -21,12 +18,14 @@ function _f1() { })); return _f1.apply(this, arguments); } +// @filename: F2.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function f2() { return _f2.apply(this, arguments); } function _f2() { - _f2 = // @filename: F2.ts - _wrap_async_generator(regeneratorRuntime.mark(function _callee() { + _f2 = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ @@ -43,12 +42,14 @@ function _f2() { })); return _f2.apply(this, arguments); } +// @filename: F3.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function f3() { return _f3.apply(this, arguments); } function _f3() { - _f3 = // @filename: F3.ts - _wrap_async_generator(regeneratorRuntime.mark(function _callee() { + _f3 = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ @@ -65,12 +66,17 @@ function _f3() { })); return _f3.apply(this, arguments); } +// @filename: F4.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function f4() { return _f4.apply(this, arguments); } function _f4() { - _f4 = // @filename: F4.ts - _wrap_async_generator(regeneratorRuntime.mark(function _callee() { + _f4 = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ @@ -88,12 +94,17 @@ function _f4() { })); return _f4.apply(this, arguments); } +// @filename: F5.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function f5() { return _f5.apply(this, arguments); } function _f5() { - _f5 = // @filename: F5.ts - _wrap_async_generator(regeneratorRuntime.mark(function _callee() { + _f5 = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ @@ -120,12 +131,15 @@ function _f5() { })); return _f5.apply(this, arguments); } +// @filename: F6.ts +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function f6() { return _f6.apply(this, arguments); } function _f6() { - _f6 = // @filename: F6.ts - _wrap_async_generator(regeneratorRuntime.mark(function _callee() { + _f6 = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ @@ -142,12 +156,14 @@ function _f6() { })); return _f6.apply(this, arguments); } +// @filename: F7.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function f7() { return _f7.apply(this, arguments); } function _f7() { - _f7 = // @filename: F7.ts - _wrap_async_generator(regeneratorRuntime.mark(function _callee() { + _f7 = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ case 0: diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2018_es5.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2018_es5.2.minified.js index de0d8b084151..f905629020ea 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2018_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es2018_es5.2.minified.js @@ -1,5 +1,21 @@ +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es5_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es5_es2015.1.normal.js index 006370c88765..cbcaa803b333 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es5_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es5_es2015.1.normal.js @@ -1,9 +1,6 @@ // @target: es5 // @lib: esnext // @filename: F1.ts -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f1() { return _f1.apply(this, arguments); @@ -12,66 +9,79 @@ function _f1() { _f1 = _wrap_async_generator(function*() {}); return _f1.apply(this, arguments); } +// @filename: F2.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f2() { return _f2.apply(this, arguments); } function _f2() { - _f2 = // @filename: F2.ts - _wrap_async_generator(function*() { + _f2 = _wrap_async_generator(function*() { const x = yield; }); return _f2.apply(this, arguments); } +// @filename: F3.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f3() { return _f3.apply(this, arguments); } function _f3() { - _f3 = // @filename: F3.ts - _wrap_async_generator(function*() { + _f3 = _wrap_async_generator(function*() { const x = yield 1; }); return _f3.apply(this, arguments); } +// @filename: F4.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f4() { return _f4.apply(this, arguments); } function _f4() { - _f4 = // @filename: F4.ts - _wrap_async_generator(function*() { + _f4 = _wrap_async_generator(function*() { const x = yield* _async_generator_delegate(_async_iterator([ 1 ]), _await_async_generator); }); return _f4.apply(this, arguments); } +// @filename: F5.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f5() { return _f5.apply(this, arguments); } function _f5() { - _f5 = // @filename: F5.ts - _wrap_async_generator(function*() { + _f5 = _wrap_async_generator(function*() { const x = yield* _async_generator_delegate(_async_iterator(_wrap_async_generator(function*() { yield 1; })()), _await_async_generator); }); return _f5.apply(this, arguments); } +// @filename: F6.ts +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f6() { return _f6.apply(this, arguments); } function _f6() { - _f6 = // @filename: F6.ts - _wrap_async_generator(function*() { + _f6 = _wrap_async_generator(function*() { const x = yield _await_async_generator(1); }); return _f6.apply(this, arguments); } +// @filename: F7.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f7() { return _f7.apply(this, arguments); } function _f7() { - _f7 = // @filename: F7.ts - _wrap_async_generator(function*() { + _f7 = _wrap_async_generator(function*() { return 1; }); return _f7.apply(this, arguments); diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es5_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es5_es2015.2.minified.js index d30380729ffe..cac6ecb5df5a 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es5_es2015.2.minified.js @@ -1,4 +1,14 @@ +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es5_es5.1.normal.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es5_es5.1.normal.js index 7c0d476323fb..876e8fab001b 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es5_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es5_es5.1.normal.js @@ -1,9 +1,6 @@ // @target: es5 // @lib: esnext // @filename: F1.ts -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; function f1() { @@ -21,12 +18,14 @@ function _f1() { })); return _f1.apply(this, arguments); } +// @filename: F2.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function f2() { return _f2.apply(this, arguments); } function _f2() { - _f2 = // @filename: F2.ts - _wrap_async_generator(regeneratorRuntime.mark(function _callee() { + _f2 = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ @@ -43,12 +42,14 @@ function _f2() { })); return _f2.apply(this, arguments); } +// @filename: F3.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function f3() { return _f3.apply(this, arguments); } function _f3() { - _f3 = // @filename: F3.ts - _wrap_async_generator(regeneratorRuntime.mark(function _callee() { + _f3 = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ @@ -65,12 +66,17 @@ function _f3() { })); return _f3.apply(this, arguments); } +// @filename: F4.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function f4() { return _f4.apply(this, arguments); } function _f4() { - _f4 = // @filename: F4.ts - _wrap_async_generator(regeneratorRuntime.mark(function _callee() { + _f4 = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ @@ -88,12 +94,17 @@ function _f4() { })); return _f4.apply(this, arguments); } +// @filename: F5.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function f5() { return _f5.apply(this, arguments); } function _f5() { - _f5 = // @filename: F5.ts - _wrap_async_generator(regeneratorRuntime.mark(function _callee() { + _f5 = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ @@ -120,12 +131,15 @@ function _f5() { })); return _f5.apply(this, arguments); } +// @filename: F6.ts +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function f6() { return _f6.apply(this, arguments); } function _f6() { - _f6 = // @filename: F6.ts - _wrap_async_generator(regeneratorRuntime.mark(function _callee() { + _f6 = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ @@ -142,12 +156,14 @@ function _f6() { })); return _f6.apply(this, arguments); } +// @filename: F7.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function f7() { return _f7.apply(this, arguments); } function _f7() { - _f7 = // @filename: F7.ts - _wrap_async_generator(regeneratorRuntime.mark(function _callee() { + _f7 = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ case 0: diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es5_es5.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es5_es5.2.minified.js index de0d8b084151..f905629020ea 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es5_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionDeclarations.es5_es5.2.minified.js @@ -1,5 +1,21 @@ +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2015_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2015_es2015.1.normal.js index 9cb4705e72e6..f04a0af1d0a7 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2015_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2015_es2015.1.normal.js @@ -1,9 +1,6 @@ // @target: es2015 // @lib: esnext // @filename: F1.ts -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const f1 = function() { var _ref = _wrap_async_generator(function*() {}); @@ -12,6 +9,7 @@ const f1 = function() { }; }(); // @filename: F2.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const f2 = function() { var _ref = _wrap_async_generator(function*() { const x = yield; @@ -21,6 +19,7 @@ const f2 = function() { }; }(); // @filename: F3.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const f3 = function() { var _ref = _wrap_async_generator(function*() { const x = yield 1; @@ -30,6 +29,10 @@ const f3 = function() { }; }(); // @filename: F4.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const f4 = function() { var _ref = _wrap_async_generator(function*() { const x = yield* _async_generator_delegate(_async_iterator([ @@ -41,6 +44,10 @@ const f4 = function() { }; }(); // @filename: F5.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const f5 = function() { var _ref = _wrap_async_generator(function*() { const x = yield* _async_generator_delegate(_async_iterator(_wrap_async_generator(function*() { @@ -52,6 +59,8 @@ const f5 = function() { }; }(); // @filename: F6.ts +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const f6 = function() { var _ref = _wrap_async_generator(function*() { const x = yield _await_async_generator(1); @@ -61,6 +70,7 @@ const f6 = function() { }; }(); // @filename: F7.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const f7 = function() { var _ref = _wrap_async_generator(function*() { return 1; diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2015_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2015_es2015.2.minified.js index 26beb0193329..5beb8960676a 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2015_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2015_es2015.2.minified.js @@ -1,21 +1,37 @@ +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +_wrap_async_generator(function*() {}); +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +_wrap_async_generator(function*() { + yield; +}); +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +_wrap_async_generator(function*() { + yield 1; +}); import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; -_wrap_async_generator(function*() {}), _wrap_async_generator(function*() { - yield; -}), _wrap_async_generator(function*() { - yield 1; -}), _wrap_async_generator(function*() { +_wrap_async_generator(function*() { yield* _async_generator_delegate(_async_iterator([ 1 ]), _await_async_generator); -}), _wrap_async_generator(function*() { +}); +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +_wrap_async_generator(function*() { yield* _async_generator_delegate(_async_iterator(_wrap_async_generator(function*() { yield 1; })()), _await_async_generator); -}), _wrap_async_generator(function*() { +}); +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +_wrap_async_generator(function*() { yield _await_async_generator(1); -}), _wrap_async_generator(function*() { +}); +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +_wrap_async_generator(function*() { return 1; }); diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2015_es5.1.normal.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2015_es5.1.normal.js index ef96829c624e..0c0dac7c5463 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2015_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2015_es5.1.normal.js @@ -1,9 +1,6 @@ // @target: es2015 // @lib: esnext // @filename: F1.ts -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; var f1 = function() { @@ -21,6 +18,8 @@ var f1 = function() { }; }(); // @filename: F2.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var f2 = function() { var _ref = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; @@ -42,6 +41,8 @@ var f2 = function() { }; }(); // @filename: F3.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var f3 = function() { var _ref = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; @@ -63,6 +64,11 @@ var f3 = function() { }; }(); // @filename: F4.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var f4 = function() { var _ref = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; @@ -85,6 +91,11 @@ var f4 = function() { }; }(); // @filename: F5.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var f5 = function() { var _ref = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; @@ -116,6 +127,9 @@ var f5 = function() { }; }(); // @filename: F6.ts +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var f6 = function() { var _ref = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; @@ -137,6 +151,8 @@ var f6 = function() { }; }(); // @filename: F7.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var f7 = function() { var _ref = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_ctx) { diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2015_es5.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2015_es5.2.minified.js index 586f593f362f..026235901ac1 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2015_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2015_es5.2.minified.js @@ -1,6 +1,3 @@ -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; _wrap_async_generator(regeneratorRuntime.mark(function _callee() { @@ -11,7 +8,10 @@ _wrap_async_generator(regeneratorRuntime.mark(function _callee() { return _ctx.stop(); } }, _callee); -})), _wrap_async_generator(regeneratorRuntime.mark(function _callee() { +})); +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +_wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function(_ctx) { for(;;)switch(_ctx.prev = _ctx.next){ @@ -25,7 +25,10 @@ _wrap_async_generator(regeneratorRuntime.mark(function _callee() { return _ctx.stop(); } }, _callee); -})), _wrap_async_generator(regeneratorRuntime.mark(function _callee() { +})); +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +_wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function(_ctx) { for(;;)switch(_ctx.prev = _ctx.next){ @@ -38,7 +41,13 @@ _wrap_async_generator(regeneratorRuntime.mark(function _callee() { return _ctx.stop(); } }, _callee); -})), _wrap_async_generator(regeneratorRuntime.mark(function _callee() { +})); +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +_wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function(_ctx) { for(;;)switch(_ctx.prev = _ctx.next){ @@ -53,7 +62,13 @@ _wrap_async_generator(regeneratorRuntime.mark(function _callee() { return _ctx.stop(); } }, _callee); -})), _wrap_async_generator(regeneratorRuntime.mark(function _callee() { +})); +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +_wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function(_ctx) { for(;;)switch(_ctx.prev = _ctx.next){ @@ -76,7 +91,11 @@ _wrap_async_generator(regeneratorRuntime.mark(function _callee() { return _ctx.stop(); } }, _callee); -})), _wrap_async_generator(regeneratorRuntime.mark(function _callee() { +})); +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +_wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function(_ctx) { for(;;)switch(_ctx.prev = _ctx.next){ @@ -89,7 +108,10 @@ _wrap_async_generator(regeneratorRuntime.mark(function _callee() { return _ctx.stop(); } }, _callee); -})), _wrap_async_generator(regeneratorRuntime.mark(function _callee() { +})); +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +_wrap_async_generator(regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function(_ctx) { for(;;)switch(_ctx.prev = _ctx.next){ case 0: diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2018_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2018_es2015.1.normal.js index 413e1f7072cf..d80cf9fdd983 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2018_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2018_es2015.1.normal.js @@ -1,9 +1,6 @@ // @target: es2018 // @lib: esnext // @filename: F1.ts -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const f1 = function() { var _ref = _wrap_async_generator(function*() {}); @@ -12,6 +9,7 @@ const f1 = function() { }; }(); // @filename: F2.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const f2 = function() { var _ref = _wrap_async_generator(function*() { const x = yield; @@ -21,6 +19,7 @@ const f2 = function() { }; }(); // @filename: F3.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const f3 = function() { var _ref = _wrap_async_generator(function*() { const x = yield 1; @@ -30,6 +29,10 @@ const f3 = function() { }; }(); // @filename: F4.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const f4 = function() { var _ref = _wrap_async_generator(function*() { const x = yield* _async_generator_delegate(_async_iterator([ @@ -41,6 +44,10 @@ const f4 = function() { }; }(); // @filename: F5.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const f5 = function() { var _ref = _wrap_async_generator(function*() { const x = yield* _async_generator_delegate(_async_iterator(_wrap_async_generator(function*() { @@ -52,6 +59,8 @@ const f5 = function() { }; }(); // @filename: F6.ts +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const f6 = function() { var _ref = _wrap_async_generator(function*() { const x = yield _await_async_generator(1); @@ -61,6 +70,7 @@ const f6 = function() { }; }(); // @filename: F7.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const f7 = function() { var _ref = _wrap_async_generator(function*() { return 1; diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2018_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2018_es2015.2.minified.js index 26beb0193329..5beb8960676a 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2018_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2018_es2015.2.minified.js @@ -1,21 +1,37 @@ +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +_wrap_async_generator(function*() {}); +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +_wrap_async_generator(function*() { + yield; +}); +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +_wrap_async_generator(function*() { + yield 1; +}); import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; -_wrap_async_generator(function*() {}), _wrap_async_generator(function*() { - yield; -}), _wrap_async_generator(function*() { - yield 1; -}), _wrap_async_generator(function*() { +_wrap_async_generator(function*() { yield* _async_generator_delegate(_async_iterator([ 1 ]), _await_async_generator); -}), _wrap_async_generator(function*() { +}); +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +_wrap_async_generator(function*() { yield* _async_generator_delegate(_async_iterator(_wrap_async_generator(function*() { yield 1; })()), _await_async_generator); -}), _wrap_async_generator(function*() { +}); +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +_wrap_async_generator(function*() { yield _await_async_generator(1); -}), _wrap_async_generator(function*() { +}); +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +_wrap_async_generator(function*() { return 1; }); diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2018_es5.1.normal.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2018_es5.1.normal.js index f4404d42b9a0..3437659b94e5 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2018_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2018_es5.1.normal.js @@ -1,9 +1,6 @@ // @target: es2018 // @lib: esnext // @filename: F1.ts -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; var f1 = function() { @@ -21,6 +18,8 @@ var f1 = function() { }; }(); // @filename: F2.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var f2 = function() { var _ref = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; @@ -42,6 +41,8 @@ var f2 = function() { }; }(); // @filename: F3.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var f3 = function() { var _ref = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; @@ -63,6 +64,11 @@ var f3 = function() { }; }(); // @filename: F4.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var f4 = function() { var _ref = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; @@ -85,6 +91,11 @@ var f4 = function() { }; }(); // @filename: F5.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var f5 = function() { var _ref = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; @@ -116,6 +127,9 @@ var f5 = function() { }; }(); // @filename: F6.ts +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var f6 = function() { var _ref = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; @@ -137,6 +151,8 @@ var f6 = function() { }; }(); // @filename: F7.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var f7 = function() { var _ref = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_ctx) { diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2018_es5.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2018_es5.2.minified.js index 586f593f362f..026235901ac1 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2018_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es2018_es5.2.minified.js @@ -1,6 +1,3 @@ -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; _wrap_async_generator(regeneratorRuntime.mark(function _callee() { @@ -11,7 +8,10 @@ _wrap_async_generator(regeneratorRuntime.mark(function _callee() { return _ctx.stop(); } }, _callee); -})), _wrap_async_generator(regeneratorRuntime.mark(function _callee() { +})); +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +_wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function(_ctx) { for(;;)switch(_ctx.prev = _ctx.next){ @@ -25,7 +25,10 @@ _wrap_async_generator(regeneratorRuntime.mark(function _callee() { return _ctx.stop(); } }, _callee); -})), _wrap_async_generator(regeneratorRuntime.mark(function _callee() { +})); +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +_wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function(_ctx) { for(;;)switch(_ctx.prev = _ctx.next){ @@ -38,7 +41,13 @@ _wrap_async_generator(regeneratorRuntime.mark(function _callee() { return _ctx.stop(); } }, _callee); -})), _wrap_async_generator(regeneratorRuntime.mark(function _callee() { +})); +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +_wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function(_ctx) { for(;;)switch(_ctx.prev = _ctx.next){ @@ -53,7 +62,13 @@ _wrap_async_generator(regeneratorRuntime.mark(function _callee() { return _ctx.stop(); } }, _callee); -})), _wrap_async_generator(regeneratorRuntime.mark(function _callee() { +})); +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +_wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function(_ctx) { for(;;)switch(_ctx.prev = _ctx.next){ @@ -76,7 +91,11 @@ _wrap_async_generator(regeneratorRuntime.mark(function _callee() { return _ctx.stop(); } }, _callee); -})), _wrap_async_generator(regeneratorRuntime.mark(function _callee() { +})); +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +_wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function(_ctx) { for(;;)switch(_ctx.prev = _ctx.next){ @@ -89,7 +108,10 @@ _wrap_async_generator(regeneratorRuntime.mark(function _callee() { return _ctx.stop(); } }, _callee); -})), _wrap_async_generator(regeneratorRuntime.mark(function _callee() { +})); +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +_wrap_async_generator(regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function(_ctx) { for(;;)switch(_ctx.prev = _ctx.next){ case 0: diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es5_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es5_es2015.1.normal.js index c9af9618f6e4..9e6d12e09d7f 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es5_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es5_es2015.1.normal.js @@ -1,9 +1,6 @@ // @target: es5 // @lib: esnext // @filename: F1.ts -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const f1 = function() { var _ref = _wrap_async_generator(function*() {}); @@ -12,6 +9,7 @@ const f1 = function() { }; }(); // @filename: F2.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const f2 = function() { var _ref = _wrap_async_generator(function*() { const x = yield; @@ -21,6 +19,7 @@ const f2 = function() { }; }(); // @filename: F3.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const f3 = function() { var _ref = _wrap_async_generator(function*() { const x = yield 1; @@ -30,6 +29,10 @@ const f3 = function() { }; }(); // @filename: F4.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const f4 = function() { var _ref = _wrap_async_generator(function*() { const x = yield* _async_generator_delegate(_async_iterator([ @@ -41,6 +44,10 @@ const f4 = function() { }; }(); // @filename: F5.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const f5 = function() { var _ref = _wrap_async_generator(function*() { const x = yield* _async_generator_delegate(_async_iterator(_wrap_async_generator(function*() { @@ -52,6 +59,8 @@ const f5 = function() { }; }(); // @filename: F6.ts +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const f6 = function() { var _ref = _wrap_async_generator(function*() { const x = yield _await_async_generator(1); @@ -61,6 +70,7 @@ const f6 = function() { }; }(); // @filename: F7.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const f7 = function() { var _ref = _wrap_async_generator(function*() { return 1; diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es5_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es5_es2015.2.minified.js index 26beb0193329..5beb8960676a 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es5_es2015.2.minified.js @@ -1,21 +1,37 @@ +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +_wrap_async_generator(function*() {}); +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +_wrap_async_generator(function*() { + yield; +}); +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +_wrap_async_generator(function*() { + yield 1; +}); import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; -_wrap_async_generator(function*() {}), _wrap_async_generator(function*() { - yield; -}), _wrap_async_generator(function*() { - yield 1; -}), _wrap_async_generator(function*() { +_wrap_async_generator(function*() { yield* _async_generator_delegate(_async_iterator([ 1 ]), _await_async_generator); -}), _wrap_async_generator(function*() { +}); +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +_wrap_async_generator(function*() { yield* _async_generator_delegate(_async_iterator(_wrap_async_generator(function*() { yield 1; })()), _await_async_generator); -}), _wrap_async_generator(function*() { +}); +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +_wrap_async_generator(function*() { yield _await_async_generator(1); -}), _wrap_async_generator(function*() { +}); +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +_wrap_async_generator(function*() { return 1; }); diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es5_es5.1.normal.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es5_es5.1.normal.js index 14d167f855d0..3dc73eb7933e 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es5_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es5_es5.1.normal.js @@ -1,9 +1,6 @@ // @target: es5 // @lib: esnext // @filename: F1.ts -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; var f1 = function() { @@ -21,6 +18,8 @@ var f1 = function() { }; }(); // @filename: F2.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var f2 = function() { var _ref = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; @@ -42,6 +41,8 @@ var f2 = function() { }; }(); // @filename: F3.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var f3 = function() { var _ref = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; @@ -63,6 +64,11 @@ var f3 = function() { }; }(); // @filename: F4.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var f4 = function() { var _ref = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; @@ -85,6 +91,11 @@ var f4 = function() { }; }(); // @filename: F5.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var f5 = function() { var _ref = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; @@ -116,6 +127,9 @@ var f5 = function() { }; }(); // @filename: F6.ts +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var f6 = function() { var _ref = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; @@ -137,6 +151,8 @@ var f6 = function() { }; }(); // @filename: F7.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var f7 = function() { var _ref = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_ctx) { diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es5_es5.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es5_es5.2.minified.js index 586f593f362f..026235901ac1 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es5_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es5_es5.2.minified.js @@ -1,6 +1,3 @@ -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; _wrap_async_generator(regeneratorRuntime.mark(function _callee() { @@ -11,7 +8,10 @@ _wrap_async_generator(regeneratorRuntime.mark(function _callee() { return _ctx.stop(); } }, _callee); -})), _wrap_async_generator(regeneratorRuntime.mark(function _callee() { +})); +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +_wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function(_ctx) { for(;;)switch(_ctx.prev = _ctx.next){ @@ -25,7 +25,10 @@ _wrap_async_generator(regeneratorRuntime.mark(function _callee() { return _ctx.stop(); } }, _callee); -})), _wrap_async_generator(regeneratorRuntime.mark(function _callee() { +})); +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +_wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function(_ctx) { for(;;)switch(_ctx.prev = _ctx.next){ @@ -38,7 +41,13 @@ _wrap_async_generator(regeneratorRuntime.mark(function _callee() { return _ctx.stop(); } }, _callee); -})), _wrap_async_generator(regeneratorRuntime.mark(function _callee() { +})); +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +_wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function(_ctx) { for(;;)switch(_ctx.prev = _ctx.next){ @@ -53,7 +62,13 @@ _wrap_async_generator(regeneratorRuntime.mark(function _callee() { return _ctx.stop(); } }, _callee); -})), _wrap_async_generator(regeneratorRuntime.mark(function _callee() { +})); +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +_wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function(_ctx) { for(;;)switch(_ctx.prev = _ctx.next){ @@ -76,7 +91,11 @@ _wrap_async_generator(regeneratorRuntime.mark(function _callee() { return _ctx.stop(); } }, _callee); -})), _wrap_async_generator(regeneratorRuntime.mark(function _callee() { +})); +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +_wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x; return regeneratorRuntime.wrap(function(_ctx) { for(;;)switch(_ctx.prev = _ctx.next){ @@ -89,7 +108,10 @@ _wrap_async_generator(regeneratorRuntime.mark(function _callee() { return _ctx.stop(); } }, _callee); -})), _wrap_async_generator(regeneratorRuntime.mark(function _callee() { +})); +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +_wrap_async_generator(regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function(_ctx) { for(;;)switch(_ctx.prev = _ctx.next){ case 0: diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2015_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2015_es2015.1.normal.js index f50d2caa8e07..3ecd2b0dc90f 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2015_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2015_es2015.1.normal.js @@ -1,9 +1,6 @@ // @target: es2015 // @lib: esnext // @filename: O1.ts -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const o1 = { f () { @@ -11,6 +8,7 @@ const o1 = { } }; // @filename: O2.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const o2 = { f () { return _wrap_async_generator(function*() { @@ -19,6 +17,7 @@ const o2 = { } }; // @filename: O3.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const o3 = { f () { return _wrap_async_generator(function*() { @@ -27,6 +26,10 @@ const o3 = { } }; // @filename: O4.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const o4 = { f () { return _wrap_async_generator(function*() { @@ -37,6 +40,10 @@ const o4 = { } }; // @filename: O5.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const o5 = { f () { return _wrap_async_generator(function*() { @@ -47,6 +54,8 @@ const o5 = { } }; // @filename: O6.ts +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const o6 = { f () { return _wrap_async_generator(function*() { @@ -55,6 +64,7 @@ const o6 = { } }; // @filename: O7.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const o7 = { f () { return _wrap_async_generator(function*() { diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2015_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2015_es2015.2.minified.js index d30380729ffe..cac6ecb5df5a 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2015_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2015_es2015.2.minified.js @@ -1,4 +1,14 @@ +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2015_es5.1.normal.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2015_es5.1.normal.js index 2a3a214bf0af..b8b7d6a0ba1b 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2015_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2015_es5.1.normal.js @@ -1,9 +1,6 @@ // @target: es2015 // @lib: esnext // @filename: O1.ts -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; var o1 = { @@ -20,6 +17,8 @@ var o1 = { } }; // @filename: O2.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var o2 = { f: function f() { return _wrap_async_generator(regeneratorRuntime.mark(function _callee() { @@ -40,6 +39,8 @@ var o2 = { } }; // @filename: O3.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var o3 = { f: function f() { return _wrap_async_generator(regeneratorRuntime.mark(function _callee() { @@ -60,6 +61,11 @@ var o3 = { } }; // @filename: O4.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var o4 = { f: function f() { return _wrap_async_generator(regeneratorRuntime.mark(function _callee() { @@ -81,6 +87,11 @@ var o4 = { } }; // @filename: O5.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var o5 = { f: function f() { return _wrap_async_generator(regeneratorRuntime.mark(function _callee() { @@ -111,6 +122,9 @@ var o5 = { } }; // @filename: O6.ts +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var o6 = { f: function f() { return _wrap_async_generator(regeneratorRuntime.mark(function _callee() { @@ -131,6 +145,8 @@ var o6 = { } }; // @filename: O7.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var o7 = { f: function f() { return _wrap_async_generator(regeneratorRuntime.mark(function _callee() { diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2015_es5.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2015_es5.2.minified.js index de0d8b084151..f905629020ea 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2015_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2015_es5.2.minified.js @@ -1,5 +1,21 @@ +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2018_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2018_es2015.1.normal.js index df2b2765d667..c345ff172f70 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2018_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2018_es2015.1.normal.js @@ -1,9 +1,6 @@ // @target: es2018 // @lib: esnext // @filename: O1.ts -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const o1 = { f () { @@ -11,6 +8,7 @@ const o1 = { } }; // @filename: O2.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const o2 = { f () { return _wrap_async_generator(function*() { @@ -19,6 +17,7 @@ const o2 = { } }; // @filename: O3.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const o3 = { f () { return _wrap_async_generator(function*() { @@ -27,6 +26,10 @@ const o3 = { } }; // @filename: O4.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const o4 = { f () { return _wrap_async_generator(function*() { @@ -37,6 +40,10 @@ const o4 = { } }; // @filename: O5.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const o5 = { f () { return _wrap_async_generator(function*() { @@ -47,6 +54,8 @@ const o5 = { } }; // @filename: O6.ts +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const o6 = { f () { return _wrap_async_generator(function*() { @@ -55,6 +64,7 @@ const o6 = { } }; // @filename: O7.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const o7 = { f () { return _wrap_async_generator(function*() { diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2018_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2018_es2015.2.minified.js index d30380729ffe..cac6ecb5df5a 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2018_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2018_es2015.2.minified.js @@ -1,4 +1,14 @@ +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2018_es5.1.normal.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2018_es5.1.normal.js index f81d3bc7836b..b31022a1b83d 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2018_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2018_es5.1.normal.js @@ -1,9 +1,6 @@ // @target: es2018 // @lib: esnext // @filename: O1.ts -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; var o1 = { @@ -20,6 +17,8 @@ var o1 = { } }; // @filename: O2.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var o2 = { f: function f() { return _wrap_async_generator(regeneratorRuntime.mark(function _callee() { @@ -40,6 +39,8 @@ var o2 = { } }; // @filename: O3.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var o3 = { f: function f() { return _wrap_async_generator(regeneratorRuntime.mark(function _callee() { @@ -60,6 +61,11 @@ var o3 = { } }; // @filename: O4.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var o4 = { f: function f() { return _wrap_async_generator(regeneratorRuntime.mark(function _callee() { @@ -81,6 +87,11 @@ var o4 = { } }; // @filename: O5.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var o5 = { f: function f() { return _wrap_async_generator(regeneratorRuntime.mark(function _callee() { @@ -111,6 +122,9 @@ var o5 = { } }; // @filename: O6.ts +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var o6 = { f: function f() { return _wrap_async_generator(regeneratorRuntime.mark(function _callee() { @@ -131,6 +145,8 @@ var o6 = { } }; // @filename: O7.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var o7 = { f: function f() { return _wrap_async_generator(regeneratorRuntime.mark(function _callee() { diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2018_es5.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2018_es5.2.minified.js index de0d8b084151..f905629020ea 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2018_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es2018_es5.2.minified.js @@ -1,5 +1,21 @@ +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es5_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es5_es2015.1.normal.js index 9d6461be0eb6..abdeff6a4e1a 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es5_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es5_es2015.1.normal.js @@ -1,9 +1,6 @@ // @target: es5 // @lib: esnext // @filename: O1.ts -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const o1 = { f () { @@ -11,6 +8,7 @@ const o1 = { } }; // @filename: O2.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const o2 = { f () { return _wrap_async_generator(function*() { @@ -19,6 +17,7 @@ const o2 = { } }; // @filename: O3.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const o3 = { f () { return _wrap_async_generator(function*() { @@ -27,6 +26,10 @@ const o3 = { } }; // @filename: O4.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const o4 = { f () { return _wrap_async_generator(function*() { @@ -37,6 +40,10 @@ const o4 = { } }; // @filename: O5.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const o5 = { f () { return _wrap_async_generator(function*() { @@ -47,6 +54,8 @@ const o5 = { } }; // @filename: O6.ts +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const o6 = { f () { return _wrap_async_generator(function*() { @@ -55,6 +64,7 @@ const o6 = { } }; // @filename: O7.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; const o7 = { f () { return _wrap_async_generator(function*() { diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es5_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es5_es2015.2.minified.js index d30380729ffe..cac6ecb5df5a 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es5_es2015.2.minified.js @@ -1,4 +1,14 @@ +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es5_es5.1.normal.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es5_es5.1.normal.js index 4c41be042377..7a846ad03714 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es5_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es5_es5.1.normal.js @@ -1,9 +1,6 @@ // @target: es5 // @lib: esnext // @filename: O1.ts -import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; -import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; var o1 = { @@ -20,6 +17,8 @@ var o1 = { } }; // @filename: O2.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var o2 = { f: function f() { return _wrap_async_generator(regeneratorRuntime.mark(function _callee() { @@ -40,6 +39,8 @@ var o2 = { } }; // @filename: O3.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var o3 = { f: function f() { return _wrap_async_generator(regeneratorRuntime.mark(function _callee() { @@ -60,6 +61,11 @@ var o3 = { } }; // @filename: O4.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var o4 = { f: function f() { return _wrap_async_generator(regeneratorRuntime.mark(function _callee() { @@ -81,6 +87,11 @@ var o4 = { } }; // @filename: O5.ts +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var o5 = { f: function f() { return _wrap_async_generator(regeneratorRuntime.mark(function _callee() { @@ -111,6 +122,9 @@ var o5 = { } }; // @filename: O6.ts +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var o6 = { f: function f() { return _wrap_async_generator(regeneratorRuntime.mark(function _callee() { @@ -131,6 +145,8 @@ var o6 = { } }; // @filename: O7.ts +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var o7 = { f: function f() { return _wrap_async_generator(regeneratorRuntime.mark(function _callee() { diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es5_es5.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es5_es5.2.minified.js index de0d8b084151..f905629020ea 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es5_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.objectLiteralMethods.es5_es5.2.minified.js @@ -1,5 +1,21 @@ +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; import _async_generator_delegate from "@swc/helpers/src/_async_generator_delegate.mjs"; import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; diff --git a/crates/swc/tests/tsc-references/emitter.forAwait_es2015.1.normal.js b/crates/swc/tests/tsc-references/emitter.forAwait_es2015.1.normal.js index cc0a7a5cbe2d..a59f8a0b6393 100644 --- a/crates/swc/tests/tsc-references/emitter.forAwait_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.forAwait_es2015.1.normal.js @@ -3,8 +3,6 @@ // @filename: file1.ts import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; -import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f1() { return _f1.apply(this, arguments); } @@ -36,12 +34,14 @@ function _f1() { }); return _f1.apply(this, arguments); } +// @filename: file2.ts +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function f2() { return _f2.apply(this, arguments); } function _f2() { - _f2 = // @filename: file2.ts - _async_to_generator(function*() { + _f2 = _async_to_generator(function*() { let x, y; { var _iteratorAbruptCompletion = false, _didIteratorError = false, _iteratorError; @@ -68,12 +68,15 @@ function _f2() { }); return _f2.apply(this, arguments); } +// @filename: file3.ts +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f3() { return _f3.apply(this, arguments); } function _f3() { - _f3 = // @filename: file3.ts - _wrap_async_generator(function*() { + _f3 = _wrap_async_generator(function*() { let y; { var _iteratorAbruptCompletion = false, _didIteratorError = false, _iteratorError; @@ -100,12 +103,15 @@ function _f3() { }); return _f3.apply(this, arguments); } +// @filename: file4.ts +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f4() { return _f4.apply(this, arguments); } function _f4() { - _f4 = // @filename: file4.ts - _wrap_async_generator(function*() { + _f4 = _wrap_async_generator(function*() { let x, y; { var _iteratorAbruptCompletion = false, _didIteratorError = false, _iteratorError; @@ -132,13 +138,15 @@ function _f4() { }); return _f4.apply(this, arguments); } +// @filename: file5.ts +// https://github.com/Microsoft/TypeScript/issues/21363 +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function f5() { return _f5.apply(this, arguments); } function _f5() { - _f5 = // @filename: file5.ts - // https://github.com/Microsoft/TypeScript/issues/21363 - _async_to_generator(function*() { + _f5 = _async_to_generator(function*() { let y; outer: { var _iteratorAbruptCompletion = false, _didIteratorError = false, _iteratorError; @@ -166,13 +174,16 @@ function _f5() { }); return _f5.apply(this, arguments); } +// @filename: file6.ts +// https://github.com/Microsoft/TypeScript/issues/21363 +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f6() { return _f6.apply(this, arguments); } function _f6() { - _f6 = // @filename: file6.ts - // https://github.com/Microsoft/TypeScript/issues/21363 - _wrap_async_generator(function*() { + _f6 = _wrap_async_generator(function*() { let y; outer: { var _iteratorAbruptCompletion = false, _didIteratorError = false, _iteratorError; @@ -200,13 +211,16 @@ function _f6() { }); return _f6.apply(this, arguments); } +// @filename: file7.ts +// https://github.com/microsoft/TypeScript/issues/36166 +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; function f7() { return _f7.apply(this, arguments); } function _f7() { - _f7 = // @filename: file7.ts - // https://github.com/microsoft/TypeScript/issues/36166 - _wrap_async_generator(function*() { + _f7 = _wrap_async_generator(function*() { let y; for(;;){ { diff --git a/crates/swc/tests/tsc-references/emitter.forAwait_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitter.forAwait_es2015.2.minified.js index 4dcb1b16d4e0..ac8d5cdcd890 100644 --- a/crates/swc/tests/tsc-references/emitter.forAwait_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.forAwait_es2015.2.minified.js @@ -1,4 +1,18 @@ import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/emitter.forAwait_es5.1.normal.js b/crates/swc/tests/tsc-references/emitter.forAwait_es5.1.normal.js index 7590216d084f..6386660e83ea 100644 --- a/crates/swc/tests/tsc-references/emitter.forAwait_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/emitter.forAwait_es5.1.normal.js @@ -3,8 +3,6 @@ // @filename: file1.ts import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; -import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; -import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; function f1() { return _f1.apply(this, arguments); @@ -84,12 +82,15 @@ function _f1() { })); return _f1.apply(this, arguments); } +// @filename: file2.ts +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function f2() { return _f2.apply(this, arguments); } function _f2() { - _f2 = // @filename: file2.ts - _async_to_generator(regeneratorRuntime.mark(function _callee() { + _f2 = _async_to_generator(regeneratorRuntime.mark(function _callee() { var x, y, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ @@ -163,12 +164,16 @@ function _f2() { })); return _f2.apply(this, arguments); } +// @filename: file3.ts +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function f3() { return _f3.apply(this, arguments); } function _f3() { - _f3 = // @filename: file3.ts - _wrap_async_generator(regeneratorRuntime.mark(function _callee() { + _f3 = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var y, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, x; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ @@ -242,12 +247,16 @@ function _f3() { })); return _f3.apply(this, arguments); } +// @filename: file4.ts +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function f4() { return _f4.apply(this, arguments); } function _f4() { - _f4 = // @filename: file4.ts - _wrap_async_generator(regeneratorRuntime.mark(function _callee() { + _f4 = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var x, y, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ @@ -321,13 +330,16 @@ function _f4() { })); return _f4.apply(this, arguments); } +// @filename: file5.ts +// https://github.com/Microsoft/TypeScript/issues/21363 +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function f5() { return _f5.apply(this, arguments); } function _f5() { - _f5 = // @filename: file5.ts - // https://github.com/Microsoft/TypeScript/issues/21363 - _async_to_generator(regeneratorRuntime.mark(function _callee() { + _f5 = _async_to_generator(regeneratorRuntime.mark(function _callee() { var y, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, x; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ @@ -400,13 +412,17 @@ function _f5() { })); return _f5.apply(this, arguments); } +// @filename: file6.ts +// https://github.com/Microsoft/TypeScript/issues/21363 +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function f6() { return _f6.apply(this, arguments); } function _f6() { - _f6 = // @filename: file6.ts - // https://github.com/Microsoft/TypeScript/issues/21363 - _wrap_async_generator(regeneratorRuntime.mark(function _callee() { + _f6 = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var y, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, x; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ @@ -479,13 +495,17 @@ function _f6() { })); return _f6.apply(this, arguments); } +// @filename: file7.ts +// https://github.com/microsoft/TypeScript/issues/36166 +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function f7() { return _f7.apply(this, arguments); } function _f7() { - _f7 = // @filename: file7.ts - // https://github.com/microsoft/TypeScript/issues/36166 - _wrap_async_generator(regeneratorRuntime.mark(function _callee() { + _f7 = _wrap_async_generator(regeneratorRuntime.mark(function _callee() { var y, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, x; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ diff --git a/crates/swc/tests/tsc-references/emitter.forAwait_es5.2.minified.js b/crates/swc/tests/tsc-references/emitter.forAwait_es5.2.minified.js index 01badd98087f..ca2f9f6964ca 100644 --- a/crates/swc/tests/tsc-references/emitter.forAwait_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.forAwait_es5.2.minified.js @@ -1,5 +1,25 @@ import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; +import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; +import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import _async_iterator from "@swc/helpers/src/_async_iterator.mjs"; import _await_async_generator from "@swc/helpers/src/_await_async_generator.mjs"; import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; diff --git a/crates/swc/tests/tsc-references/enumTagImported_es2015.1.normal.js b/crates/swc/tests/tsc-references/enumTagImported_es2015.1.normal.js index 979f546a5ac4..4c5c7e04e02b 100644 --- a/crates/swc/tests/tsc-references/enumTagImported_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/enumTagImported_es2015.1.normal.js @@ -4,6 +4,8 @@ // @Filename: type.js /** @typedef {import("./mod1").TestEnum} TE */ /** @type {TE} */ const test = 'add'; /** @type {import("./mod1").TestEnum} */ const tost = 'remove'; +// @Filename: value.js +import { TestEnum } from "./mod1"; /** @type {TestEnum} */ const tist = TestEnum.ADD; // @Filename: mod1.js /** @enum {string} */ export const TestEnum = { diff --git a/crates/swc/tests/tsc-references/enumTagImported_es2015.2.minified.js b/crates/swc/tests/tsc-references/enumTagImported_es2015.2.minified.js index c5c27a0173eb..79ba234d5bc7 100644 --- a/crates/swc/tests/tsc-references/enumTagImported_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/enumTagImported_es2015.2.minified.js @@ -1,3 +1,4 @@ +import { TestEnum } from "./mod1"; TestEnum.ADD; export const TestEnum = { ADD: 'add', diff --git a/crates/swc/tests/tsc-references/enumTagImported_es5.1.normal.js b/crates/swc/tests/tsc-references/enumTagImported_es5.1.normal.js index 6b0735b94202..6262731f4f47 100644 --- a/crates/swc/tests/tsc-references/enumTagImported_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/enumTagImported_es5.1.normal.js @@ -4,6 +4,8 @@ // @Filename: type.js /** @typedef {import("./mod1").TestEnum} TE */ /** @type {TE} */ var test = "add"; /** @type {import("./mod1").TestEnum} */ var tost = "remove"; +// @Filename: value.js +import { TestEnum } from "./mod1"; /** @type {TestEnum} */ var tist = TestEnum.ADD; // @Filename: mod1.js /** @enum {string} */ export var TestEnum = { diff --git a/crates/swc/tests/tsc-references/enumTagImported_es5.2.minified.js b/crates/swc/tests/tsc-references/enumTagImported_es5.2.minified.js index bb63c67ad579..ac89e7e41f48 100644 --- a/crates/swc/tests/tsc-references/enumTagImported_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/enumTagImported_es5.2.minified.js @@ -1,3 +1,4 @@ +import { TestEnum } from "./mod1"; TestEnum.ADD; export var TestEnum = { ADD: "add", diff --git a/crates/swc/tests/tsc-references/errorSuperCalls_es2015.1.normal.js b/crates/swc/tests/tsc-references/errorSuperCalls_es2015.1.normal.js new file mode 100644 index 000000000000..7b1de5a1f341 --- /dev/null +++ b/crates/swc/tests/tsc-references/errorSuperCalls_es2015.1.normal.js @@ -0,0 +1,17 @@ +//! +//! x Expression expected +//! ,---- +//! 46 | super(); +//! : ^ +//! `---- +//! +//! x Parenthesized expression cannot be empty +//! ,---- +//! 46 | super(); +//! : ^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/errorSuperCalls_es2015.2.minified.js b/crates/swc/tests/tsc-references/errorSuperCalls_es2015.2.minified.js new file mode 100644 index 000000000000..7b1de5a1f341 --- /dev/null +++ b/crates/swc/tests/tsc-references/errorSuperCalls_es2015.2.minified.js @@ -0,0 +1,17 @@ +//! +//! x Expression expected +//! ,---- +//! 46 | super(); +//! : ^ +//! `---- +//! +//! x Parenthesized expression cannot be empty +//! ,---- +//! 46 | super(); +//! : ^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/errorSuperCalls_es5.1.normal.js b/crates/swc/tests/tsc-references/errorSuperCalls_es5.1.normal.js new file mode 100644 index 000000000000..7b1de5a1f341 --- /dev/null +++ b/crates/swc/tests/tsc-references/errorSuperCalls_es5.1.normal.js @@ -0,0 +1,17 @@ +//! +//! x Expression expected +//! ,---- +//! 46 | super(); +//! : ^ +//! `---- +//! +//! x Parenthesized expression cannot be empty +//! ,---- +//! 46 | super(); +//! : ^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/errorSuperCalls_es5.2.minified.js b/crates/swc/tests/tsc-references/errorSuperCalls_es5.2.minified.js new file mode 100644 index 000000000000..7b1de5a1f341 --- /dev/null +++ b/crates/swc/tests/tsc-references/errorSuperCalls_es5.2.minified.js @@ -0,0 +1,17 @@ +//! +//! x Expression expected +//! ,---- +//! 46 | super(); +//! : ^ +//! `---- +//! +//! x Parenthesized expression cannot be empty +//! ,---- +//! 46 | super(); +//! : ^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/expandoOnAlias_es2015.1.normal.js b/crates/swc/tests/tsc-references/expandoOnAlias_es2015.1.normal.js index abcef1475b8f..8845c83920af 100644 --- a/crates/swc/tests/tsc-references/expandoOnAlias_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/expandoOnAlias_es2015.1.normal.js @@ -8,6 +8,8 @@ export class Vue { export const config = { x: 0 }; +// @Filename: test.js +import { Vue, config } from "./vue"; // Expando declarations aren't allowed on aliases. Vue.config = {}; new Vue(); diff --git a/crates/swc/tests/tsc-references/expandoOnAlias_es2015.2.minified.js b/crates/swc/tests/tsc-references/expandoOnAlias_es2015.2.minified.js index 6f788f1a117c..ff28b5c0134a 100644 --- a/crates/swc/tests/tsc-references/expandoOnAlias_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/expandoOnAlias_es2015.2.minified.js @@ -3,4 +3,5 @@ export class Vue { export const config = { x: 0 }; +import { Vue, config } from "./vue"; Vue.config = {}, new Vue(), config.x = 1, config.y = {}, config.x, config.y; diff --git a/crates/swc/tests/tsc-references/expandoOnAlias_es5.1.normal.js b/crates/swc/tests/tsc-references/expandoOnAlias_es5.1.normal.js index bbc4969cc8b1..a4defdbf792d 100644 --- a/crates/swc/tests/tsc-references/expandoOnAlias_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/expandoOnAlias_es5.1.normal.js @@ -11,6 +11,8 @@ export var Vue = function Vue() { export var config = { x: 0 }; +// @Filename: test.js +import { Vue, config } from "./vue"; // Expando declarations aren't allowed on aliases. Vue.config = {}; new Vue(); diff --git a/crates/swc/tests/tsc-references/expandoOnAlias_es5.2.minified.js b/crates/swc/tests/tsc-references/expandoOnAlias_es5.2.minified.js index cb5c5065c34f..b8beebe20331 100644 --- a/crates/swc/tests/tsc-references/expandoOnAlias_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/expandoOnAlias_es5.2.minified.js @@ -6,4 +6,5 @@ export var Vue = function() { export var config = { x: 0 }; +import { Vue, config } from "./vue"; Vue.config = {}, new Vue(), config.x = 1, config.y = {}, config.x, config.y; diff --git a/crates/swc/tests/tsc-references/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands_es2015.1.normal.js b/crates/swc/tests/tsc-references/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands_es2015.1.normal.js new file mode 100644 index 000000000000..f3995e47d3d0 --- /dev/null +++ b/crates/swc/tests/tsc-references/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands_es2015.1.normal.js @@ -0,0 +1,54 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 28 | (delete --temp) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 29 | (delete ++temp) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 30 | (delete temp--) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 31 | (delete temp++) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 33 | 1 ** (delete --temp) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 34 | 1 ** (delete ++temp) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 35 | 1 ** (delete temp--) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | 1 ** (delete temp++) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands_es2015.2.minified.js b/crates/swc/tests/tsc-references/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands_es2015.2.minified.js new file mode 100644 index 000000000000..f3995e47d3d0 --- /dev/null +++ b/crates/swc/tests/tsc-references/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands_es2015.2.minified.js @@ -0,0 +1,54 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 28 | (delete --temp) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 29 | (delete ++temp) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 30 | (delete temp--) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 31 | (delete temp++) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 33 | 1 ** (delete --temp) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 34 | 1 ** (delete ++temp) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 35 | 1 ** (delete temp--) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | 1 ** (delete temp++) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands_es5.1.normal.js b/crates/swc/tests/tsc-references/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands_es5.1.normal.js new file mode 100644 index 000000000000..f3995e47d3d0 --- /dev/null +++ b/crates/swc/tests/tsc-references/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands_es5.1.normal.js @@ -0,0 +1,54 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 28 | (delete --temp) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 29 | (delete ++temp) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 30 | (delete temp--) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 31 | (delete temp++) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 33 | 1 ** (delete --temp) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 34 | 1 ** (delete ++temp) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 35 | 1 ** (delete temp--) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | 1 ** (delete temp++) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands_es5.2.minified.js b/crates/swc/tests/tsc-references/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands_es5.2.minified.js new file mode 100644 index 000000000000..f3995e47d3d0 --- /dev/null +++ b/crates/swc/tests/tsc-references/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands_es5.2.minified.js @@ -0,0 +1,54 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 28 | (delete --temp) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 29 | (delete ++temp) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 30 | (delete temp--) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 31 | (delete temp++) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 33 | 1 ** (delete --temp) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 34 | 1 ** (delete ++temp) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 35 | 1 ** (delete temp--) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 36 | 1 ** (delete temp++) ** 3; +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/exportAsNamespace1_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportAsNamespace1_es2015.2.minified.js index 29c6e995fd13..4fed2c171188 100644 --- a/crates/swc/tests/tsc-references/exportAsNamespace1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAsNamespace1_es2015.2.minified.js @@ -2,6 +2,6 @@ export const a = 1; export const b = 2; import * as _ns from './0'; ns.a, ns.b; +export { _ns as ns }; import * as foo from './1'; foo.ns.a, foo.ns.b; -export { _ns as ns }; diff --git a/crates/swc/tests/tsc-references/exportAsNamespace1_es5.2.minified.js b/crates/swc/tests/tsc-references/exportAsNamespace1_es5.2.minified.js index f911777f1b08..87848916531a 100644 --- a/crates/swc/tests/tsc-references/exportAsNamespace1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAsNamespace1_es5.2.minified.js @@ -2,6 +2,6 @@ export var a = 1; export var b = 2; import * as _ns from "./0"; ns.a, ns.b; +export { _ns as ns }; import * as foo from "./1"; foo.ns.a, foo.ns.b; -export { _ns as ns }; diff --git a/crates/swc/tests/tsc-references/exportAsNamespace2_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportAsNamespace2_es2015.2.minified.js index 29c6e995fd13..4fed2c171188 100644 --- a/crates/swc/tests/tsc-references/exportAsNamespace2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAsNamespace2_es2015.2.minified.js @@ -2,6 +2,6 @@ export const a = 1; export const b = 2; import * as _ns from './0'; ns.a, ns.b; +export { _ns as ns }; import * as foo from './1'; foo.ns.a, foo.ns.b; -export { _ns as ns }; diff --git a/crates/swc/tests/tsc-references/exportAsNamespace2_es5.2.minified.js b/crates/swc/tests/tsc-references/exportAsNamespace2_es5.2.minified.js index f911777f1b08..87848916531a 100644 --- a/crates/swc/tests/tsc-references/exportAsNamespace2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAsNamespace2_es5.2.minified.js @@ -2,6 +2,6 @@ export var a = 1; export var b = 2; import * as _ns from "./0"; ns.a, ns.b; +export { _ns as ns }; import * as foo from "./1"; foo.ns.a, foo.ns.b; -export { _ns as ns }; diff --git a/crates/swc/tests/tsc-references/exportAsNamespace3_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportAsNamespace3_es2015.2.minified.js index a62efc186b82..921cea3ce8af 100644 --- a/crates/swc/tests/tsc-references/exportAsNamespace3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAsNamespace3_es2015.2.minified.js @@ -7,6 +7,6 @@ let ns = { b: 2 }; ns.a, ns.b; +export { _ns as ns }; import * as foo from './1'; foo.ns.a, foo.ns.b; -export { _ns as ns }; diff --git a/crates/swc/tests/tsc-references/exportAsNamespace3_es5.2.minified.js b/crates/swc/tests/tsc-references/exportAsNamespace3_es5.2.minified.js index ccda31c568a4..a03b09b96067 100644 --- a/crates/swc/tests/tsc-references/exportAsNamespace3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAsNamespace3_es5.2.minified.js @@ -7,6 +7,6 @@ var ns = { b: 2 }; ns.a, ns.b; +export { _ns as ns }; import * as foo from "./1"; foo.ns.a, foo.ns.b; -export { _ns as ns }; diff --git a/crates/swc/tests/tsc-references/exportAsNamespace4_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportAsNamespace4_es2015.2.minified.js index a658445892fe..e996045dddcf 100644 --- a/crates/swc/tests/tsc-references/exportAsNamespace4_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAsNamespace4_es2015.2.minified.js @@ -1,9 +1,9 @@ export const a = 1; export const b = 2; import * as _default from './0'; +export { _default as default }; import * as ns from './0'; export default ns; import foo from './1'; import foo1 from './11'; foo.a, foo1.a, foo.b, foo1.b; -export { _default as default }; diff --git a/crates/swc/tests/tsc-references/exportAsNamespace4_es5.2.minified.js b/crates/swc/tests/tsc-references/exportAsNamespace4_es5.2.minified.js index 44992d94c1f4..5f8d3a01fea6 100644 --- a/crates/swc/tests/tsc-references/exportAsNamespace4_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAsNamespace4_es5.2.minified.js @@ -1,9 +1,9 @@ export var a = 1; export var b = 2; import * as _default from "./0"; +export { _default as default }; import * as ns from "./0"; export default ns; import foo from "./1"; import foo1 from "./11"; foo.a, foo1.a, foo.b, foo1.b; -export { _default as default }; diff --git a/crates/swc/tests/tsc-references/exportAsNamespace_exportAssignment_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportAsNamespace_exportAssignment_es2015.1.normal.js index be2f76a44ba4..37a7874ba342 100644 --- a/crates/swc/tests/tsc-references/exportAsNamespace_exportAssignment_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAsNamespace_exportAssignment_es2015.1.normal.js @@ -2,7 +2,8 @@ // @esModuleInterop: true // @noTypesAndSymbols: true // @Filename: a.ts +module.exports = {}; +export { }; // @Filename: b.ts import * as _ns from './a'; export { _ns as ns }; -module.exports = {}; diff --git a/crates/swc/tests/tsc-references/exportAsNamespace_exportAssignment_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportAsNamespace_exportAssignment_es2015.2.minified.js index 82cef12d2f5d..3e464787e54e 100644 --- a/crates/swc/tests/tsc-references/exportAsNamespace_exportAssignment_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAsNamespace_exportAssignment_es2015.2.minified.js @@ -1,3 +1,4 @@ -import * as _ns from './a'; module.exports = {}; +export { }; +import * as _ns from './a'; export { _ns as ns }; diff --git a/crates/swc/tests/tsc-references/exportAsNamespace_exportAssignment_es5.1.normal.js b/crates/swc/tests/tsc-references/exportAsNamespace_exportAssignment_es5.1.normal.js index 874878fa1303..ee7e26c0c78f 100644 --- a/crates/swc/tests/tsc-references/exportAsNamespace_exportAssignment_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAsNamespace_exportAssignment_es5.1.normal.js @@ -2,7 +2,8 @@ // @esModuleInterop: true // @noTypesAndSymbols: true // @Filename: a.ts +module.exports = {}; +export { }; // @Filename: b.ts import * as _ns from "./a"; export { _ns as ns }; -module.exports = {}; diff --git a/crates/swc/tests/tsc-references/exportAsNamespace_exportAssignment_es5.2.minified.js b/crates/swc/tests/tsc-references/exportAsNamespace_exportAssignment_es5.2.minified.js index ae955060097b..e3829e3e0136 100644 --- a/crates/swc/tests/tsc-references/exportAsNamespace_exportAssignment_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAsNamespace_exportAssignment_es5.2.minified.js @@ -1,3 +1,4 @@ -import * as _ns from "./a"; module.exports = {}; +export { }; +import * as _ns from "./a"; export { _ns as ns }; diff --git a/crates/swc/tests/tsc-references/exportAsNamespace_missingEmitHelpers_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportAsNamespace_missingEmitHelpers_es2015.1.normal.js index fa63e47ccff8..8e90af7808b3 100644 --- a/crates/swc/tests/tsc-references/exportAsNamespace_missingEmitHelpers_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAsNamespace_missingEmitHelpers_es2015.1.normal.js @@ -3,6 +3,7 @@ // @esModuleInterop: true // @noTypesAndSymbols: true // @Filename: a.ts +export { }; // @Filename: b.ts import * as _ns from './a'; // Error export { _ns as ns }; diff --git a/crates/swc/tests/tsc-references/exportAsNamespace_missingEmitHelpers_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportAsNamespace_missingEmitHelpers_es2015.2.minified.js index 07f49aa7475b..5be627cece78 100644 --- a/crates/swc/tests/tsc-references/exportAsNamespace_missingEmitHelpers_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAsNamespace_missingEmitHelpers_es2015.2.minified.js @@ -1,2 +1,3 @@ +export { }; import * as _ns from './a'; export { _ns as ns }; diff --git a/crates/swc/tests/tsc-references/exportAsNamespace_missingEmitHelpers_es5.1.normal.js b/crates/swc/tests/tsc-references/exportAsNamespace_missingEmitHelpers_es5.1.normal.js index 9ca7bedca622..17b83281a3e4 100644 --- a/crates/swc/tests/tsc-references/exportAsNamespace_missingEmitHelpers_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAsNamespace_missingEmitHelpers_es5.1.normal.js @@ -3,6 +3,7 @@ // @esModuleInterop: true // @noTypesAndSymbols: true // @Filename: a.ts +export { }; // @Filename: b.ts import * as _ns from "./a"; // Error export { _ns as ns }; diff --git a/crates/swc/tests/tsc-references/exportAsNamespace_missingEmitHelpers_es5.2.minified.js b/crates/swc/tests/tsc-references/exportAsNamespace_missingEmitHelpers_es5.2.minified.js index 19c073dfe6b7..c19403e37a27 100644 --- a/crates/swc/tests/tsc-references/exportAsNamespace_missingEmitHelpers_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAsNamespace_missingEmitHelpers_es5.2.minified.js @@ -1,2 +1,3 @@ +export { }; import * as _ns from "./a"; export { _ns as ns }; diff --git a/crates/swc/tests/tsc-references/exportAssignDottedName_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportAssignDottedName_es2015.1.normal.js index 2c8771785496..0f4044a0e288 100644 --- a/crates/swc/tests/tsc-references/exportAssignDottedName_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignDottedName_es2015.1.normal.js @@ -5,3 +5,4 @@ export function x() { // @Filename: foo2.ts const foo1 = require('./foo1'); module.exports = foo1.x; // Ok +export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignDottedName_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportAssignDottedName_es2015.2.minified.js index 941c33650ebc..67139fb389e1 100644 --- a/crates/swc/tests/tsc-references/exportAssignDottedName_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignDottedName_es2015.2.minified.js @@ -3,3 +3,4 @@ export function x() { } let foo1 = require('./foo1'); module.exports = foo1.x; +export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignDottedName_es5.1.normal.js b/crates/swc/tests/tsc-references/exportAssignDottedName_es5.1.normal.js index c9e40315577d..75cb25049ae3 100644 --- a/crates/swc/tests/tsc-references/exportAssignDottedName_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignDottedName_es5.1.normal.js @@ -5,3 +5,4 @@ export function x() { // @Filename: foo2.ts var foo1 = require("./foo1"); module.exports = foo1.x; // Ok +export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignDottedName_es5.2.minified.js b/crates/swc/tests/tsc-references/exportAssignDottedName_es5.2.minified.js index 8507048cd36f..4b1c142d8568 100644 --- a/crates/swc/tests/tsc-references/exportAssignDottedName_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignDottedName_es5.2.minified.js @@ -3,3 +3,4 @@ export function x() { } var foo1 = require("./foo1"); module.exports = foo1.x; +export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignImportedIdentifier_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportAssignImportedIdentifier_es2015.1.normal.js index bbf5c101f823..e8a12776e322 100644 --- a/crates/swc/tests/tsc-references/exportAssignImportedIdentifier_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignImportedIdentifier_es2015.1.normal.js @@ -5,7 +5,9 @@ export function x() { // @Filename: foo2.ts const foo1 = require('./foo1'); var x = foo1.x; +module.exports = x; +export { }; // @Filename: foo3.ts const foo2 = require('./foo2'); var x = foo2(); // should be boolean -module.exports = x; +export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignImportedIdentifier_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportAssignImportedIdentifier_es2015.2.minified.js index d4c71a6969ec..76a504a0755d 100644 --- a/crates/swc/tests/tsc-references/exportAssignImportedIdentifier_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignImportedIdentifier_es2015.2.minified.js @@ -3,6 +3,8 @@ export function x() { } let foo1 = require('./foo1'); var x = foo1.x; -let foo2 = require('./foo2'); -var x = foo2(); module.exports = x; +export { }; +let foo2 = require('./foo2'); +foo2(); +export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignImportedIdentifier_es5.1.normal.js b/crates/swc/tests/tsc-references/exportAssignImportedIdentifier_es5.1.normal.js index a2cb333f8fae..f0bcbec4df45 100644 --- a/crates/swc/tests/tsc-references/exportAssignImportedIdentifier_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignImportedIdentifier_es5.1.normal.js @@ -5,7 +5,9 @@ export function x() { // @Filename: foo2.ts var foo1 = require("./foo1"); var x = foo1.x; +module.exports = x; +export { }; // @Filename: foo3.ts var foo2 = require("./foo2"); var x = foo2(); // should be boolean -module.exports = x; +export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignImportedIdentifier_es5.2.minified.js b/crates/swc/tests/tsc-references/exportAssignImportedIdentifier_es5.2.minified.js index c6939fe71302..3d42b1942b97 100644 --- a/crates/swc/tests/tsc-references/exportAssignImportedIdentifier_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignImportedIdentifier_es5.2.minified.js @@ -1,5 +1,8 @@ export function x() { return !0; } -var x = (require("./foo1").x, require("./foo2")()); +var x = require("./foo1").x; module.exports = x; +export { }; +require("./foo2")(); +export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignTypes_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportAssignTypes_es2015.1.normal.js index 8106dec5f015..d3a23bdf24cd 100644 --- a/crates/swc/tests/tsc-references/exportAssignTypes_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignTypes_es2015.1.normal.js @@ -1,25 +1,39 @@ // @Filename: expString.ts var x = "test"; +module.exports = x; +export { }; // @Filename: expNumber.ts var x = 42; +module.exports = x; +export { }; // @Filename: expBoolean.ts var x = true; +module.exports = x; +export { }; // @Filename: expArray.ts var x = [ 1, 2 ]; +module.exports = x; +export { }; // @Filename: expObject.ts var x = { answer: 42, when: 1776 }; +module.exports = x; +export { }; // @Filename: expAny.ts var x; +module.exports = x; +export { }; // @Filename: expGeneric.ts function x(a) { return a; } +module.exports = x; +export { }; // @Filename: consumer.ts const iString = require('./expString'); var v1 = iString; @@ -35,5 +49,4 @@ const iAny = require('./expAny'); var v6 = iAny; const iGeneric = require('./expGeneric'); var v7 = iGeneric; -module.exports = x; export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignTypes_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportAssignTypes_es2015.2.minified.js index b608540130b7..2dbdca3d456d 100644 --- a/crates/swc/tests/tsc-references/exportAssignTypes_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignTypes_es2015.2.minified.js @@ -1,5 +1,26 @@ -require('./expString'), require('./expNumber'), require('./expBoolean'), require('./expArray'), require('./expObject'), require('./expAny'), require('./expGeneric'), module.exports = { +module.exports = "test"; +export { }; +module.exports = 42; +export { }; +module.exports = !0; +export { }; +module.exports = [ + 1, + 2 +]; +export { }; +module.exports = { answer: 42, when: 1776 }; export { }; +var x; +module.exports = x; +export { }; +function x(a) { + return a; +} +module.exports = x; +export { }; +require('./expString'), require('./expNumber'), require('./expBoolean'), require('./expArray'), require('./expObject'), require('./expAny'), require('./expGeneric'); +export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignTypes_es5.1.normal.js b/crates/swc/tests/tsc-references/exportAssignTypes_es5.1.normal.js index 47111a351793..c267e3fce817 100644 --- a/crates/swc/tests/tsc-references/exportAssignTypes_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignTypes_es5.1.normal.js @@ -1,25 +1,39 @@ // @Filename: expString.ts var x = "test"; +module.exports = x; +export { }; // @Filename: expNumber.ts var x = 42; +module.exports = x; +export { }; // @Filename: expBoolean.ts var x = true; +module.exports = x; +export { }; // @Filename: expArray.ts var x = [ 1, 2 ]; +module.exports = x; +export { }; // @Filename: expObject.ts var x = { answer: 42, when: 1776 }; +module.exports = x; +export { }; // @Filename: expAny.ts var x; +module.exports = x; +export { }; // @Filename: expGeneric.ts function x(a) { return a; } +module.exports = x; +export { }; // @Filename: consumer.ts var iString = require("./expString"); var v1 = iString; @@ -35,5 +49,4 @@ var iAny = require("./expAny"); var v6 = iAny; var iGeneric = require("./expGeneric"); var v7 = iGeneric; -module.exports = x; export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignTypes_es5.2.minified.js b/crates/swc/tests/tsc-references/exportAssignTypes_es5.2.minified.js index d66d2cb9ce52..e31bea161002 100644 --- a/crates/swc/tests/tsc-references/exportAssignTypes_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignTypes_es5.2.minified.js @@ -1,5 +1,26 @@ -require("./expString"), require("./expNumber"), require("./expBoolean"), require("./expArray"), require("./expObject"), require("./expAny"), require("./expGeneric"), module.exports = { +module.exports = "test"; +export { }; +module.exports = 42; +export { }; +module.exports = !0; +export { }; +module.exports = [ + 1, + 2 +]; +export { }; +module.exports = { answer: 42, when: 1776 }; export { }; +var x; +module.exports = x; +export { }; +function x(a) { + return a; +} +module.exports = x; +export { }; +require("./expString"), require("./expNumber"), require("./expBoolean"), require("./expArray"), require("./expObject"), require("./expAny"), require("./expGeneric"); +export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentCircularModules_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportAssignmentCircularModules_es2015.1.normal.js index b7f6c9f7412e..d9e5a69b729e 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentCircularModules_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignmentCircularModules_es2015.1.normal.js @@ -5,13 +5,19 @@ var Foo; (function(Foo) { var x = Foo.x = foo1.x; })(Foo || (Foo = {})); +module.exports = Foo; +export { }; // @Filename: foo_1.ts const foo2 = require("./foo_2"); +var Foo; (function(Foo) { var x = Foo.x = foo2.x; })(Foo || (Foo = {})); +module.exports = Foo; +export { }; // @Filename: foo_2.ts const foo0 = require("./foo_0"); +var Foo; (function(Foo) { var x = Foo.x = foo0.x; })(Foo || (Foo = {})); diff --git a/crates/swc/tests/tsc-references/exportAssignmentCircularModules_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentCircularModules_es2015.2.minified.js index 22f198bdb79d..06f7f07d90d2 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentCircularModules_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentCircularModules_es2015.2.minified.js @@ -1,8 +1,12 @@ var Foo; let foo1 = require('./foo_1'); -(Foo || (Foo = {})).x = foo1.x; +(Foo || (Foo = {})).x = foo1.x, module.exports = Foo; +export { }; +var Foo; let foo2 = require("./foo_2"); -(Foo || (Foo = {})).x = foo2.x; +(Foo || (Foo = {})).x = foo2.x, module.exports = Foo; +export { }; +var Foo; let foo0 = require("./foo_0"); (Foo || (Foo = {})).x = foo0.x, module.exports = Foo; export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentCircularModules_es5.1.normal.js b/crates/swc/tests/tsc-references/exportAssignmentCircularModules_es5.1.normal.js index 68280dd57eef..2e7f619ed7a9 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentCircularModules_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignmentCircularModules_es5.1.normal.js @@ -5,13 +5,19 @@ var Foo; (function(Foo) { var x = Foo.x = foo1.x; })(Foo || (Foo = {})); +module.exports = Foo; +export { }; // @Filename: foo_1.ts var foo2 = require("./foo_2"); +var Foo; (function(Foo) { var x = Foo.x = foo2.x; })(Foo || (Foo = {})); +module.exports = Foo; +export { }; // @Filename: foo_2.ts var foo0 = require("./foo_0"); +var Foo; (function(Foo) { var x = Foo.x = foo0.x; })(Foo || (Foo = {})); diff --git a/crates/swc/tests/tsc-references/exportAssignmentCircularModules_es5.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentCircularModules_es5.2.minified.js index 936420eb18e9..beeb30a712f4 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentCircularModules_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentCircularModules_es5.2.minified.js @@ -1,7 +1,9 @@ var Foo, foo1 = require("./foo_1"); -(Foo || (Foo = {})).x = foo1.x; -var foo2 = require("./foo_2"); -(Foo || (Foo = {})).x = foo2.x; -var foo0 = require("./foo_0"); +(Foo || (Foo = {})).x = foo1.x, module.exports = Foo; +export { }; +var Foo, foo2 = require("./foo_2"); +(Foo || (Foo = {})).x = foo2.x, module.exports = Foo; +export { }; +var Foo, foo0 = require("./foo_0"); (Foo || (Foo = {})).x = foo0.x, module.exports = Foo; export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentConstrainedGenericType_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportAssignmentConstrainedGenericType_es2015.1.normal.js index 2bfce17bfa89..da10849bfd97 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentConstrainedGenericType_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignmentConstrainedGenericType_es2015.1.normal.js @@ -3,6 +3,8 @@ class Foo { constructor(x){} } +module.exports = Foo; +export { }; // @Filename: foo_1.ts const foo = require("./foo_0"); var x = new foo(true); // Should error @@ -11,5 +13,4 @@ var y = new foo({ b: 42 }); // Should be OK var z = y.test.b; -module.exports = Foo; export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentConstrainedGenericType_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentConstrainedGenericType_es2015.2.minified.js index 64fe6b1a5819..84ed0c52bf02 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentConstrainedGenericType_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentConstrainedGenericType_es2015.2.minified.js @@ -1,8 +1,10 @@ +module.exports = class { + constructor(x){} +}; +export { }; let foo = require("./foo_0"); new foo(!0), new foo({ a: "test", b: 42 -}).test.b, module.exports = class { - constructor(x){} -}; +}).test.b; export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentConstrainedGenericType_es5.1.normal.js b/crates/swc/tests/tsc-references/exportAssignmentConstrainedGenericType_es5.1.normal.js index 63bc3b397c6e..121aa62bd49f 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentConstrainedGenericType_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignmentConstrainedGenericType_es5.1.normal.js @@ -5,6 +5,8 @@ var Foo = function Foo(x) { "use strict"; _class_call_check(this, Foo); }; +module.exports = Foo; +export { }; // @Filename: foo_1.ts var foo = require("./foo_0"); var x = new foo(true); // Should error @@ -13,5 +15,4 @@ var y = new foo({ b: 42 }); // Should be OK var z = y.test.b; -module.exports = Foo; export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentConstrainedGenericType_es5.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentConstrainedGenericType_es5.2.minified.js index 2d8f93d20160..105f26058f15 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentConstrainedGenericType_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentConstrainedGenericType_es5.2.minified.js @@ -2,8 +2,11 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var Foo = function(x) { "use strict"; _class_call_check(this, Foo); -}, foo = require("./foo_0"); +}; +module.exports = Foo; +var foo = require("./foo_0"); new foo(!0), new foo({ a: "test", b: 42 -}).test.b, module.exports = Foo; +}).test.b; +export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentGenericType_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportAssignmentGenericType_es2015.1.normal.js index b7b0b3df2dd6..2eceea6009c2 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentGenericType_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignmentGenericType_es2015.1.normal.js @@ -2,9 +2,10 @@ // @Filename: foo_0.ts class Foo { } +module.exports = Foo; +export { }; // @Filename: foo_1.ts const foo = require("./foo_0"); var x = new foo(); var y = x.test; -module.exports = Foo; export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentGenericType_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentGenericType_es2015.2.minified.js index 2bf376689a5b..8886c14f4a47 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentGenericType_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentGenericType_es2015.2.minified.js @@ -1,4 +1,6 @@ -let foo = require("./foo_0"); -new foo().test, module.exports = class { +module.exports = class { }; export { }; +let foo = require("./foo_0"); +new foo().test; +export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentGenericType_es5.1.normal.js b/crates/swc/tests/tsc-references/exportAssignmentGenericType_es5.1.normal.js index 02063539246a..827fc0b7dd83 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentGenericType_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignmentGenericType_es5.1.normal.js @@ -5,9 +5,10 @@ var Foo = function Foo() { "use strict"; _class_call_check(this, Foo); }; +module.exports = Foo; +export { }; // @Filename: foo_1.ts var foo = require("./foo_0"); var x = new foo(); var y = x.test; -module.exports = Foo; export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentGenericType_es5.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentGenericType_es5.2.minified.js index 296c9b4690f2..5201cf157db3 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentGenericType_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentGenericType_es5.2.minified.js @@ -3,4 +3,6 @@ var Foo = function() { "use strict"; _class_call_check(this, Foo); }; -new (require("./foo_0"))().test, module.exports = Foo; +module.exports = Foo; +new (require("./foo_0"))().test; +export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentMergedInterface_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportAssignmentMergedInterface_es2015.1.normal.js index 51f1038e342a..b4c6624d1028 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentMergedInterface_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignmentMergedInterface_es2015.1.normal.js @@ -1,5 +1,7 @@ // @module: amd // @Filename: foo_0.ts +module.exports = Foo; +export { }; // @Filename: foo_1.ts const foo = require("./foo_0"); var x; @@ -12,5 +14,4 @@ var z = { y: 2 }; z = x.d; -module.exports = Foo; export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentMergedInterface_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentMergedInterface_es2015.2.minified.js index c706583cf521..f7d671aadbe8 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentMergedInterface_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentMergedInterface_es2015.2.minified.js @@ -1,3 +1,5 @@ +module.exports = Foo; +export { }; var x; -require("./foo_0"), x("test"), x(42), x.b, x.c, x.d, module.exports = Foo; +require("./foo_0"), x("test"), x(42), x.b, x.c, x.d; export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentMergedInterface_es5.1.normal.js b/crates/swc/tests/tsc-references/exportAssignmentMergedInterface_es5.1.normal.js index 685284c17520..6ea47d6de0cd 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentMergedInterface_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignmentMergedInterface_es5.1.normal.js @@ -1,5 +1,7 @@ // @module: amd // @Filename: foo_0.ts +module.exports = Foo; +export { }; // @Filename: foo_1.ts var foo = require("./foo_0"); var x; @@ -12,5 +14,4 @@ var z = { y: 2 }; z = x.d; -module.exports = Foo; export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentMergedInterface_es5.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentMergedInterface_es5.2.minified.js index c706583cf521..f7d671aadbe8 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentMergedInterface_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentMergedInterface_es5.2.minified.js @@ -1,3 +1,5 @@ +module.exports = Foo; +export { }; var x; -require("./foo_0"), x("test"), x(42), x.b, x.c, x.d, module.exports = Foo; +require("./foo_0"), x("test"), x(42), x.b, x.c, x.d; export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentMergedModule_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportAssignmentMergedModule_es2015.1.normal.js index 25d4ff11fc02..1548aad5f3bf 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentMergedModule_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignmentMergedModule_es2015.1.normal.js @@ -18,11 +18,12 @@ var Foo; var answer = Test.answer = 42; })(Test = Foo.Test || (Foo.Test = {})); })(Foo || (Foo = {})); +module.exports = Foo; +export { }; // @Filename: foo_1.ts const foo = require("./foo_0"); var a = foo.a(); if (!!foo.b) { foo.Test.answer = foo.c(42); } -module.exports = Foo; export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentMergedModule_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentMergedModule_es2015.2.minified.js index db6e88b3e08c..df3e5878776d 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentMergedModule_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentMergedModule_es2015.2.minified.js @@ -9,7 +9,8 @@ var Foo; return a; } Foo.c = c, (Foo.Test || (Foo.Test = {})).answer = 42; -}(Foo || (Foo = {})); +}(Foo || (Foo = {})), module.exports = Foo; +export { }; let foo = require("./foo_0"); -foo.a(), foo.b && (foo.Test.answer = foo.c(42)), module.exports = Foo; +foo.a(), foo.b && (foo.Test.answer = foo.c(42)); export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentMergedModule_es5.1.normal.js b/crates/swc/tests/tsc-references/exportAssignmentMergedModule_es5.1.normal.js index ba0142d1a1c7..e6ac5feb173e 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentMergedModule_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignmentMergedModule_es5.1.normal.js @@ -18,11 +18,12 @@ var Foo; var answer = Test.answer = 42; })(Test = Foo.Test || (Foo.Test = {})); })(Foo || (Foo = {})); +module.exports = Foo; +export { }; // @Filename: foo_1.ts var foo = require("./foo_0"); var a = foo.a(); if (!!foo.b) { foo.Test.answer = foo.c(42); } -module.exports = Foo; export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentMergedModule_es5.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentMergedModule_es5.2.minified.js index ca67b24d5cb4..40b291fe9c6c 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentMergedModule_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentMergedModule_es5.2.minified.js @@ -1,3 +1,4 @@ +var Foo; !function(Foo) { var a = function() { return 5; @@ -8,7 +9,8 @@ return a; }; Foo.c = c, (Foo.Test || (Foo.Test = {})).answer = 42; -}(Foo || (Foo = {})); -var Foo, foo = require("./foo_0"); -foo.a(), foo.b && (foo.Test.answer = foo.c(42)), module.exports = Foo; +}(Foo || (Foo = {})), module.exports = Foo; +export { }; +var foo = require("./foo_0"); +foo.a(), foo.b && (foo.Test.answer = foo.c(42)); export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentOfExportNamespaceWithDefault_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportAssignmentOfExportNamespaceWithDefault_es2015.1.normal.js index a084df570a34..57b07db168e2 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentOfExportNamespaceWithDefault_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignmentOfExportNamespaceWithDefault_es2015.1.normal.js @@ -5,3 +5,24 @@ // https://github.com/microsoft/TypeScript/issues/39149 import a from "a"; a(); +// @filename: external.d.ts +//! +//! x the name `default` is exported multiple times +//! ,-[6:9] +//! 6 | export { _a as default }; +//! : ^^^|^^^ +//! : `-- previous exported here +//! 7 | } +//! 8 | export default a; +//! : ^^^^^^^^|^^^^^^^^ +//! : `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique +//! +//! x An export assignment cannot be used in a module with other exported elements. +//! ,---- +//! 13 | export = a; +//! : ^^^^^^^^^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/exportAssignmentOfExportNamespaceWithDefault_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentOfExportNamespaceWithDefault_es2015.2.minified.js index 72798234eb26..654e2b48b88a 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentOfExportNamespaceWithDefault_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentOfExportNamespaceWithDefault_es2015.2.minified.js @@ -1,2 +1,23 @@ import a from "a"; a(); +// @filename: external.d.ts +//! +//! x the name `default` is exported multiple times +//! ,-[6:9] +//! 6 | export { _a as default }; +//! : ^^^|^^^ +//! : `-- previous exported here +//! 7 | } +//! 8 | export default a; +//! : ^^^^^^^^|^^^^^^^^ +//! : `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique +//! +//! x An export assignment cannot be used in a module with other exported elements. +//! ,---- +//! 13 | export = a; +//! : ^^^^^^^^^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/exportAssignmentOfExportNamespaceWithDefault_es5.1.normal.js b/crates/swc/tests/tsc-references/exportAssignmentOfExportNamespaceWithDefault_es5.1.normal.js index a084df570a34..57b07db168e2 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentOfExportNamespaceWithDefault_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignmentOfExportNamespaceWithDefault_es5.1.normal.js @@ -5,3 +5,24 @@ // https://github.com/microsoft/TypeScript/issues/39149 import a from "a"; a(); +// @filename: external.d.ts +//! +//! x the name `default` is exported multiple times +//! ,-[6:9] +//! 6 | export { _a as default }; +//! : ^^^|^^^ +//! : `-- previous exported here +//! 7 | } +//! 8 | export default a; +//! : ^^^^^^^^|^^^^^^^^ +//! : `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique +//! +//! x An export assignment cannot be used in a module with other exported elements. +//! ,---- +//! 13 | export = a; +//! : ^^^^^^^^^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/exportAssignmentOfExportNamespaceWithDefault_es5.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentOfExportNamespaceWithDefault_es5.2.minified.js index 72798234eb26..654e2b48b88a 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentOfExportNamespaceWithDefault_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentOfExportNamespaceWithDefault_es5.2.minified.js @@ -1,2 +1,23 @@ import a from "a"; a(); +// @filename: external.d.ts +//! +//! x the name `default` is exported multiple times +//! ,-[6:9] +//! 6 | export { _a as default }; +//! : ^^^|^^^ +//! : `-- previous exported here +//! 7 | } +//! 8 | export default a; +//! : ^^^^^^^^|^^^^^^^^ +//! : `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique +//! +//! x An export assignment cannot be used in a module with other exported elements. +//! ,---- +//! 13 | export = a; +//! : ^^^^^^^^^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/exportAssignmentTopLevelClodule_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportAssignmentTopLevelClodule_es2015.1.normal.js index 6b596b2e581b..dd14074f4baa 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentTopLevelClodule_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignmentTopLevelClodule_es2015.1.normal.js @@ -8,10 +8,11 @@ class Foo { (function(Foo) { var answer = Foo.answer = 42; })(Foo || (Foo = {})); +module.exports = Foo; +export { }; // @Filename: foo_1.ts const foo = require("./foo_0"); if (foo.answer === 42) { var x = new foo(); } -module.exports = Foo; export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentTopLevelClodule_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentTopLevelClodule_es2015.2.minified.js index 97254baed801..63dee572a590 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentTopLevelClodule_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentTopLevelClodule_es2015.2.minified.js @@ -3,7 +3,8 @@ class Foo { this.test = "test"; } } -(Foo || (Foo = {})).answer = 42; +(Foo || (Foo = {})).answer = 42, module.exports = Foo; +export { }; let foo = require("./foo_0"); -42 === foo.answer && new foo(), module.exports = Foo; +42 === foo.answer && new foo(); export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentTopLevelClodule_es5.1.normal.js b/crates/swc/tests/tsc-references/exportAssignmentTopLevelClodule_es5.1.normal.js index 33d2fbd67aeb..403ec06fa9fd 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentTopLevelClodule_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignmentTopLevelClodule_es5.1.normal.js @@ -9,10 +9,11 @@ var Foo = function Foo() { (function(Foo) { var answer = Foo.answer = 42; })(Foo || (Foo = {})); +module.exports = Foo; +export { }; // @Filename: foo_1.ts var foo = require("./foo_0"); if (foo.answer === 42) { var x = new foo(); } -module.exports = Foo; export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentTopLevelClodule_es5.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentTopLevelClodule_es5.2.minified.js index 4e16cd376446..8c8950b58fe4 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentTopLevelClodule_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentTopLevelClodule_es5.2.minified.js @@ -3,6 +3,7 @@ var Foo = function() { "use strict"; _class_call_check(this, Foo), this.test = "test"; }; -(Foo || (Foo = {})).answer = 42; +(Foo || (Foo = {})).answer = 42, module.exports = Foo; var foo = require("./foo_0"); -42 === foo.answer && new foo(), module.exports = Foo; +42 === foo.answer && new foo(); +export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentTopLevelEnumdule_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportAssignmentTopLevelEnumdule_es2015.1.normal.js index 22a026a324fa..e3f3c9b69369 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentTopLevelEnumdule_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignmentTopLevelEnumdule_es2015.1.normal.js @@ -9,11 +9,12 @@ var foo; (function(foo) { var answer = foo.answer = 42; })(foo || (foo = {})); +module.exports = foo; +export { }; // @Filename: foo_1.ts const foo = require("./foo_0"); var color; if (color === foo.green) { color = foo.answer; } -module.exports = foo; export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentTopLevelEnumdule_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentTopLevelEnumdule_es2015.2.minified.js index 3a40d38dcaba..f29b17c3135d 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentTopLevelEnumdule_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentTopLevelEnumdule_es2015.2.minified.js @@ -1,7 +1,9 @@ -var foo, color; +var foo; !function(foo) { foo[foo.red = 0] = "red", foo[foo.green = 1] = "green", foo[foo.blue = 2] = "blue"; -}(foo || (foo = {})), (foo || (foo = {})).answer = 42; +}(foo || (foo = {})), (foo || (foo = {})).answer = 42, module.exports = foo; +export { }; +var color; let foo = require("./foo_0"); -color === foo.green && (color = foo.answer), module.exports = foo; +color === foo.green && (color = foo.answer); export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentTopLevelEnumdule_es5.1.normal.js b/crates/swc/tests/tsc-references/exportAssignmentTopLevelEnumdule_es5.1.normal.js index 5bd7de69866e..e9130b5e3361 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentTopLevelEnumdule_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignmentTopLevelEnumdule_es5.1.normal.js @@ -9,11 +9,12 @@ var foo; (function(foo) { var answer = foo.answer = 42; })(foo || (foo = {})); +module.exports = foo; +export { }; // @Filename: foo_1.ts var foo = require("./foo_0"); var color; if (color === foo.green) { color = foo.answer; } -module.exports = foo; export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentTopLevelEnumdule_es5.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentTopLevelEnumdule_es5.2.minified.js index 3078df314330..82aec17058eb 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentTopLevelEnumdule_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentTopLevelEnumdule_es5.2.minified.js @@ -1,6 +1,8 @@ +var foo; !function(foo) { foo[foo.red = 0] = "red", foo[foo.green = 1] = "green", foo[foo.blue = 2] = "blue"; -}(foo || (foo = {})), (foo || (foo = {})).answer = 42; +}(foo || (foo = {})), (foo || (foo = {})).answer = 42, module.exports = foo; +export { }; var color, foo = require("./foo_0"); -color === foo.green && (color = foo.answer), module.exports = foo; +color === foo.green && (color = foo.answer); export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentTopLevelFundule_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportAssignmentTopLevelFundule_es2015.1.normal.js index 463dc36fcfcc..ca562a155f46 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentTopLevelFundule_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignmentTopLevelFundule_es2015.1.normal.js @@ -6,10 +6,11 @@ function foo() { (function(foo) { var answer = foo.answer = 42; })(foo || (foo = {})); +module.exports = foo; +export { }; // @Filename: foo_1.ts const foo = require("./foo_0"); if (foo.answer === 42) { var x = foo(); } -module.exports = foo; export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentTopLevelFundule_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentTopLevelFundule_es2015.2.minified.js index 441cb059e13c..4c6d3bf6da05 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentTopLevelFundule_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentTopLevelFundule_es2015.2.minified.js @@ -1,7 +1,8 @@ function foo() { return "test"; } -(foo || (foo = {})).answer = 42; +(foo || (foo = {})).answer = 42, module.exports = foo; +export { }; let foo = require("./foo_0"); -42 === foo.answer && foo(), module.exports = foo; +42 === foo.answer && foo(); export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentTopLevelFundule_es5.1.normal.js b/crates/swc/tests/tsc-references/exportAssignmentTopLevelFundule_es5.1.normal.js index e213830b6ef4..f921292626e7 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentTopLevelFundule_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignmentTopLevelFundule_es5.1.normal.js @@ -6,10 +6,11 @@ function foo() { (function(foo) { var answer = foo.answer = 42; })(foo || (foo = {})); +module.exports = foo; +export { }; // @Filename: foo_1.ts var foo = require("./foo_0"); if (foo.answer === 42) { var x = foo(); } -module.exports = foo; export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentTopLevelFundule_es5.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentTopLevelFundule_es5.2.minified.js index 3c86d8278188..a39ad3b2389f 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentTopLevelFundule_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentTopLevelFundule_es5.2.minified.js @@ -1,7 +1,8 @@ function foo() { return "test"; } -(foo || (foo = {})).answer = 42; +(foo || (foo = {})).answer = 42, module.exports = foo; +export { }; var foo = require("./foo_0"); -42 === foo.answer && foo(), module.exports = foo; +42 === foo.answer && foo(); export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentTopLevelIdentifier_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportAssignmentTopLevelIdentifier_es2015.1.normal.js index c0ce9698d6d8..52709386f86c 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentTopLevelIdentifier_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignmentTopLevelIdentifier_es2015.1.normal.js @@ -4,8 +4,9 @@ var Foo; (function(Foo) { var answer = Foo.answer = 42; })(Foo || (Foo = {})); +module.exports = Foo; +export { }; // @Filename: foo_1.ts const foo = require("./foo_0"); if (foo.answer === 42) {} -module.exports = Foo; export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentTopLevelIdentifier_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentTopLevelIdentifier_es2015.2.minified.js index 0a1aa9d9da18..591a06332174 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentTopLevelIdentifier_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentTopLevelIdentifier_es2015.2.minified.js @@ -1,5 +1,6 @@ var Foo; -(Foo || (Foo = {})).answer = 42; +(Foo || (Foo = {})).answer = 42, module.exports = Foo; +export { }; let foo = require("./foo_0"); -foo.answer, module.exports = Foo; +foo.answer; export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentTopLevelIdentifier_es5.1.normal.js b/crates/swc/tests/tsc-references/exportAssignmentTopLevelIdentifier_es5.1.normal.js index 16f07a6fab30..c7bc118388a7 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentTopLevelIdentifier_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportAssignmentTopLevelIdentifier_es5.1.normal.js @@ -4,8 +4,9 @@ var Foo; (function(Foo) { var answer = Foo.answer = 42; })(Foo || (Foo = {})); +module.exports = Foo; +export { }; // @Filename: foo_1.ts var foo = require("./foo_0"); if (foo.answer === 42) {} -module.exports = Foo; export { }; diff --git a/crates/swc/tests/tsc-references/exportAssignmentTopLevelIdentifier_es5.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentTopLevelIdentifier_es5.2.minified.js index 263e4e333297..92b14e4a119b 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentTopLevelIdentifier_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentTopLevelIdentifier_es5.2.minified.js @@ -1,3 +1,5 @@ var Foo; -(Foo || (Foo = {})).answer = 42, require("./foo_0").answer, module.exports = Foo; +(Foo || (Foo = {})).answer = 42, module.exports = Foo; +export { }; +require("./foo_0").answer; export { }; diff --git a/crates/swc/tests/tsc-references/exportBinding_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportBinding_es2015.2.minified.js index 9c69a1606215..95ff294ddedf 100644 --- a/crates/swc/tests/tsc-references/exportBinding_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportBinding_es2015.2.minified.js @@ -2,6 +2,7 @@ export default x; let x = 'x'; class Y { } +export { x, x as xx, Y as Z }; export default y; var y = 'y'; -export { x, x as xx, Y as Z, y, y as yy }; +export { y, y as yy }; diff --git a/crates/swc/tests/tsc-references/exportBinding_es5.2.minified.js b/crates/swc/tests/tsc-references/exportBinding_es5.2.minified.js index 6135683fe263..704c5fe42125 100644 --- a/crates/swc/tests/tsc-references/exportBinding_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportBinding_es5.2.minified.js @@ -5,6 +5,7 @@ var Y = function Y() { "use strict"; _class_call_check(this, Y); }; +export { x, x as xx, Y as Z }; export default y; var y = "y"; -export { x, x as xx, Y as Z, y, y as yy }; +export { y, y as yy }; diff --git a/crates/swc/tests/tsc-references/exportDeclaration_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportDeclaration_es2015.1.normal.js index 90e7536689af..290a81f48727 100644 --- a/crates/swc/tests/tsc-references/exportDeclaration_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportDeclaration_es2015.1.normal.js @@ -1,5 +1,7 @@ // @Filename: /a.ts class A { } -new A(); export { }; +// @Filename: /b.ts +import { A } from './a'; +new A(); diff --git a/crates/swc/tests/tsc-references/exportDeclaration_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportDeclaration_es2015.2.minified.js index 48e8fdd370be..8c40467167d3 100644 --- a/crates/swc/tests/tsc-references/exportDeclaration_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportDeclaration_es2015.2.minified.js @@ -1,3 +1,3 @@ -new class { -}(); export { }; +import { A } from './a'; +new A(); diff --git a/crates/swc/tests/tsc-references/exportDeclaration_es5.1.normal.js b/crates/swc/tests/tsc-references/exportDeclaration_es5.1.normal.js index 417b7d3bdcc7..ff4643c40be6 100644 --- a/crates/swc/tests/tsc-references/exportDeclaration_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportDeclaration_es5.1.normal.js @@ -4,5 +4,7 @@ var A = function A() { "use strict"; _class_call_check(this, A); }; -new A(); export { }; +// @Filename: /b.ts +import { A } from "./a"; +new A(); diff --git a/crates/swc/tests/tsc-references/exportDeclaration_es5.2.minified.js b/crates/swc/tests/tsc-references/exportDeclaration_es5.2.minified.js index 089801082da4..c31013c7035f 100644 --- a/crates/swc/tests/tsc-references/exportDeclaration_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportDeclaration_es5.2.minified.js @@ -3,4 +3,5 @@ var A = function() { "use strict"; _class_call_check(this, A); }; +import { A } from "./a"; new A(); diff --git a/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier-isolatedModules_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier-isolatedModules_es2015.1.normal.js index 23898348954d..fb58a53816fc 100644 --- a/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier-isolatedModules_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier-isolatedModules_es2015.1.normal.js @@ -1,3 +1,5 @@ // @isolatedModules: true // @Filename: /a.ts +export { }; +// @Filename: /b.ts export { }; // should not error, but would without `type` diff --git a/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier-isolatedModules_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier-isolatedModules_es2015.2.minified.js index 2234b9cae16d..98fdd3114198 100644 --- a/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier-isolatedModules_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier-isolatedModules_es2015.2.minified.js @@ -1 +1,2 @@ export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier-isolatedModules_es5.1.normal.js b/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier-isolatedModules_es5.1.normal.js index 23898348954d..fb58a53816fc 100644 --- a/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier-isolatedModules_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier-isolatedModules_es5.1.normal.js @@ -1,3 +1,5 @@ // @isolatedModules: true // @Filename: /a.ts +export { }; +// @Filename: /b.ts export { }; // should not error, but would without `type` diff --git a/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier-isolatedModules_es5.2.minified.js b/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier-isolatedModules_es5.2.minified.js index 2234b9cae16d..98fdd3114198 100644 --- a/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier-isolatedModules_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier-isolatedModules_es5.2.minified.js @@ -1 +1,2 @@ export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier_es2015.1.normal.js index e8c8d5cf6c88..352cca445ecb 100644 --- a/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier_es2015.1.normal.js @@ -1,4 +1,8 @@ // @Filename: /a.ts export class A { } +// @Filename: /b.ts +export { }; +// @Filename: /c.ts +import { A } from './b'; new A(); diff --git a/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier_es2015.2.minified.js index add4e8ffa998..cc98b46a10e7 100644 --- a/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier_es2015.2.minified.js @@ -1,3 +1,5 @@ export class A { } +export { }; +import { A } from './b'; new A(); diff --git a/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier_es5.1.normal.js b/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier_es5.1.normal.js index d12665f13076..c98dd77399e4 100644 --- a/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier_es5.1.normal.js @@ -4,4 +4,8 @@ export var A = function A() { "use strict"; _class_call_check(this, A); }; +// @Filename: /b.ts +export { }; +// @Filename: /c.ts +import { A } from "./b"; new A(); diff --git a/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier_es5.2.minified.js b/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier_es5.2.minified.js index 241122599ec8..3a0e45bb5936 100644 --- a/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportDeclaration_moduleSpecifier_es5.2.minified.js @@ -3,4 +3,6 @@ export var A = function() { "use strict"; _class_call_check(this, A); }; +export { }; +import { A } from "./b"; new A(); diff --git a/crates/swc/tests/tsc-references/exportDeclaration_value_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportDeclaration_value_es2015.1.normal.js index 29a5380172c5..d174855cdec1 100644 --- a/crates/swc/tests/tsc-references/exportDeclaration_value_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportDeclaration_value_es2015.1.normal.js @@ -1,3 +1,5 @@ // @Filename: /a.ts const A = {}; export const AA = {}; +// @Filename: /b.ts +export { }; diff --git a/crates/swc/tests/tsc-references/exportDeclaration_value_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportDeclaration_value_es2015.2.minified.js index daf97fc3901e..5b34d40434bd 100644 --- a/crates/swc/tests/tsc-references/exportDeclaration_value_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportDeclaration_value_es2015.2.minified.js @@ -1 +1,2 @@ export const AA = {}; +export { }; diff --git a/crates/swc/tests/tsc-references/exportDeclaration_value_es5.1.normal.js b/crates/swc/tests/tsc-references/exportDeclaration_value_es5.1.normal.js index 6868bb6a8e19..a107b7313099 100644 --- a/crates/swc/tests/tsc-references/exportDeclaration_value_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportDeclaration_value_es5.1.normal.js @@ -1,3 +1,5 @@ // @Filename: /a.ts var A = {}; export var AA = {}; +// @Filename: /b.ts +export { }; diff --git a/crates/swc/tests/tsc-references/exportDeclaration_value_es5.2.minified.js b/crates/swc/tests/tsc-references/exportDeclaration_value_es5.2.minified.js index 64cf88bfa566..59f66d6afcf2 100644 --- a/crates/swc/tests/tsc-references/exportDeclaration_value_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportDeclaration_value_es5.2.minified.js @@ -1 +1,2 @@ export var AA = {}; +export { }; diff --git a/crates/swc/tests/tsc-references/exportDeclaredModule_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportDeclaredModule_es2015.1.normal.js index 443da21776e2..64576873d876 100644 --- a/crates/swc/tests/tsc-references/exportDeclaredModule_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportDeclaredModule_es2015.1.normal.js @@ -1,6 +1,7 @@ // @Filename: foo1.ts +module.exports = M1; +export { }; // @Filename: foo2.ts const foo1 = require('./foo1'); var x = foo1.b(); -module.exports = M1; export { }; diff --git a/crates/swc/tests/tsc-references/exportDeclaredModule_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportDeclaredModule_es2015.2.minified.js index bf762b3311d5..d4d8d97758fd 100644 --- a/crates/swc/tests/tsc-references/exportDeclaredModule_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportDeclaredModule_es2015.2.minified.js @@ -1,3 +1,5 @@ +module.exports = M1; +export { }; let foo1 = require('./foo1'); -foo1.b(), module.exports = M1; +foo1.b(); export { }; diff --git a/crates/swc/tests/tsc-references/exportDeclaredModule_es5.1.normal.js b/crates/swc/tests/tsc-references/exportDeclaredModule_es5.1.normal.js index 02b61d53664d..2a1ebe0fa532 100644 --- a/crates/swc/tests/tsc-references/exportDeclaredModule_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportDeclaredModule_es5.1.normal.js @@ -1,6 +1,7 @@ // @Filename: foo1.ts +module.exports = M1; +export { }; // @Filename: foo2.ts var foo1 = require("./foo1"); var x = foo1.b(); -module.exports = M1; export { }; diff --git a/crates/swc/tests/tsc-references/exportDeclaredModule_es5.2.minified.js b/crates/swc/tests/tsc-references/exportDeclaredModule_es5.2.minified.js index 44d7e3d631c0..26e7c8483c9b 100644 --- a/crates/swc/tests/tsc-references/exportDeclaredModule_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportDeclaredModule_es5.2.minified.js @@ -1,2 +1,4 @@ -require("./foo1").b(), module.exports = M1; +module.exports = M1; +export { }; +require("./foo1").b(); export { }; diff --git a/crates/swc/tests/tsc-references/exportNamespace1_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportNamespace1_es2015.1.normal.js index 533a56a7b3b0..b5bc93fc5f48 100644 --- a/crates/swc/tests/tsc-references/exportNamespace1_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportNamespace1_es2015.1.normal.js @@ -1,6 +1,10 @@ // @Filename: a.ts export class A { } +// @Filename: b.ts +export { }; // @Filename: c.ts export * from './b'; +// @Filename: d.ts +import { A } from './c'; new A(); // Error diff --git a/crates/swc/tests/tsc-references/exportNamespace1_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportNamespace1_es2015.2.minified.js index 758434a3d14f..082e5a5c6eba 100644 --- a/crates/swc/tests/tsc-references/exportNamespace1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportNamespace1_es2015.2.minified.js @@ -1,4 +1,6 @@ export class A { } +export { }; export * from './b'; +import { A } from './c'; new A(); diff --git a/crates/swc/tests/tsc-references/exportNamespace1_es5.1.normal.js b/crates/swc/tests/tsc-references/exportNamespace1_es5.1.normal.js index 1ede7447e213..a107938da162 100644 --- a/crates/swc/tests/tsc-references/exportNamespace1_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportNamespace1_es5.1.normal.js @@ -4,6 +4,10 @@ export var A = function A() { "use strict"; _class_call_check(this, A); }; +// @Filename: b.ts +export { }; // @Filename: c.ts export * from "./b"; +// @Filename: d.ts +import { A } from "./c"; new A(); // Error diff --git a/crates/swc/tests/tsc-references/exportNamespace1_es5.2.minified.js b/crates/swc/tests/tsc-references/exportNamespace1_es5.2.minified.js index 5ba682b9945e..0afa99efa2ae 100644 --- a/crates/swc/tests/tsc-references/exportNamespace1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportNamespace1_es5.2.minified.js @@ -3,5 +3,7 @@ export var A = function() { "use strict"; _class_call_check(this, A); }; +export { }; export * from "./b"; +import { A } from "./c"; new A(); diff --git a/crates/swc/tests/tsc-references/exportNamespace3_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportNamespace3_es2015.1.normal.js index a63113452812..d07ea7589c12 100644 --- a/crates/swc/tests/tsc-references/exportNamespace3_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportNamespace3_es2015.1.normal.js @@ -1,6 +1,8 @@ // @Filename: a.ts export class A { } +// @Filename: b.ts +export { }; // @Filename: c.ts import * as _a from './b'; export { _a as a }; diff --git a/crates/swc/tests/tsc-references/exportNamespace3_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportNamespace3_es2015.2.minified.js index ea1bac20ba59..183edf00686c 100644 --- a/crates/swc/tests/tsc-references/exportNamespace3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportNamespace3_es2015.2.minified.js @@ -1,6 +1,7 @@ export class A { } +export { }; import * as _a from './b'; +export { _a as a }; import { a } from './c'; new a.A(); -export { _a as a }; diff --git a/crates/swc/tests/tsc-references/exportNamespace3_es5.1.normal.js b/crates/swc/tests/tsc-references/exportNamespace3_es5.1.normal.js index b4315a028d98..d4136b9235a4 100644 --- a/crates/swc/tests/tsc-references/exportNamespace3_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportNamespace3_es5.1.normal.js @@ -4,6 +4,8 @@ export var A = function A() { "use strict"; _class_call_check(this, A); }; +// @Filename: b.ts +export { }; // @Filename: c.ts import * as _a from "./b"; export { _a as a }; diff --git a/crates/swc/tests/tsc-references/exportNamespace3_es5.2.minified.js b/crates/swc/tests/tsc-references/exportNamespace3_es5.2.minified.js index 7523c70d92d4..adb9ae38b7c3 100644 --- a/crates/swc/tests/tsc-references/exportNamespace3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportNamespace3_es5.2.minified.js @@ -3,7 +3,8 @@ export var A = function() { "use strict"; _class_call_check(this, A); }; +export { }; import * as _a from "./b"; +export { _a as a }; import { a } from "./c"; new a.A(); -export { _a as a }; diff --git a/crates/swc/tests/tsc-references/exportNestedNamespaces2_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportNestedNamespaces2_es2015.2.minified.js index 1a65d01ff187..629e2b62e2b4 100644 --- a/crates/swc/tests/tsc-references/exportNestedNamespaces2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportNestedNamespaces2_es2015.2.minified.js @@ -1,6 +1,8 @@ -exports.formatters = {}, (exports = require('./mod')).formatters.j = function(v) { +exports.formatters = {}; +(exports = require('./mod')).formatters.j = function(v) { return v; -}, (exports = require('./mod')).formatters.o = function(v) { +}; +(exports = require('./mod')).formatters.o = function(v) { return v; }; import * as debug from './mod'; diff --git a/crates/swc/tests/tsc-references/exportNestedNamespaces2_es5.2.minified.js b/crates/swc/tests/tsc-references/exportNestedNamespaces2_es5.2.minified.js index a484670f022f..926cfc7b7a4e 100644 --- a/crates/swc/tests/tsc-references/exportNestedNamespaces2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportNestedNamespaces2_es5.2.minified.js @@ -1,6 +1,8 @@ -exports.formatters = {}, (exports = require("./mod")).formatters.j = function(v) { +exports.formatters = {}; +(exports = require("./mod")).formatters.j = function(v) { return v; -}, (exports = require("./mod")).formatters.o = function(v) { +}; +(exports = require("./mod")).formatters.o = function(v) { return v; }; import * as debug from "./mod"; diff --git a/crates/swc/tests/tsc-references/exportNonVisibleType_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportNonVisibleType_es2015.1.normal.js index 56885ecb620f..bcab9578bbc7 100644 --- a/crates/swc/tests/tsc-references/exportNonVisibleType_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportNonVisibleType_es2015.1.normal.js @@ -3,9 +3,15 @@ var x = { a: "test", b: 42 }; +module.exports = x; // Should fail, I1 not exported. +export { }; +// @Filename: foo2.ts class C1 { } +module.exports = C1; // Should fail, type I1 of visible member C1.m1 not exported. +export { }; +// @Filename: foo3.ts class C1 { } -module.exports = x; // Should fail, I1 not exported. -export { }; // Should work, private type I1 of visible class C1 only used in private member m1. +module.exports = C1; // Should work, private type I1 of visible class C1 only used in private member m1. +export { }; diff --git a/crates/swc/tests/tsc-references/exportNonVisibleType_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportNonVisibleType_es2015.2.minified.js index a9f01bdc5a8e..b36f520bd8bd 100644 --- a/crates/swc/tests/tsc-references/exportNonVisibleType_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportNonVisibleType_es2015.2.minified.js @@ -3,3 +3,9 @@ module.exports = { b: 42 }; export { }; +module.exports = class { +}; +export { }; +module.exports = class { +}; +export { }; diff --git a/crates/swc/tests/tsc-references/exportNonVisibleType_es5.1.normal.js b/crates/swc/tests/tsc-references/exportNonVisibleType_es5.1.normal.js index 40909918c4e6..3a08f7117d13 100644 --- a/crates/swc/tests/tsc-references/exportNonVisibleType_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportNonVisibleType_es5.1.normal.js @@ -1,16 +1,23 @@ // @Filename: foo1.ts -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var x = { a: "test", b: 42 }; +module.exports = x; // Should fail, I1 not exported. +export { }; +// @Filename: foo2.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var C1 = function C1() { "use strict"; _class_call_check(this, C1); }; +module.exports = C1; // Should fail, type I1 of visible member C1.m1 not exported. +export { }; +// @Filename: foo3.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var C1 = function C1() { "use strict"; _class_call_check(this, C1); }; -module.exports = x; // Should fail, I1 not exported. -export { }; // Should work, private type I1 of visible class C1 only used in private member m1. +module.exports = C1; // Should work, private type I1 of visible class C1 only used in private member m1. +export { }; diff --git a/crates/swc/tests/tsc-references/exportNonVisibleType_es5.2.minified.js b/crates/swc/tests/tsc-references/exportNonVisibleType_es5.2.minified.js index e4c822a74269..b18a6925a53d 100644 --- a/crates/swc/tests/tsc-references/exportNonVisibleType_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportNonVisibleType_es5.2.minified.js @@ -1,12 +1,17 @@ +module.exports = { + a: "test", + b: 42 +}; +export { }; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var C1 = function() { "use strict"; _class_call_check(this, C1); -}, C1 = function() { +}; +module.exports = C1; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +var C1 = function() { "use strict"; _class_call_check(this, C1); }; -module.exports = { - a: "test", - b: 42 -}; +module.exports = C1; diff --git a/crates/swc/tests/tsc-references/exportSpecifiers_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportSpecifiers_es2015.1.normal.js new file mode 100644 index 000000000000..789c6c62bb86 --- /dev/null +++ b/crates/swc/tests/tsc-references/exportSpecifiers_es2015.1.normal.js @@ -0,0 +1,22 @@ +// @module: esnext +// @declaration: true +// @Filename: /imports.ts +import { type, as, something, foo, bar } from "./exports.js"; +type; +as; // Error (used in emitting position) +something; // Error (used in emitting position) +foo; // Error (used in emitting position) +bar; // Error (used in emitting position) +// @Filename: /exports.ts +//! +//! x The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement. +//! ,---- +//! 10 | export type { type something as whatever }; // Error +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/exportSpecifiers_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportSpecifiers_es2015.2.minified.js new file mode 100644 index 000000000000..2b9386a2a765 --- /dev/null +++ b/crates/swc/tests/tsc-references/exportSpecifiers_es2015.2.minified.js @@ -0,0 +1,14 @@ +import { type, as, something, foo, bar } from "./exports.js"; +// @Filename: /exports.ts +//! +//! x The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement. +//! ,---- +//! 10 | export type { type something as whatever }; // Error +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/exportSpecifiers_es5.1.normal.js b/crates/swc/tests/tsc-references/exportSpecifiers_es5.1.normal.js new file mode 100644 index 000000000000..789c6c62bb86 --- /dev/null +++ b/crates/swc/tests/tsc-references/exportSpecifiers_es5.1.normal.js @@ -0,0 +1,22 @@ +// @module: esnext +// @declaration: true +// @Filename: /imports.ts +import { type, as, something, foo, bar } from "./exports.js"; +type; +as; // Error (used in emitting position) +something; // Error (used in emitting position) +foo; // Error (used in emitting position) +bar; // Error (used in emitting position) +// @Filename: /exports.ts +//! +//! x The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement. +//! ,---- +//! 10 | export type { type something as whatever }; // Error +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/exportSpecifiers_es5.2.minified.js b/crates/swc/tests/tsc-references/exportSpecifiers_es5.2.minified.js new file mode 100644 index 000000000000..2b9386a2a765 --- /dev/null +++ b/crates/swc/tests/tsc-references/exportSpecifiers_es5.2.minified.js @@ -0,0 +1,14 @@ +import { type, as, something, foo, bar } from "./exports.js"; +// @Filename: /exports.ts +//! +//! x The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement. +//! ,---- +//! 10 | export type { type something as whatever }; // Error +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/exportSpellingSuggestion_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportSpellingSuggestion_es2015.1.normal.js index 75f298d5b5af..f85dc896cf4e 100644 --- a/crates/swc/tests/tsc-references/exportSpellingSuggestion_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportSpellingSuggestion_es2015.1.normal.js @@ -2,3 +2,5 @@ export function assertNever(x, msg) { throw new Error("Unexpected " + msg); } +// @filename: b.ts +export { }; diff --git a/crates/swc/tests/tsc-references/exportSpellingSuggestion_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportSpellingSuggestion_es2015.2.minified.js index b956a70bcf06..b432da2c0bb9 100644 --- a/crates/swc/tests/tsc-references/exportSpellingSuggestion_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportSpellingSuggestion_es2015.2.minified.js @@ -1,3 +1,4 @@ export function assertNever(x, msg) { throw Error("Unexpected " + msg); } +export { }; diff --git a/crates/swc/tests/tsc-references/exportSpellingSuggestion_es5.1.normal.js b/crates/swc/tests/tsc-references/exportSpellingSuggestion_es5.1.normal.js index 75f298d5b5af..f85dc896cf4e 100644 --- a/crates/swc/tests/tsc-references/exportSpellingSuggestion_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportSpellingSuggestion_es5.1.normal.js @@ -2,3 +2,5 @@ export function assertNever(x, msg) { throw new Error("Unexpected " + msg); } +// @filename: b.ts +export { }; diff --git a/crates/swc/tests/tsc-references/exportSpellingSuggestion_es5.2.minified.js b/crates/swc/tests/tsc-references/exportSpellingSuggestion_es5.2.minified.js index b956a70bcf06..b432da2c0bb9 100644 --- a/crates/swc/tests/tsc-references/exportSpellingSuggestion_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportSpellingSuggestion_es5.2.minified.js @@ -1,3 +1,4 @@ export function assertNever(x, msg) { throw Error("Unexpected " + msg); } +export { }; diff --git a/crates/swc/tests/tsc-references/exportStar-amd_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportStar-amd_es2015.1.normal.js index 5aed27849207..4d4a6d87f32c 100644 --- a/crates/swc/tests/tsc-references/exportStar-amd_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportStar-amd_es2015.1.normal.js @@ -16,7 +16,7 @@ export * from "./t1"; export * from "./t2"; export * from "./t3"; // @filename: main.ts -import hello from "./t4"; +import hello, { x, y, z, foo } from "./t4"; hello; x; y; diff --git a/crates/swc/tests/tsc-references/exportStar-amd_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportStar-amd_es2015.2.minified.js index 4c84bc690c93..d6dc13c371cc 100644 --- a/crates/swc/tests/tsc-references/exportStar-amd_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportStar-amd_es2015.2.minified.js @@ -3,8 +3,8 @@ export var y = 2; export default "hello"; export function foo() {} var x = "x", y = "y", z = "z"; +export { x, y, z }; export * from "./t1"; export * from "./t2"; export * from "./t3"; -import hello from "./t4"; -export { x, y, z }; +import hello, { x, y, z, foo } from "./t4"; diff --git a/crates/swc/tests/tsc-references/exportStar-amd_es5.1.normal.js b/crates/swc/tests/tsc-references/exportStar-amd_es5.1.normal.js index 5aed27849207..4d4a6d87f32c 100644 --- a/crates/swc/tests/tsc-references/exportStar-amd_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportStar-amd_es5.1.normal.js @@ -16,7 +16,7 @@ export * from "./t1"; export * from "./t2"; export * from "./t3"; // @filename: main.ts -import hello from "./t4"; +import hello, { x, y, z, foo } from "./t4"; hello; x; y; diff --git a/crates/swc/tests/tsc-references/exportStar-amd_es5.2.minified.js b/crates/swc/tests/tsc-references/exportStar-amd_es5.2.minified.js index 4c84bc690c93..d6dc13c371cc 100644 --- a/crates/swc/tests/tsc-references/exportStar-amd_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportStar-amd_es5.2.minified.js @@ -3,8 +3,8 @@ export var y = 2; export default "hello"; export function foo() {} var x = "x", y = "y", z = "z"; +export { x, y, z }; export * from "./t1"; export * from "./t2"; export * from "./t3"; -import hello from "./t4"; -export { x, y, z }; +import hello, { x, y, z, foo } from "./t4"; diff --git a/crates/swc/tests/tsc-references/exportStar_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportStar_es2015.1.normal.js index 8d7e9a476f05..ed608a37bc95 100644 --- a/crates/swc/tests/tsc-references/exportStar_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportStar_es2015.1.normal.js @@ -16,7 +16,7 @@ export * from "./t1"; export * from "./t2"; export * from "./t3"; // @filename: main.ts -import hello from "./t4"; +import hello, { x, y, z, foo } from "./t4"; hello; x; y; diff --git a/crates/swc/tests/tsc-references/exportStar_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportStar_es2015.2.minified.js index 4c84bc690c93..d6dc13c371cc 100644 --- a/crates/swc/tests/tsc-references/exportStar_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportStar_es2015.2.minified.js @@ -3,8 +3,8 @@ export var y = 2; export default "hello"; export function foo() {} var x = "x", y = "y", z = "z"; +export { x, y, z }; export * from "./t1"; export * from "./t2"; export * from "./t3"; -import hello from "./t4"; -export { x, y, z }; +import hello, { x, y, z, foo } from "./t4"; diff --git a/crates/swc/tests/tsc-references/exportStar_es5.1.normal.js b/crates/swc/tests/tsc-references/exportStar_es5.1.normal.js index 8d7e9a476f05..ed608a37bc95 100644 --- a/crates/swc/tests/tsc-references/exportStar_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportStar_es5.1.normal.js @@ -16,7 +16,7 @@ export * from "./t1"; export * from "./t2"; export * from "./t3"; // @filename: main.ts -import hello from "./t4"; +import hello, { x, y, z, foo } from "./t4"; hello; x; y; diff --git a/crates/swc/tests/tsc-references/exportStar_es5.2.minified.js b/crates/swc/tests/tsc-references/exportStar_es5.2.minified.js index 4c84bc690c93..d6dc13c371cc 100644 --- a/crates/swc/tests/tsc-references/exportStar_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportStar_es5.2.minified.js @@ -3,8 +3,8 @@ export var y = 2; export default "hello"; export function foo() {} var x = "x", y = "y", z = "z"; +export { x, y, z }; export * from "./t1"; export * from "./t2"; export * from "./t3"; -import hello from "./t4"; -export { x, y, z }; +import hello, { x, y, z, foo } from "./t4"; diff --git a/crates/swc/tests/tsc-references/exportedEnumTypeAndValue_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportedEnumTypeAndValue_es2015.1.normal.js index 8c7a94911ccf..1ed8b44eebfe 100644 --- a/crates/swc/tests/tsc-references/exportedEnumTypeAndValue_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportedEnumTypeAndValue_es2015.1.normal.js @@ -7,4 +7,6 @@ b: 2 }; export default MyEnum; +// @Filename: use.js +import MyEnum from "./def"; /** @type {MyEnum} */ const v = MyEnum.b; diff --git a/crates/swc/tests/tsc-references/exportedEnumTypeAndValue_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportedEnumTypeAndValue_es2015.2.minified.js index 18998e8bb193..16610a945585 100644 --- a/crates/swc/tests/tsc-references/exportedEnumTypeAndValue_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportedEnumTypeAndValue_es2015.2.minified.js @@ -1,6 +1,6 @@ -let MyEnum = { +export default { a: 1, b: 2 }; -export default MyEnum; +import MyEnum from "./def"; MyEnum.b; diff --git a/crates/swc/tests/tsc-references/exportedEnumTypeAndValue_es5.1.normal.js b/crates/swc/tests/tsc-references/exportedEnumTypeAndValue_es5.1.normal.js index 1b45e944229a..8f2565da2423 100644 --- a/crates/swc/tests/tsc-references/exportedEnumTypeAndValue_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportedEnumTypeAndValue_es5.1.normal.js @@ -7,4 +7,6 @@ b: 2 }; export default MyEnum; +// @Filename: use.js +import MyEnum from "./def"; /** @type {MyEnum} */ var v = MyEnum.b; diff --git a/crates/swc/tests/tsc-references/exportedEnumTypeAndValue_es5.2.minified.js b/crates/swc/tests/tsc-references/exportedEnumTypeAndValue_es5.2.minified.js index c833b8b78595..16610a945585 100644 --- a/crates/swc/tests/tsc-references/exportedEnumTypeAndValue_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportedEnumTypeAndValue_es5.2.minified.js @@ -1,6 +1,6 @@ -var MyEnum = { +export default { a: 1, b: 2 }; -export default MyEnum; +import MyEnum from "./def"; MyEnum.b; diff --git a/crates/swc/tests/tsc-references/exportsAndImports1-amd_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImports1-amd_es2015.1.normal.js index 46632bb65012..6d2b64cf562a 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports1-amd_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImports1-amd_es2015.1.normal.js @@ -27,5 +27,5 @@ export { v, f, C, E, D, M, N, a }; // @filename: t2.ts export { v, f, C, I, E, D, M, N, T, a } from "./t1"; // @filename: t3.ts -import { I, T } from "./t1"; -export { v, f, C, E, D, M, N, a }; +import { v, f, C, I, E, D, M, N, T, a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports1-amd_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports1-amd_es2015.2.minified.js index ce49edb5459c..864f3e6b1146 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports1-amd_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports1-amd_es2015.2.minified.js @@ -11,6 +11,7 @@ class C { M.x = x; }(M || (M = {})); var a = M.x; +export { v, f, C, E, D, M, N, a }; export { v, f, C, I, E, D, M, N, T, a } from "./t1"; -import { I, T } from "./t1"; -export { v, f, C, E, D, M, N, a, v, f, C, E, D, M, N, a }; +import { v, f, C, I, E, D, M, N, T, a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports1-amd_es5.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImports1-amd_es5.1.normal.js index 7c16bfafdfaa..c492a65bc438 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports1-amd_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImports1-amd_es5.1.normal.js @@ -30,5 +30,5 @@ export { v, f, C, E, D, M, N, a }; // @filename: t2.ts export { v, f, C, I, E, D, M, N, T, a } from "./t1"; // @filename: t3.ts -import { I, T } from "./t1"; -export { v, f, C, E, D, M, N, a }; +import { v, f, C, I, E, D, M, N, T, a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports1-amd_es5.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports1-amd_es5.2.minified.js index 33a9fc298fcf..c9d773dd2c61 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports1-amd_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports1-amd_es5.2.minified.js @@ -14,6 +14,7 @@ var C = function() { M.x = x; }(M || (M = {})); var a = M.x; +export { v, f, C, E, D, M, N, a }; export { v, f, C, I, E, D, M, N, T, a } from "./t1"; -import { I, T } from "./t1"; -export { v, f, C, E, D, M, N, a, v, f, C, E, D, M, N, a }; +import { v, f, C, I, E, D, M, N, T, a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports1-es6_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImports1-es6_es2015.1.normal.js index 00577ae716a5..bf41fcbcf5f0 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports1-es6_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImports1-es6_es2015.1.normal.js @@ -27,5 +27,5 @@ export { v, f, C, E, D, M, N, a }; // @filename: t2.ts export { v, f, C, I, E, D, M, N, T, a } from "./t1"; // @filename: t3.ts -import { I, T } from "./t1"; -export { v, f, C, E, D, M, N, a }; +import { v, f, C, I, E, D, M, N, T, a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports1-es6_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports1-es6_es2015.2.minified.js index ce49edb5459c..864f3e6b1146 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports1-es6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports1-es6_es2015.2.minified.js @@ -11,6 +11,7 @@ class C { M.x = x; }(M || (M = {})); var a = M.x; +export { v, f, C, E, D, M, N, a }; export { v, f, C, I, E, D, M, N, T, a } from "./t1"; -import { I, T } from "./t1"; -export { v, f, C, E, D, M, N, a, v, f, C, E, D, M, N, a }; +import { v, f, C, I, E, D, M, N, T, a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports1-es6_es5.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImports1-es6_es5.1.normal.js index 71bbf14f37d8..d5cb81f0c4f5 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports1-es6_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImports1-es6_es5.1.normal.js @@ -30,5 +30,5 @@ export { v, f, C, E, D, M, N, a }; // @filename: t2.ts export { v, f, C, I, E, D, M, N, T, a } from "./t1"; // @filename: t3.ts -import { I, T } from "./t1"; -export { v, f, C, E, D, M, N, a }; +import { v, f, C, I, E, D, M, N, T, a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports1-es6_es5.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports1-es6_es5.2.minified.js index 33a9fc298fcf..c9d773dd2c61 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports1-es6_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports1-es6_es5.2.minified.js @@ -14,6 +14,7 @@ var C = function() { M.x = x; }(M || (M = {})); var a = M.x; +export { v, f, C, E, D, M, N, a }; export { v, f, C, I, E, D, M, N, T, a } from "./t1"; -import { I, T } from "./t1"; -export { v, f, C, E, D, M, N, a, v, f, C, E, D, M, N, a }; +import { v, f, C, I, E, D, M, N, T, a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports1_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImports1_es2015.1.normal.js index 65b68671930e..3bd0be968845 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports1_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImports1_es2015.1.normal.js @@ -26,5 +26,5 @@ export { v, f, C, E, D, M, N, a }; // @filename: t2.ts export { v, f, C, I, E, D, M, N, T, a } from "./t1"; // @filename: t3.ts -import { I, T } from "./t1"; -export { v, f, C, E, D, M, N, a }; +import { v, f, C, I, E, D, M, N, T, a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports1_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports1_es2015.2.minified.js index ce49edb5459c..864f3e6b1146 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports1_es2015.2.minified.js @@ -11,6 +11,7 @@ class C { M.x = x; }(M || (M = {})); var a = M.x; +export { v, f, C, E, D, M, N, a }; export { v, f, C, I, E, D, M, N, T, a } from "./t1"; -import { I, T } from "./t1"; -export { v, f, C, E, D, M, N, a, v, f, C, E, D, M, N, a }; +import { v, f, C, I, E, D, M, N, T, a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports1_es5.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImports1_es5.1.normal.js index 1a4acb58d794..854d756fd142 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports1_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImports1_es5.1.normal.js @@ -29,5 +29,5 @@ export { v, f, C, E, D, M, N, a }; // @filename: t2.ts export { v, f, C, I, E, D, M, N, T, a } from "./t1"; // @filename: t3.ts -import { I, T } from "./t1"; -export { v, f, C, E, D, M, N, a }; +import { v, f, C, I, E, D, M, N, T, a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports1_es5.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports1_es5.2.minified.js index 33a9fc298fcf..c9d773dd2c61 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports1_es5.2.minified.js @@ -14,6 +14,7 @@ var C = function() { M.x = x; }(M || (M = {})); var a = M.x; +export { v, f, C, E, D, M, N, a }; export { v, f, C, I, E, D, M, N, T, a } from "./t1"; -import { I, T } from "./t1"; -export { v, f, C, E, D, M, N, a, v, f, C, E, D, M, N, a }; +import { v, f, C, I, E, D, M, N, T, a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports2-amd_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImports2-amd_es2015.1.normal.js index 1ce61267d0ee..36e1d70233ce 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports2-amd_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImports2-amd_es2015.1.normal.js @@ -5,4 +5,6 @@ export var x = "x"; export var y = "y"; // @filename: t2.ts export { x as y, y as x } from "./t1"; +// @filename: t3.ts +import { x, y } from "./t1"; export { x as y, y as x }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports2-amd_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports2-amd_es2015.2.minified.js index db3df8ccaa63..ca2f1ceecba8 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports2-amd_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports2-amd_es2015.2.minified.js @@ -1,4 +1,5 @@ export var x = "x"; export var y = "y"; export { x as y, y as x } from "./t1"; +import { x, y } from "./t1"; export { x as y, y as x }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports2-amd_es5.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImports2-amd_es5.1.normal.js index 1ce61267d0ee..36e1d70233ce 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports2-amd_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImports2-amd_es5.1.normal.js @@ -5,4 +5,6 @@ export var x = "x"; export var y = "y"; // @filename: t2.ts export { x as y, y as x } from "./t1"; +// @filename: t3.ts +import { x, y } from "./t1"; export { x as y, y as x }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports2-amd_es5.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports2-amd_es5.2.minified.js index db3df8ccaa63..ca2f1ceecba8 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports2-amd_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports2-amd_es5.2.minified.js @@ -1,4 +1,5 @@ export var x = "x"; export var y = "y"; export { x as y, y as x } from "./t1"; +import { x, y } from "./t1"; export { x as y, y as x }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports2-es6_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImports2-es6_es2015.1.normal.js index c8951e6c38f0..b2e4b2128c8c 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports2-es6_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImports2-es6_es2015.1.normal.js @@ -5,4 +5,6 @@ export var x = "x"; export var y = "y"; // @filename: t2.ts export { x as y, y as x } from "./t1"; +// @filename: t3.ts +import { x, y } from "./t1"; export { x as y, y as x }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports2-es6_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports2-es6_es2015.2.minified.js index db3df8ccaa63..ca2f1ceecba8 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports2-es6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports2-es6_es2015.2.minified.js @@ -1,4 +1,5 @@ export var x = "x"; export var y = "y"; export { x as y, y as x } from "./t1"; +import { x, y } from "./t1"; export { x as y, y as x }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports2-es6_es5.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImports2-es6_es5.1.normal.js index c8951e6c38f0..b2e4b2128c8c 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports2-es6_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImports2-es6_es5.1.normal.js @@ -5,4 +5,6 @@ export var x = "x"; export var y = "y"; // @filename: t2.ts export { x as y, y as x } from "./t1"; +// @filename: t3.ts +import { x, y } from "./t1"; export { x as y, y as x }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports2-es6_es5.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports2-es6_es5.2.minified.js index db3df8ccaa63..ca2f1ceecba8 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports2-es6_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports2-es6_es5.2.minified.js @@ -1,4 +1,5 @@ export var x = "x"; export var y = "y"; export { x as y, y as x } from "./t1"; +import { x, y } from "./t1"; export { x as y, y as x }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports2_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImports2_es2015.1.normal.js index f70d780cee87..8b6c4a5fd9fd 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports2_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImports2_es2015.1.normal.js @@ -4,4 +4,6 @@ export var x = "x"; export var y = "y"; // @filename: t2.ts export { x as y, y as x } from "./t1"; +// @filename: t3.ts +import { x, y } from "./t1"; export { x as y, y as x }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports2_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports2_es2015.2.minified.js index db3df8ccaa63..ca2f1ceecba8 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports2_es2015.2.minified.js @@ -1,4 +1,5 @@ export var x = "x"; export var y = "y"; export { x as y, y as x } from "./t1"; +import { x, y } from "./t1"; export { x as y, y as x }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports2_es5.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImports2_es5.1.normal.js index f70d780cee87..8b6c4a5fd9fd 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports2_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImports2_es5.1.normal.js @@ -4,4 +4,6 @@ export var x = "x"; export var y = "y"; // @filename: t2.ts export { x as y, y as x } from "./t1"; +// @filename: t3.ts +import { x, y } from "./t1"; export { x as y, y as x }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports2_es5.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports2_es5.2.minified.js index db3df8ccaa63..ca2f1ceecba8 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports2_es5.2.minified.js @@ -1,4 +1,5 @@ export var x = "x"; export var y = "y"; export { x as y, y as x } from "./t1"; +import { x, y } from "./t1"; export { x as y, y as x }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports3-amd_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImports3-amd_es2015.1.normal.js index 42862603c32a..95c18ca7e563 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports3-amd_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImports3-amd_es2015.1.normal.js @@ -27,5 +27,5 @@ export { v as v1, f as f1, C as C1, E as E1, D as D1, M as M1, N as N1, a as a1 // @filename: t2.ts export { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; // @filename: t3.ts -import { I1 as I, T1 as T } from "./t1"; -export { v, f, C, E, D, M, N, a }; +import { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports3-amd_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports3-amd_es2015.2.minified.js index c99bc4121208..d134368b04c3 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports3-amd_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports3-amd_es2015.2.minified.js @@ -16,6 +16,7 @@ export var M; M.x = x; }(M || (M = {})); export var a = M.x; +export { v as v1, f as f1, C as C1, E as E1, D as D1, M as M1, N as N1, a as a1 }; export { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; -import { I1 as I, T1 as T } from "./t1"; -export { v as v1, f as f1, C as C1, E as E1, D as D1, M as M1, N as N1, a as a1, v, f, C, E, D, M, N, a }; +import { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports3-amd_es5.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImports3-amd_es5.1.normal.js index 268572aa92dd..a07a72de0db2 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports3-amd_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImports3-amd_es5.1.normal.js @@ -30,5 +30,5 @@ export { v as v1, f as f1, C as C1, E as E1, D as D1, M as M1, N as N1, a as a1 // @filename: t2.ts export { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; // @filename: t3.ts -import { I1 as I, T1 as T } from "./t1"; -export { v, f, C, E, D, M, N, a }; +import { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports3-amd_es5.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports3-amd_es5.2.minified.js index 6b8ba3fe3f14..43fef95bcd8b 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports3-amd_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports3-amd_es5.2.minified.js @@ -19,6 +19,7 @@ export var M; M.x = x; }(M || (M = {})); export var a = M.x; +export { v as v1, f as f1, C as C1, E as E1, D as D1, M as M1, N as N1, a as a1 }; export { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; -import { I1 as I, T1 as T } from "./t1"; -export { v as v1, f as f1, C as C1, E as E1, D as D1, M as M1, N as N1, a as a1, v, f, C, E, D, M, N, a }; +import { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports3-es6_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImports3-es6_es2015.1.normal.js index d5b4a2a7f598..0706b511f73a 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports3-es6_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImports3-es6_es2015.1.normal.js @@ -27,5 +27,5 @@ export { v as v1, f as f1, C as C1, E as E1, D as D1, M as M1, N as N1, a as a1 // @filename: t2.ts export { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; // @filename: t3.ts -import { I1 as I, T1 as T } from "./t1"; -export { v, f, C, E, D, M, N, a }; +import { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports3-es6_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports3-es6_es2015.2.minified.js index c99bc4121208..d134368b04c3 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports3-es6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports3-es6_es2015.2.minified.js @@ -16,6 +16,7 @@ export var M; M.x = x; }(M || (M = {})); export var a = M.x; +export { v as v1, f as f1, C as C1, E as E1, D as D1, M as M1, N as N1, a as a1 }; export { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; -import { I1 as I, T1 as T } from "./t1"; -export { v as v1, f as f1, C as C1, E as E1, D as D1, M as M1, N as N1, a as a1, v, f, C, E, D, M, N, a }; +import { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports3-es6_es5.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImports3-es6_es5.1.normal.js index cefebafa99ec..b4c6715c80af 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports3-es6_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImports3-es6_es5.1.normal.js @@ -30,5 +30,5 @@ export { v as v1, f as f1, C as C1, E as E1, D as D1, M as M1, N as N1, a as a1 // @filename: t2.ts export { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; // @filename: t3.ts -import { I1 as I, T1 as T } from "./t1"; -export { v, f, C, E, D, M, N, a }; +import { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports3-es6_es5.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports3-es6_es5.2.minified.js index 6b8ba3fe3f14..43fef95bcd8b 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports3-es6_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports3-es6_es5.2.minified.js @@ -19,6 +19,7 @@ export var M; M.x = x; }(M || (M = {})); export var a = M.x; +export { v as v1, f as f1, C as C1, E as E1, D as D1, M as M1, N as N1, a as a1 }; export { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; -import { I1 as I, T1 as T } from "./t1"; -export { v as v1, f as f1, C as C1, E as E1, D as D1, M as M1, N as N1, a as a1, v, f, C, E, D, M, N, a }; +import { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports3_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImports3_es2015.1.normal.js index 903ce1f4f9a8..4129976768e2 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports3_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImports3_es2015.1.normal.js @@ -26,5 +26,5 @@ export { v as v1, f as f1, C as C1, E as E1, D as D1, M as M1, N as N1, a as a1 // @filename: t2.ts export { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; // @filename: t3.ts -import { I1 as I, T1 as T } from "./t1"; -export { v, f, C, E, D, M, N, a }; +import { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports3_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports3_es2015.2.minified.js index c99bc4121208..d134368b04c3 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports3_es2015.2.minified.js @@ -16,6 +16,7 @@ export var M; M.x = x; }(M || (M = {})); export var a = M.x; +export { v as v1, f as f1, C as C1, E as E1, D as D1, M as M1, N as N1, a as a1 }; export { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; -import { I1 as I, T1 as T } from "./t1"; -export { v as v1, f as f1, C as C1, E as E1, D as D1, M as M1, N as N1, a as a1, v, f, C, E, D, M, N, a }; +import { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports3_es5.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImports3_es5.1.normal.js index c0c3fa7eeda6..3e990ce20aa6 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports3_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImports3_es5.1.normal.js @@ -29,5 +29,5 @@ export { v as v1, f as f1, C as C1, E as E1, D as D1, M as M1, N as N1, a as a1 // @filename: t2.ts export { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; // @filename: t3.ts -import { I1 as I, T1 as T } from "./t1"; -export { v, f, C, E, D, M, N, a }; +import { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports3_es5.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports3_es5.2.minified.js index 6b8ba3fe3f14..43fef95bcd8b 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports3_es5.2.minified.js @@ -19,6 +19,7 @@ export var M; M.x = x; }(M || (M = {})); export var a = M.x; +export { v as v1, f as f1, C as C1, E as E1, D as D1, M as M1, N as N1, a as a1 }; export { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; -import { I1 as I, T1 as T } from "./t1"; -export { v as v1, f as f1, C as C1, E as E1, D as D1, M as M1, N as N1, a as a1, v, f, C, E, D, M, N, a }; +import { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; diff --git a/crates/swc/tests/tsc-references/exportsAndImports4-amd_es5.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports4-amd_es5.2.minified.js index 352f58103898..601ffead9bfa 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports4-amd_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports4-amd_es5.2.minified.js @@ -1,6 +1,5 @@ export default "hello"; -var a = require("./t1"); -a.default; +require("./t1").default; import b from "./t1"; import * as c from "./t1"; c.default; diff --git a/crates/swc/tests/tsc-references/exportsAndImports4-es6_es5.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports4-es6_es5.2.minified.js index 352f58103898..601ffead9bfa 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports4-es6_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports4-es6_es5.2.minified.js @@ -1,6 +1,5 @@ export default "hello"; -var a = require("./t1"); -a.default; +require("./t1").default; import b from "./t1"; import * as c from "./t1"; c.default; diff --git a/crates/swc/tests/tsc-references/exportsAndImports4_es5.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports4_es5.2.minified.js index 352f58103898..601ffead9bfa 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports4_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports4_es5.2.minified.js @@ -1,6 +1,5 @@ export default "hello"; -var a = require("./t1"); -a.default; +require("./t1").default; import b from "./t1"; import * as c from "./t1"; c.default; diff --git a/crates/swc/tests/tsc-references/exportsAndImportsWithContextualKeywordNames02_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImportsWithContextualKeywordNames02_es2015.1.normal.js index 1664dae5d53a..8b2396cae46c 100644 --- a/crates/swc/tests/tsc-references/exportsAndImportsWithContextualKeywordNames02_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImportsWithContextualKeywordNames02_es2015.1.normal.js @@ -3,5 +3,11 @@ // @filename: t1.ts let as = 100; export { as as return, as }; +// @filename: t2.ts +import * as as from "./t1"; var x = as.as; var y = as.return; +// @filename: t3.ts +export { }; +// @filename: t4.ts +export { }; diff --git a/crates/swc/tests/tsc-references/exportsAndImportsWithContextualKeywordNames02_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImportsWithContextualKeywordNames02_es2015.2.minified.js index 349adbf66c09..bc58004063fe 100644 --- a/crates/swc/tests/tsc-references/exportsAndImportsWithContextualKeywordNames02_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImportsWithContextualKeywordNames02_es2015.2.minified.js @@ -1,2 +1,6 @@ let as = 100; export { as as return, as }; +import * as as from "./t1"; +as.as, as.return; +export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/exportsAndImportsWithContextualKeywordNames02_es5.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImportsWithContextualKeywordNames02_es5.1.normal.js index 5ab525685517..f6b74e13b14b 100644 --- a/crates/swc/tests/tsc-references/exportsAndImportsWithContextualKeywordNames02_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImportsWithContextualKeywordNames02_es5.1.normal.js @@ -3,5 +3,11 @@ // @filename: t1.ts var as = 100; export { as as return, as }; +// @filename: t2.ts +import * as as from "./t1"; var x = as.as; var y = as.return; +// @filename: t3.ts +export { }; +// @filename: t4.ts +export { }; diff --git a/crates/swc/tests/tsc-references/exportsAndImportsWithContextualKeywordNames02_es5.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImportsWithContextualKeywordNames02_es5.2.minified.js index f890ee113ec0..30f47b64308f 100644 --- a/crates/swc/tests/tsc-references/exportsAndImportsWithContextualKeywordNames02_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImportsWithContextualKeywordNames02_es5.2.minified.js @@ -1,2 +1,6 @@ var as = 100; export { as as return, as }; +import * as as from "./t1"; +as.as, as.return; +export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores2_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores2_es2015.1.normal.js index 687e623b6fbe..533e51c3d6e8 100644 --- a/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores2_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores2_es2015.1.normal.js @@ -6,4 +6,6 @@ export default R = { "__esmodule": true, "__proto__": {} }; +// @filename: m2.ts +import R from "./m1"; const { __esmodule , __proto__ } = R; diff --git a/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores2_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores2_es2015.2.minified.js index e1a283c09812..483d9459b9e0 100644 --- a/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores2_es2015.2.minified.js @@ -1,6 +1,6 @@ -var R; -export default R = { +export default { "__esmodule": !0, "__proto__": {} }; +import R from "./m1"; let { __esmodule , __proto__ } = R; diff --git a/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores2_es5.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores2_es5.1.normal.js index 40af1cd4ad34..8ea99088b8d0 100644 --- a/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores2_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores2_es5.1.normal.js @@ -6,4 +6,6 @@ export default R = { "__esmodule": true, "__proto__": {} }; +// @filename: m2.ts +import R from "./m1"; var __esmodule = R.__esmodule, __proto__ = R.__proto__; diff --git a/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores2_es5.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores2_es5.2.minified.js index eeac88e77cbf..271f458a184b 100644 --- a/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores2_es5.2.minified.js @@ -1,6 +1,6 @@ -var R; -export default R = { +export default { "__esmodule": !0, "__proto__": {} }; +import R from "./m1"; R.__esmodule, R.__proto__; diff --git a/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores3_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores3_es2015.1.normal.js index 0f02e87adb03..2dd80206dc6d 100644 --- a/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores3_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores3_es2015.1.normal.js @@ -7,4 +7,6 @@ export default R = { "___hello": 21, "_hi": 40 }; +// @filename: m2.ts +import R from "./m1"; const { ___ , ___hello , _hi } = R; diff --git a/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores3_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores3_es2015.2.minified.js index d7dfa3ab92ac..c90948466dfe 100644 --- a/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores3_es2015.2.minified.js @@ -1,7 +1,7 @@ -var R; -export default R = { +export default { "___": 30, "___hello": 21, "_hi": 40 }; +import R from "./m1"; let { ___ , ___hello , _hi } = R; diff --git a/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores3_es5.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores3_es5.1.normal.js index a1b0a9ef32f0..afa208396463 100644 --- a/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores3_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores3_es5.1.normal.js @@ -7,4 +7,6 @@ export default R = { "___hello": 21, "_hi": 40 }; +// @filename: m2.ts +import R from "./m1"; var ___ = R.___, ___hello = R.___hello, _hi = R._hi; diff --git a/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores3_es5.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores3_es5.2.minified.js index 271be90732cf..1f2c7248925a 100644 --- a/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores3_es5.2.minified.js @@ -1,7 +1,7 @@ -var R; -export default R = { +export default { "___": 30, "___hello": 21, "_hi": 40 }; +import R from "./m1"; R.___, R.___hello, R._hi; diff --git a/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores4_es2015.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores4_es2015.1.normal.js index f880c4043154..2ff74839d989 100644 --- a/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores4_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores4_es2015.1.normal.js @@ -22,6 +22,8 @@ export function __esmodule() { export function ___hello() { console.log("___hello"); } +// @filename: m2.ts +import { _, __, ___hello, __esmodule, __proto, _hi } from "./m1"; _(); __(); ___hello(); diff --git a/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores4_es2015.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores4_es2015.2.minified.js index c0c879e4294e..f4b61804a844 100644 --- a/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores4_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores4_es2015.2.minified.js @@ -19,4 +19,5 @@ export function __esmodule() { export function ___hello() { console.log("___hello"); } +import { _, __, ___hello, __esmodule, __proto, _hi } from "./m1"; _(), __(), ___hello(), __esmodule(), __proto(), _hi(); diff --git a/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores4_es5.1.normal.js b/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores4_es5.1.normal.js index f880c4043154..2ff74839d989 100644 --- a/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores4_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores4_es5.1.normal.js @@ -22,6 +22,8 @@ export function __esmodule() { export function ___hello() { console.log("___hello"); } +// @filename: m2.ts +import { _, __, ___hello, __esmodule, __proto, _hi } from "./m1"; _(); __(); ___hello(); diff --git a/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores4_es5.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores4_es5.2.minified.js index c0c879e4294e..f4b61804a844 100644 --- a/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores4_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImportsWithUnderscores4_es5.2.minified.js @@ -19,4 +19,5 @@ export function __esmodule() { export function ___hello() { console.log("___hello"); } +import { _, __, ___hello, __esmodule, __proto, _hi } from "./m1"; _(), __(), ___hello(), __esmodule(), __proto(), _hi(); diff --git a/crates/swc/tests/tsc-references/extendClassExpressionFromModule_es2015.1.normal.js b/crates/swc/tests/tsc-references/extendClassExpressionFromModule_es2015.1.normal.js index 929ff0f9494e..8eb6c96144ff 100644 --- a/crates/swc/tests/tsc-references/extendClassExpressionFromModule_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/extendClassExpressionFromModule_es2015.1.normal.js @@ -2,10 +2,11 @@ // @Filename: foo1.ts class x { } +module.exports = x; +export { }; // @Filename: foo2.ts const foo1 = require('./foo1'); var x = foo1; class y extends x { } -module.exports = x; export { }; diff --git a/crates/swc/tests/tsc-references/extendClassExpressionFromModule_es2015.2.minified.js b/crates/swc/tests/tsc-references/extendClassExpressionFromModule_es2015.2.minified.js index 933120f25119..83b870c30ee0 100644 --- a/crates/swc/tests/tsc-references/extendClassExpressionFromModule_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/extendClassExpressionFromModule_es2015.2.minified.js @@ -1,6 +1,5 @@ -class x { -} -let foo1 = require('./foo1'); -var x = foo1; -module.exports = x; +module.exports = class { +}; +export { }; +require('./foo1'); export { }; diff --git a/crates/swc/tests/tsc-references/extendClassExpressionFromModule_es5.1.normal.js b/crates/swc/tests/tsc-references/extendClassExpressionFromModule_es5.1.normal.js index f4acb4b8dea4..177a8dc03aa6 100644 --- a/crates/swc/tests/tsc-references/extendClassExpressionFromModule_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/extendClassExpressionFromModule_es5.1.normal.js @@ -1,13 +1,16 @@ // @module: commonjs // @Filename: foo1.ts import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; var x = function x() { "use strict"; _class_call_check(this, x); }; +module.exports = x; +export { }; // @Filename: foo2.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var foo1 = require("./foo1"); var x = foo1; var y = /*#__PURE__*/ function(x) { @@ -20,5 +23,4 @@ var y = /*#__PURE__*/ function(x) { } return y; }(x); -module.exports = x; export { }; diff --git a/crates/swc/tests/tsc-references/extendClassExpressionFromModule_es5.2.minified.js b/crates/swc/tests/tsc-references/extendClassExpressionFromModule_es5.2.minified.js index 59d4acb2d24e..6d707d859dbf 100644 --- a/crates/swc/tests/tsc-references/extendClassExpressionFromModule_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/extendClassExpressionFromModule_es5.2.minified.js @@ -1,7 +1,13 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +var x = function() { + "use strict"; + _class_call_check(this, x); +}; +module.exports = x; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; -var x = require("./foo1"), y = function(x) { +var y = function(x) { "use strict"; _inherits(y, x); var _super = _create_super(y); @@ -9,5 +15,4 @@ var x = require("./foo1"), y = function(x) { return _class_call_check(this, y), _super.apply(this, arguments); } return y; -}(x); -module.exports = x; +}(require("./foo1")); diff --git a/crates/swc/tests/tsc-references/extendsTagEmit_es2015.1.normal.js b/crates/swc/tests/tsc-references/extendsTagEmit_es2015.1.normal.js index 445fc42e2f65..a7d9680953a4 100644 --- a/crates/swc/tests/tsc-references/extendsTagEmit_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/extendsTagEmit_es2015.1.normal.js @@ -5,5 +5,7 @@ // @Filename: super.js export class B { } +// @Filename: main.js +import { B } from './super'; /** @extends {Mismatch} */ class C extends B { } diff --git a/crates/swc/tests/tsc-references/extendsTagEmit_es2015.2.minified.js b/crates/swc/tests/tsc-references/extendsTagEmit_es2015.2.minified.js index 94fa3c9c47a3..e5d5c3c4580e 100644 --- a/crates/swc/tests/tsc-references/extendsTagEmit_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/extendsTagEmit_es2015.2.minified.js @@ -1,2 +1,3 @@ export class B { } +import { B } from './super'; diff --git a/crates/swc/tests/tsc-references/extendsTagEmit_es5.1.normal.js b/crates/swc/tests/tsc-references/extendsTagEmit_es5.1.normal.js index 694b27fab756..0dbe99e2349b 100644 --- a/crates/swc/tests/tsc-references/extendsTagEmit_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/extendsTagEmit_es5.1.normal.js @@ -4,12 +4,15 @@ // @outDir: out // @Filename: super.js import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; export var B = function B() { "use strict"; _class_call_check(this, B); }; +// @Filename: main.js +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +import { B } from "./super"; /** @extends {Mismatch} */ var C = /*#__PURE__*/ function(B) { "use strict"; _inherits(C, B); diff --git a/crates/swc/tests/tsc-references/extendsTagEmit_es5.2.minified.js b/crates/swc/tests/tsc-references/extendsTagEmit_es5.2.minified.js index 4cca4e131a5a..2cf2ca1b0f79 100644 --- a/crates/swc/tests/tsc-references/extendsTagEmit_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/extendsTagEmit_es5.2.minified.js @@ -1,10 +1,12 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; export var B = function() { "use strict"; _class_call_check(this, B); }; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +import { B } from "./super"; var C = function(B) { "use strict"; _inherits(C, B); diff --git a/crates/swc/tests/tsc-references/filterNamespace_import_es2015.1.normal.js b/crates/swc/tests/tsc-references/filterNamespace_import_es2015.1.normal.js index 81679d418223..ae90add6933f 100644 --- a/crates/swc/tests/tsc-references/filterNamespace_import_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/filterNamespace_import_es2015.1.normal.js @@ -13,6 +13,7 @@ var ns; })(nested = ns.nested || (ns.nested = {})); })(ns || (ns = {})); export default ns; +// @Filename: /a.ts ns.Class; // Error ns.Value; // Error let c; @@ -20,3 +21,4 @@ let t = ""; let n = { a: '' }; +export { }; diff --git a/crates/swc/tests/tsc-references/filterNamespace_import_es2015.2.minified.js b/crates/swc/tests/tsc-references/filterNamespace_import_es2015.2.minified.js index 2f1745e8f6b8..b10f1c13e8db 100644 --- a/crates/swc/tests/tsc-references/filterNamespace_import_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/filterNamespace_import_es2015.2.minified.js @@ -6,3 +6,4 @@ var ns; }(ns || (ns = {})); export default ns; ns.Class, ns.Value; +export { }; diff --git a/crates/swc/tests/tsc-references/filterNamespace_import_es5.1.normal.js b/crates/swc/tests/tsc-references/filterNamespace_import_es5.1.normal.js index 52e1b538f22a..b91950cf2387 100644 --- a/crates/swc/tests/tsc-references/filterNamespace_import_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/filterNamespace_import_es5.1.normal.js @@ -18,6 +18,7 @@ var ns; })(nested = ns.nested || (ns.nested = {})); })(ns || (ns = {})); export default ns; +// @Filename: /a.ts ns.Class; // Error ns.Value; // Error var c; @@ -25,3 +26,4 @@ var t = ""; var n = { a: "" }; +export { }; diff --git a/crates/swc/tests/tsc-references/filterNamespace_import_es5.2.minified.js b/crates/swc/tests/tsc-references/filterNamespace_import_es5.2.minified.js index c5df595b355a..4a51ef17fbd8 100644 --- a/crates/swc/tests/tsc-references/filterNamespace_import_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/filterNamespace_import_es5.2.minified.js @@ -12,3 +12,4 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; }(ns || (ns = {})); export default ns; ns.Class, ns.Value; +export { }; diff --git a/crates/swc/tests/tsc-references/for-inStatementsDestructuring3_es2015.1.normal.js b/crates/swc/tests/tsc-references/for-inStatementsDestructuring3_es2015.1.normal.js new file mode 100644 index 000000000000..11a1c82ce8c7 --- /dev/null +++ b/crates/swc/tests/tsc-references/for-inStatementsDestructuring3_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...in' statement cannot be a destructuring pattern +//! ,---- +//! 2 | for ([a, b] in []) { } +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/for-inStatementsDestructuring3_es2015.2.minified.js b/crates/swc/tests/tsc-references/for-inStatementsDestructuring3_es2015.2.minified.js new file mode 100644 index 000000000000..11a1c82ce8c7 --- /dev/null +++ b/crates/swc/tests/tsc-references/for-inStatementsDestructuring3_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...in' statement cannot be a destructuring pattern +//! ,---- +//! 2 | for ([a, b] in []) { } +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/for-inStatementsDestructuring3_es5.1.normal.js b/crates/swc/tests/tsc-references/for-inStatementsDestructuring3_es5.1.normal.js new file mode 100644 index 000000000000..11a1c82ce8c7 --- /dev/null +++ b/crates/swc/tests/tsc-references/for-inStatementsDestructuring3_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...in' statement cannot be a destructuring pattern +//! ,---- +//! 2 | for ([a, b] in []) { } +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/for-inStatementsDestructuring3_es5.2.minified.js b/crates/swc/tests/tsc-references/for-inStatementsDestructuring3_es5.2.minified.js new file mode 100644 index 000000000000..11a1c82ce8c7 --- /dev/null +++ b/crates/swc/tests/tsc-references/for-inStatementsDestructuring3_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...in' statement cannot be a destructuring pattern +//! ,---- +//! 2 | for ([a, b] in []) { } +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/for-inStatementsDestructuring4_es2015.1.normal.js b/crates/swc/tests/tsc-references/for-inStatementsDestructuring4_es2015.1.normal.js new file mode 100644 index 000000000000..c9a3f3d99c25 --- /dev/null +++ b/crates/swc/tests/tsc-references/for-inStatementsDestructuring4_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...in' statement cannot be a destructuring pattern +//! ,---- +//! 2 | for ({a, b} in []) { } +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/for-inStatementsDestructuring4_es2015.2.minified.js b/crates/swc/tests/tsc-references/for-inStatementsDestructuring4_es2015.2.minified.js new file mode 100644 index 000000000000..c9a3f3d99c25 --- /dev/null +++ b/crates/swc/tests/tsc-references/for-inStatementsDestructuring4_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...in' statement cannot be a destructuring pattern +//! ,---- +//! 2 | for ({a, b} in []) { } +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/for-inStatementsDestructuring4_es5.1.normal.js b/crates/swc/tests/tsc-references/for-inStatementsDestructuring4_es5.1.normal.js new file mode 100644 index 000000000000..c9a3f3d99c25 --- /dev/null +++ b/crates/swc/tests/tsc-references/for-inStatementsDestructuring4_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...in' statement cannot be a destructuring pattern +//! ,---- +//! 2 | for ({a, b} in []) { } +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/for-inStatementsDestructuring4_es5.2.minified.js b/crates/swc/tests/tsc-references/for-inStatementsDestructuring4_es5.2.minified.js new file mode 100644 index 000000000000..c9a3f3d99c25 --- /dev/null +++ b/crates/swc/tests/tsc-references/for-inStatementsDestructuring4_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...in' statement cannot be a destructuring pattern +//! ,---- +//! 2 | for ({a, b} in []) { } +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/for-inStatementsInvalid_es2015.1.normal.js b/crates/swc/tests/tsc-references/for-inStatementsInvalid_es2015.1.normal.js new file mode 100644 index 000000000000..496b036738cf --- /dev/null +++ b/crates/swc/tests/tsc-references/for-inStatementsInvalid_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...of' statement cannot use a type annotation +//! ,---- +//! 10 | for (var idx : number in {}) { } +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/for-inStatementsInvalid_es2015.2.minified.js b/crates/swc/tests/tsc-references/for-inStatementsInvalid_es2015.2.minified.js new file mode 100644 index 000000000000..496b036738cf --- /dev/null +++ b/crates/swc/tests/tsc-references/for-inStatementsInvalid_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...of' statement cannot use a type annotation +//! ,---- +//! 10 | for (var idx : number in {}) { } +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/for-inStatementsInvalid_es5.1.normal.js b/crates/swc/tests/tsc-references/for-inStatementsInvalid_es5.1.normal.js new file mode 100644 index 000000000000..496b036738cf --- /dev/null +++ b/crates/swc/tests/tsc-references/for-inStatementsInvalid_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...of' statement cannot use a type annotation +//! ,---- +//! 10 | for (var idx : number in {}) { } +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/for-inStatementsInvalid_es5.2.minified.js b/crates/swc/tests/tsc-references/for-inStatementsInvalid_es5.2.minified.js new file mode 100644 index 000000000000..496b036738cf --- /dev/null +++ b/crates/swc/tests/tsc-references/for-inStatementsInvalid_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...of' statement cannot use a type annotation +//! ,---- +//! 10 | for (var idx : number in {}) { } +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/for-of3_es2015.1.normal.js b/crates/swc/tests/tsc-references/for-of3_es2015.1.normal.js new file mode 100644 index 000000000000..4e05e85e39a4 --- /dev/null +++ b/crates/swc/tests/tsc-references/for-of3_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 3 | for (v++ of []) { } +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/for-of3_es2015.2.minified.js b/crates/swc/tests/tsc-references/for-of3_es2015.2.minified.js new file mode 100644 index 000000000000..4e05e85e39a4 --- /dev/null +++ b/crates/swc/tests/tsc-references/for-of3_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 3 | for (v++ of []) { } +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/for-of3_es5.1.normal.js b/crates/swc/tests/tsc-references/for-of3_es5.1.normal.js new file mode 100644 index 000000000000..4e05e85e39a4 --- /dev/null +++ b/crates/swc/tests/tsc-references/for-of3_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 3 | for (v++ of []) { } +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/for-of3_es5.2.minified.js b/crates/swc/tests/tsc-references/for-of3_es5.2.minified.js new file mode 100644 index 000000000000..4e05e85e39a4 --- /dev/null +++ b/crates/swc/tests/tsc-references/for-of3_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 3 | for (v++ of []) { } +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/for-of51_es2015.1.normal.js b/crates/swc/tests/tsc-references/for-of51_es2015.1.normal.js index e934906fab3b..cc7d589140da 100644 --- a/crates/swc/tests/tsc-references/for-of51_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/for-of51_es2015.1.normal.js @@ -1,2 +1,12 @@ -//@target: ES6 -for (let let of []){} +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | for (let let of []) {} +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/for-of51_es2015.2.minified.js b/crates/swc/tests/tsc-references/for-of51_es2015.2.minified.js index 855b5bd1764e..cc7d589140da 100644 --- a/crates/swc/tests/tsc-references/for-of51_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/for-of51_es2015.2.minified.js @@ -1 +1,12 @@ -for (let let of []); +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | for (let let of []) {} +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/for-of51_es5.1.normal.js b/crates/swc/tests/tsc-references/for-of51_es5.1.normal.js index 21d4fe206e39..cc7d589140da 100644 --- a/crates/swc/tests/tsc-references/for-of51_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/for-of51_es5.1.normal.js @@ -1,20 +1,12 @@ -var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined; -try { - //@target: ES6 - for(var _iterator = [][Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){ - var let = _step.value; - } -} catch (err) { - _didIteratorError = true; - _iteratorError = err; -} finally{ - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally{ - if (_didIteratorError) { - throw _iteratorError; - } - } -} +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | for (let let of []) {} +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/for-of51_es5.2.minified.js b/crates/swc/tests/tsc-references/for-of51_es5.2.minified.js index e83228516385..cc7d589140da 100644 --- a/crates/swc/tests/tsc-references/for-of51_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/for-of51_es5.2.minified.js @@ -1,12 +1,12 @@ -var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0; -try { - for(var _step, _iterator = [][Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0)_step.value; -} catch (err) { - _didIteratorError = !0, _iteratorError = err; -} finally{ - try { - _iteratorNormalCompletion || null == _iterator.return || _iterator.return(); - } finally{ - if (_didIteratorError) throw _iteratorError; - } -} +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | for (let let of []) {} +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/for-of52_es2015.1.normal.js b/crates/swc/tests/tsc-references/for-of52_es2015.1.normal.js index 5b7c906e370a..5fd66feaa485 100644 --- a/crates/swc/tests/tsc-references/for-of52_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/for-of52_es2015.1.normal.js @@ -1,4 +1,8 @@ -//@target: ES6 -for (let [v, v] of [ - [] -]){} +//! +//! x the name `v` is defined multiple times +//! ,---- +//! 2 | for (let [v, v] of [[]]) {} +//! : | | +//! : | `-- `v` redefined here +//! : `-- previous definition of `v` here +//! `---- diff --git a/crates/swc/tests/tsc-references/for-of52_es2015.2.minified.js b/crates/swc/tests/tsc-references/for-of52_es2015.2.minified.js index dc64d7afe741..5fd66feaa485 100644 --- a/crates/swc/tests/tsc-references/for-of52_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/for-of52_es2015.2.minified.js @@ -1,3 +1,8 @@ -for (let [v, v] of [ - [] -]); +//! +//! x the name `v` is defined multiple times +//! ,---- +//! 2 | for (let [v, v] of [[]]) {} +//! : | | +//! : | `-- `v` redefined here +//! : `-- previous definition of `v` here +//! `---- diff --git a/crates/swc/tests/tsc-references/for-of52_es5.1.normal.js b/crates/swc/tests/tsc-references/for-of52_es5.1.normal.js index a292d724df1f..5fd66feaa485 100644 --- a/crates/swc/tests/tsc-references/for-of52_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/for-of52_es5.1.normal.js @@ -1,7 +1,8 @@ -//@target: ES6 -import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; -for(var _i = 0, _iter = [ - [] -]; _i < _iter.length; _i++){ - var __i = _sliced_to_array(_iter[_i], 2), v = __i[0], v = __i[1]; -} +//! +//! x the name `v` is defined multiple times +//! ,---- +//! 2 | for (let [v, v] of [[]]) {} +//! : | | +//! : | `-- `v` redefined here +//! : `-- previous definition of `v` here +//! `---- diff --git a/crates/swc/tests/tsc-references/for-of52_es5.2.minified.js b/crates/swc/tests/tsc-references/for-of52_es5.2.minified.js index 628aaedbd7fc..5fd66feaa485 100644 --- a/crates/swc/tests/tsc-references/for-of52_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/for-of52_es5.2.minified.js @@ -1,7 +1,8 @@ -import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; -for(var _i = 0, _iter = [ - [] -]; _i < _iter.length; _i++){ - var __i = _sliced_to_array(_iter[_i], 2); - __i[0], __i[1]; -} +//! +//! x the name `v` is defined multiple times +//! ,---- +//! 2 | for (let [v, v] of [[]]) {} +//! : | | +//! : | `-- `v` redefined here +//! : `-- previous definition of `v` here +//! `---- diff --git a/crates/swc/tests/tsc-references/for-of56_es2015.1.normal.js b/crates/swc/tests/tsc-references/for-of56_es2015.1.normal.js index ab71a721a687..5a4826522773 100644 --- a/crates/swc/tests/tsc-references/for-of56_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/for-of56_es2015.1.normal.js @@ -1,2 +1,12 @@ -//@target: ES6 -for (var let of []){} +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | for (var let of []) {} +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/for-of56_es2015.2.minified.js b/crates/swc/tests/tsc-references/for-of56_es2015.2.minified.js index b41503aa72f7..5a4826522773 100644 --- a/crates/swc/tests/tsc-references/for-of56_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/for-of56_es2015.2.minified.js @@ -1 +1,12 @@ -for (var let of []); +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | for (var let of []) {} +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/for-of56_es5.1.normal.js b/crates/swc/tests/tsc-references/for-of56_es5.1.normal.js index 21d4fe206e39..5a4826522773 100644 --- a/crates/swc/tests/tsc-references/for-of56_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/for-of56_es5.1.normal.js @@ -1,20 +1,12 @@ -var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined; -try { - //@target: ES6 - for(var _iterator = [][Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){ - var let = _step.value; - } -} catch (err) { - _didIteratorError = true; - _iteratorError = err; -} finally{ - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally{ - if (_didIteratorError) { - throw _iteratorError; - } - } -} +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | for (var let of []) {} +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/for-of56_es5.2.minified.js b/crates/swc/tests/tsc-references/for-of56_es5.2.minified.js index e83228516385..5a4826522773 100644 --- a/crates/swc/tests/tsc-references/for-of56_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/for-of56_es5.2.minified.js @@ -1,12 +1,12 @@ -var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0; -try { - for(var _step, _iterator = [][Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0)_step.value; -} catch (err) { - _didIteratorError = !0, _iteratorError = err; -} finally{ - try { - _iteratorNormalCompletion || null == _iterator.return || _iterator.return(); - } finally{ - if (_didIteratorError) throw _iteratorError; - } -} +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | for (var let of []) {} +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/functionNameConflicts_es2015.1.normal.js b/crates/swc/tests/tsc-references/functionNameConflicts_es2015.1.normal.js index 3d97b072d55a..1db5997ab809 100644 --- a/crates/swc/tests/tsc-references/functionNameConflicts_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/functionNameConflicts_es2015.1.normal.js @@ -1,18 +1,30 @@ -//Function and variable of the same name in same declaration space -//Function overload with different name from implementation signature -var M; -(function(M) { - function fn1() {} - var fn1; - var fn2; - function fn2() {} -})(M || (M = {})); -function fn3() {} -var fn3; -function func() { - var fn4; - function fn4() {} - function fn5() {} - var fn5; -} -function overrr() {} +//! +//! x the name `fn1` is defined multiple times +//! ,-[5:5] +//! 5 | function fn1() { } +//! : ^|^ +//! : `-- previous definition of `fn1` here +//! 6 | var fn1; +//! : ^|^ +//! : `-- `fn1` redefined here +//! `---- +//! +//! x the name `fn2` is defined multiple times +//! ,-[8:5] +//! 8 | var fn2; +//! : ^|^ +//! : `-- previous definition of `fn2` here +//! 9 | function fn2() { } +//! : ^|^ +//! : `-- `fn2` redefined here +//! `---- +//! +//! x the name `fn3` is defined multiple times +//! ,-[12:1] +//! 12 | function fn3() { } +//! : ^|^ +//! : `-- previous definition of `fn3` here +//! 13 | var fn3; +//! : ^|^ +//! : `-- `fn3` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/functionNameConflicts_es2015.2.minified.js b/crates/swc/tests/tsc-references/functionNameConflicts_es2015.2.minified.js index cf77a4b72fa5..1db5997ab809 100644 --- a/crates/swc/tests/tsc-references/functionNameConflicts_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/functionNameConflicts_es2015.2.minified.js @@ -1,2 +1,30 @@ -var M; -M || (M = {}); +//! +//! x the name `fn1` is defined multiple times +//! ,-[5:5] +//! 5 | function fn1() { } +//! : ^|^ +//! : `-- previous definition of `fn1` here +//! 6 | var fn1; +//! : ^|^ +//! : `-- `fn1` redefined here +//! `---- +//! +//! x the name `fn2` is defined multiple times +//! ,-[8:5] +//! 8 | var fn2; +//! : ^|^ +//! : `-- previous definition of `fn2` here +//! 9 | function fn2() { } +//! : ^|^ +//! : `-- `fn2` redefined here +//! `---- +//! +//! x the name `fn3` is defined multiple times +//! ,-[12:1] +//! 12 | function fn3() { } +//! : ^|^ +//! : `-- previous definition of `fn3` here +//! 13 | var fn3; +//! : ^|^ +//! : `-- `fn3` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/functionNameConflicts_es5.1.normal.js b/crates/swc/tests/tsc-references/functionNameConflicts_es5.1.normal.js index 5eb1ec8f8b27..1db5997ab809 100644 --- a/crates/swc/tests/tsc-references/functionNameConflicts_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/functionNameConflicts_es5.1.normal.js @@ -1,18 +1,30 @@ -//Function and variable of the same name in same declaration space -//Function overload with different name from implementation signature -var M; -(function(M) { - var fn1 = function fn1() {}; - var fn2 = function fn2() {}; - var fn1; - var fn2; -})(M || (M = {})); -function fn3() {} -var fn3; -function func() { - var fn4 = function fn4() {}; - var fn5 = function fn5() {}; - var fn4; - var fn5; -} -function overrr() {} +//! +//! x the name `fn1` is defined multiple times +//! ,-[5:5] +//! 5 | function fn1() { } +//! : ^|^ +//! : `-- previous definition of `fn1` here +//! 6 | var fn1; +//! : ^|^ +//! : `-- `fn1` redefined here +//! `---- +//! +//! x the name `fn2` is defined multiple times +//! ,-[8:5] +//! 8 | var fn2; +//! : ^|^ +//! : `-- previous definition of `fn2` here +//! 9 | function fn2() { } +//! : ^|^ +//! : `-- `fn2` redefined here +//! `---- +//! +//! x the name `fn3` is defined multiple times +//! ,-[12:1] +//! 12 | function fn3() { } +//! : ^|^ +//! : `-- previous definition of `fn3` here +//! 13 | var fn3; +//! : ^|^ +//! : `-- `fn3` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/functionNameConflicts_es5.2.minified.js b/crates/swc/tests/tsc-references/functionNameConflicts_es5.2.minified.js index cf77a4b72fa5..1db5997ab809 100644 --- a/crates/swc/tests/tsc-references/functionNameConflicts_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/functionNameConflicts_es5.2.minified.js @@ -1,2 +1,30 @@ -var M; -M || (M = {}); +//! +//! x the name `fn1` is defined multiple times +//! ,-[5:5] +//! 5 | function fn1() { } +//! : ^|^ +//! : `-- previous definition of `fn1` here +//! 6 | var fn1; +//! : ^|^ +//! : `-- `fn1` redefined here +//! `---- +//! +//! x the name `fn2` is defined multiple times +//! ,-[8:5] +//! 8 | var fn2; +//! : ^|^ +//! : `-- previous definition of `fn2` here +//! 9 | function fn2() { } +//! : ^|^ +//! : `-- `fn2` redefined here +//! `---- +//! +//! x the name `fn3` is defined multiple times +//! ,-[12:1] +//! 12 | function fn3() { } +//! : ^|^ +//! : `-- previous definition of `fn3` here +//! 13 | var fn3; +//! : ^|^ +//! : `-- `fn3` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/functionOverloadErrors_es2015.1.normal.js b/crates/swc/tests/tsc-references/functionOverloadErrors_es2015.1.normal.js new file mode 100644 index 000000000000..3747e6c0755b --- /dev/null +++ b/crates/swc/tests/tsc-references/functionOverloadErrors_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 2 | function fn1(x = 3); +//! : ^^^^^ +//! `---- +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 116 | function initExpr(n = 13); +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/functionOverloadErrors_es2015.2.minified.js b/crates/swc/tests/tsc-references/functionOverloadErrors_es2015.2.minified.js new file mode 100644 index 000000000000..3747e6c0755b --- /dev/null +++ b/crates/swc/tests/tsc-references/functionOverloadErrors_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 2 | function fn1(x = 3); +//! : ^^^^^ +//! `---- +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 116 | function initExpr(n = 13); +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/functionOverloadErrors_es5.1.normal.js b/crates/swc/tests/tsc-references/functionOverloadErrors_es5.1.normal.js new file mode 100644 index 000000000000..3747e6c0755b --- /dev/null +++ b/crates/swc/tests/tsc-references/functionOverloadErrors_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 2 | function fn1(x = 3); +//! : ^^^^^ +//! `---- +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 116 | function initExpr(n = 13); +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/functionOverloadErrors_es5.2.minified.js b/crates/swc/tests/tsc-references/functionOverloadErrors_es5.2.minified.js new file mode 100644 index 000000000000..3747e6c0755b --- /dev/null +++ b/crates/swc/tests/tsc-references/functionOverloadErrors_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 2 | function fn1(x = 3); +//! : ^^^^^ +//! `---- +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 116 | function initExpr(n = 13); +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/generatorTypeCheck38_es2015.1.normal.js b/crates/swc/tests/tsc-references/generatorTypeCheck38_es2015.1.normal.js new file mode 100644 index 000000000000..ece43a431147 --- /dev/null +++ b/crates/swc/tests/tsc-references/generatorTypeCheck38_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | var yield; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/generatorTypeCheck38_es2015.2.minified.js b/crates/swc/tests/tsc-references/generatorTypeCheck38_es2015.2.minified.js new file mode 100644 index 000000000000..ece43a431147 --- /dev/null +++ b/crates/swc/tests/tsc-references/generatorTypeCheck38_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | var yield; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/generatorTypeCheck38_es5.1.normal.js b/crates/swc/tests/tsc-references/generatorTypeCheck38_es5.1.normal.js new file mode 100644 index 000000000000..ece43a431147 --- /dev/null +++ b/crates/swc/tests/tsc-references/generatorTypeCheck38_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | var yield; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/generatorTypeCheck38_es5.2.minified.js b/crates/swc/tests/tsc-references/generatorTypeCheck38_es5.2.minified.js new file mode 100644 index 000000000000..ece43a431147 --- /dev/null +++ b/crates/swc/tests/tsc-references/generatorTypeCheck38_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | var yield; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/generic_es2015.1.normal.js b/crates/swc/tests/tsc-references/generic_es2015.1.normal.js index a0798cddc67e..9ebdde4b3c38 100644 --- a/crates/swc/tests/tsc-references/generic_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/generic_es2015.1.normal.js @@ -1,6 +1,7 @@ // @Filename: /a.ts export class A { } +// @Filename: /b.ts let a = { a: "" }; @@ -11,3 +12,4 @@ let c = {}; let d = { a: "" }; +export { }; diff --git a/crates/swc/tests/tsc-references/generic_es2015.2.minified.js b/crates/swc/tests/tsc-references/generic_es2015.2.minified.js index 4a17f4af9fc7..95b1242eacaa 100644 --- a/crates/swc/tests/tsc-references/generic_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/generic_es2015.2.minified.js @@ -1,2 +1,3 @@ export class A { } +export { }; diff --git a/crates/swc/tests/tsc-references/generic_es5.1.normal.js b/crates/swc/tests/tsc-references/generic_es5.1.normal.js index c05326243b00..47a94abc4a53 100644 --- a/crates/swc/tests/tsc-references/generic_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/generic_es5.1.normal.js @@ -4,6 +4,7 @@ export var A = function A() { "use strict"; _class_call_check(this, A); }; +// @Filename: /b.ts var a = { a: "" }; @@ -14,3 +15,4 @@ var c = {}; var d = { a: "" }; +export { }; diff --git a/crates/swc/tests/tsc-references/generic_es5.2.minified.js b/crates/swc/tests/tsc-references/generic_es5.2.minified.js index eed7ca896ebd..6845732041ee 100644 --- a/crates/swc/tests/tsc-references/generic_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/generic_es5.2.minified.js @@ -3,3 +3,4 @@ export var A = function() { "use strict"; _class_call_check(this, A); }; +export { }; diff --git a/crates/swc/tests/tsc-references/globalThisVarDeclaration_es2015.2.minified.js b/crates/swc/tests/tsc-references/globalThisVarDeclaration_es2015.2.minified.js index a90e68a45f03..06ccfa8302a6 100644 --- a/crates/swc/tests/tsc-references/globalThisVarDeclaration_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/globalThisVarDeclaration_es2015.2.minified.js @@ -1 +1,2 @@ -this.a, this.b, self.a, self.b, window.a, window.b, top.a, top.b, this.a, this.b, self.a, self.b, window.a, window.b, top.a, top.b; +this.a, this.b, self.a, self.b, window.a, window.b, top.a, top.b; +this.a, this.b, self.a, self.b, window.a, window.b, top.a, top.b; diff --git a/crates/swc/tests/tsc-references/globalThisVarDeclaration_es5.2.minified.js b/crates/swc/tests/tsc-references/globalThisVarDeclaration_es5.2.minified.js index a90e68a45f03..06ccfa8302a6 100644 --- a/crates/swc/tests/tsc-references/globalThisVarDeclaration_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/globalThisVarDeclaration_es5.2.minified.js @@ -1 +1,2 @@ -this.a, this.b, self.a, self.b, window.a, window.b, top.a, top.b, this.a, this.b, self.a, self.b, window.a, window.b, top.a, top.b; +this.a, this.b, self.a, self.b, window.a, window.b, top.a, top.b; +this.a, this.b, self.a, self.b, window.a, window.b, top.a, top.b; diff --git a/crates/swc/tests/tsc-references/implementsClause_es2015.1.normal.js b/crates/swc/tests/tsc-references/implementsClause_es2015.1.normal.js index e0f44220f5d8..8f3058c763d0 100644 --- a/crates/swc/tests/tsc-references/implementsClause_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/implementsClause_es2015.1.normal.js @@ -1,4 +1,8 @@ // @Filename: types.ts +export { }; +// @Filename: ns.ts +export { }; +// @Filename: index.ts class C { } class D { diff --git a/crates/swc/tests/tsc-references/implementsClause_es2015.2.minified.js b/crates/swc/tests/tsc-references/implementsClause_es2015.2.minified.js index 2234b9cae16d..f109f4c5600e 100644 --- a/crates/swc/tests/tsc-references/implementsClause_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/implementsClause_es2015.2.minified.js @@ -1 +1,3 @@ export { }; +export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/implementsClause_es5.1.normal.js b/crates/swc/tests/tsc-references/implementsClause_es5.1.normal.js index 56324d24685c..5d3916d9f541 100644 --- a/crates/swc/tests/tsc-references/implementsClause_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/implementsClause_es5.1.normal.js @@ -1,4 +1,8 @@ // @Filename: types.ts +export { }; +// @Filename: ns.ts +export { }; +// @Filename: index.ts import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var C = function C() { "use strict"; diff --git a/crates/swc/tests/tsc-references/implementsClause_es5.2.minified.js b/crates/swc/tests/tsc-references/implementsClause_es5.2.minified.js index b1d9b8780f44..8970815a1c41 100644 --- a/crates/swc/tests/tsc-references/implementsClause_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/implementsClause_es5.2.minified.js @@ -1,3 +1,5 @@ +export { }; +export { }; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var C = function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/importAssertion2_es2015.1.normal.js b/crates/swc/tests/tsc-references/importAssertion2_es2015.1.normal.js index aad28f28f51b..1e987484dffa 100644 --- a/crates/swc/tests/tsc-references/importAssertion2_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importAssertion2_es2015.1.normal.js @@ -4,6 +4,7 @@ // @filename: 0.ts export const a = 1; export const b = 2; +// @filename: 1.ts export { a, b } from './0'; export * from './0'; import * as _ns from './0'; diff --git a/crates/swc/tests/tsc-references/importAssertion2_es2015.2.minified.js b/crates/swc/tests/tsc-references/importAssertion2_es2015.2.minified.js index b121bbe0eb6a..3038348552be 100644 --- a/crates/swc/tests/tsc-references/importAssertion2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importAssertion2_es2015.2.minified.js @@ -3,6 +3,6 @@ export const b = 2; export { a, b } from './0'; export * from './0'; import * as _ns from './0'; +export { _ns as ns }; export { a, b } from './0'; export { a as c, b as d } from './0'; -export { _ns as ns }; diff --git a/crates/swc/tests/tsc-references/importAssertion2_es5.1.normal.js b/crates/swc/tests/tsc-references/importAssertion2_es5.1.normal.js index aa962a7e8af9..385d30333fb7 100644 --- a/crates/swc/tests/tsc-references/importAssertion2_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importAssertion2_es5.1.normal.js @@ -4,6 +4,7 @@ // @filename: 0.ts export var a = 1; export var b = 2; +// @filename: 1.ts export { a, b } from "./0"; export * from "./0"; import * as _ns from "./0"; diff --git a/crates/swc/tests/tsc-references/importAssertion2_es5.2.minified.js b/crates/swc/tests/tsc-references/importAssertion2_es5.2.minified.js index 173baa53f3cc..5872bbc24b9e 100644 --- a/crates/swc/tests/tsc-references/importAssertion2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importAssertion2_es5.2.minified.js @@ -3,6 +3,6 @@ export var b = 2; export { a, b } from "./0"; export * from "./0"; import * as _ns from "./0"; +export { _ns as ns }; export { a, b } from "./0"; export { a as c, b as d } from "./0"; -export { _ns as ns }; diff --git a/crates/swc/tests/tsc-references/importAssertion3_es2015.1.normal.js b/crates/swc/tests/tsc-references/importAssertion3_es2015.1.normal.js index f3b38f158733..8999bb9ba0d9 100644 --- a/crates/swc/tests/tsc-references/importAssertion3_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importAssertion3_es2015.1.normal.js @@ -3,3 +3,7 @@ // @module: es2015, esnext // @filename: 0.ts export { }; +// @filename: 1.ts +export { }; +// @filename: 2.ts +export { }; diff --git a/crates/swc/tests/tsc-references/importAssertion3_es2015.2.minified.js b/crates/swc/tests/tsc-references/importAssertion3_es2015.2.minified.js index 2234b9cae16d..f109f4c5600e 100644 --- a/crates/swc/tests/tsc-references/importAssertion3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importAssertion3_es2015.2.minified.js @@ -1 +1,3 @@ export { }; +export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/importAssertion3_es5.1.normal.js b/crates/swc/tests/tsc-references/importAssertion3_es5.1.normal.js index f3b38f158733..8999bb9ba0d9 100644 --- a/crates/swc/tests/tsc-references/importAssertion3_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importAssertion3_es5.1.normal.js @@ -3,3 +3,7 @@ // @module: es2015, esnext // @filename: 0.ts export { }; +// @filename: 1.ts +export { }; +// @filename: 2.ts +export { }; diff --git a/crates/swc/tests/tsc-references/importAssertion3_es5.2.minified.js b/crates/swc/tests/tsc-references/importAssertion3_es5.2.minified.js index 2234b9cae16d..f109f4c5600e 100644 --- a/crates/swc/tests/tsc-references/importAssertion3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importAssertion3_es5.2.minified.js @@ -1 +1,3 @@ export { }; +export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/importCallExpression3ES2020_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpression3ES2020_es2015.1.normal.js index 06523ba96a59..5066222dc3c9 100644 --- a/crates/swc/tests/tsc-references/importCallExpression3ES2020_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpression3ES2020_es2015.1.normal.js @@ -1,18 +1,18 @@ // @module: es2020 // @target: es2020 // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class B { print() { return "I am B"; } } +// @filename: 2.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: 2.ts - _async_to_generator(function*() { + _foo = _async_to_generator(function*() { class C extends (yield import("./0")).B { } var c = new C(); diff --git a/crates/swc/tests/tsc-references/importCallExpression3ES2020_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpression3ES2020_es2015.2.minified.js index 911c1b8804f6..587ad9da14d3 100644 --- a/crates/swc/tests/tsc-references/importCallExpression3ES2020_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpression3ES2020_es2015.2.minified.js @@ -1,9 +1,9 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class B { print() { return "I am B"; } } +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function _foo() { return (_foo = _async_to_generator(function*() { class C extends (yield import("./0")).B { diff --git a/crates/swc/tests/tsc-references/importCallExpression3ES2020_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpression3ES2020_es5.1.normal.js index 7ce289e56409..d4aedb7dc44d 100644 --- a/crates/swc/tests/tsc-references/importCallExpression3ES2020_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpression3ES2020_es5.1.normal.js @@ -1,11 +1,7 @@ // @module: es2020 // @target: es2020 // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var B = /*#__PURE__*/ function() { "use strict"; function B() { @@ -17,12 +13,17 @@ export var B = /*#__PURE__*/ function() { }; return B; }(); +// @filename: 2.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: 2.ts - _async_to_generator(regeneratorRuntime.mark(function _callee() { + _foo = _async_to_generator(regeneratorRuntime.mark(function _callee() { var C, c; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ diff --git a/crates/swc/tests/tsc-references/importCallExpression3ES2020_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpression3ES2020_es5.2.minified.js index 622553ec4998..27b173373359 100644 --- a/crates/swc/tests/tsc-references/importCallExpression3ES2020_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpression3ES2020_es5.2.minified.js @@ -1,8 +1,4 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var B = function() { "use strict"; function B() { @@ -12,6 +8,11 @@ export var B = function() { return "I am B"; }, B; }(); +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function _foo() { return (_foo = _async_to_generator(regeneratorRuntime.mark(function _callee() { var C, c; diff --git a/crates/swc/tests/tsc-references/importCallExpression4ES2020_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpression4ES2020_es2015.1.normal.js index 20dd1d486fb8..47d895e7e945 100644 --- a/crates/swc/tests/tsc-references/importCallExpression4ES2020_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpression4ES2020_es2015.1.normal.js @@ -2,7 +2,6 @@ // @module: es2020 // @target: es2020 // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class B { print() { return "I am B"; @@ -15,6 +14,8 @@ export function foo() { export function backup() { return "backup"; } +// @filename: 2.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; class C { method() { const loadAsync = import("./0"); diff --git a/crates/swc/tests/tsc-references/importCallExpression4ES2020_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpression4ES2020_es2015.2.minified.js index 3eb198ed5934..2e1781f4286f 100644 --- a/crates/swc/tests/tsc-references/importCallExpression4ES2020_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpression4ES2020_es2015.2.minified.js @@ -1,4 +1,3 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class B { print() { return "I am B"; @@ -10,3 +9,4 @@ export function foo() { export function backup() { return "backup"; } +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/importCallExpression4ES2020_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpression4ES2020_es5.1.normal.js index 0c56d770e70e..b507d5e59866 100644 --- a/crates/swc/tests/tsc-references/importCallExpression4ES2020_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpression4ES2020_es5.1.normal.js @@ -2,9 +2,7 @@ // @module: es2020 // @target: es2020 // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var B = /*#__PURE__*/ function() { "use strict"; function B() { @@ -23,6 +21,10 @@ export function foo() { export function backup() { return "backup"; } +// @filename: 2.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/importCallExpression4ES2020_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpression4ES2020_es5.2.minified.js index 940b5e30ea9c..197709aa2345 100644 --- a/crates/swc/tests/tsc-references/importCallExpression4ES2020_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpression4ES2020_es5.2.minified.js @@ -1,6 +1,4 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var B = function() { "use strict"; function B() { @@ -16,6 +14,9 @@ export function foo() { export function backup() { return "backup"; } +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C = function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/importCallExpression5ES2020_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpression5ES2020_es2015.1.normal.js index a0ff0617e190..ebd584b07099 100644 --- a/crates/swc/tests/tsc-references/importCallExpression5ES2020_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpression5ES2020_es2015.1.normal.js @@ -14,6 +14,7 @@ export function foo() { export function backup() { return "backup"; } +// @filename: 2.ts const specify = bar() ? "./0" : undefined; let myModule = import(specify); let myModule1 = import(undefined); diff --git a/crates/swc/tests/tsc-references/importCallExpression5ES2020_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpression5ES2020_es2015.2.minified.js index af5f0fd430fb..dcd65150bab3 100644 --- a/crates/swc/tests/tsc-references/importCallExpression5ES2020_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpression5ES2020_es2015.2.minified.js @@ -9,5 +9,5 @@ export function foo() { export function backup() { return "backup"; } -let specify = bar() ? "./0" : void 0; +const specify = bar() ? "./0" : void 0; import(specify), import(void 0), import(bar() ? "./1" : null), import(null); diff --git a/crates/swc/tests/tsc-references/importCallExpression5ES2020_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpression5ES2020_es5.1.normal.js index 1bac260f9693..eaf50c8d4d69 100644 --- a/crates/swc/tests/tsc-references/importCallExpression5ES2020_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpression5ES2020_es5.1.normal.js @@ -21,6 +21,7 @@ export function foo() { export function backup() { return "backup"; } +// @filename: 2.ts var specify = bar() ? "./0" : undefined; var myModule = import(specify); var myModule1 = import(undefined); diff --git a/crates/swc/tests/tsc-references/importCallExpression6ES2020_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpression6ES2020_es2015.1.normal.js index e468c98cadcf..8d33a3238df8 100644 --- a/crates/swc/tests/tsc-references/importCallExpression6ES2020_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpression6ES2020_es2015.1.normal.js @@ -13,6 +13,7 @@ export function foo() { export function backup() { return "backup"; } +// @filename: 2.ts const specify = bar() ? "./0" : undefined; let myModule = import(specify); let myModule1 = import(undefined); diff --git a/crates/swc/tests/tsc-references/importCallExpression6ES2020_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpression6ES2020_es2015.2.minified.js index af5f0fd430fb..dcd65150bab3 100644 --- a/crates/swc/tests/tsc-references/importCallExpression6ES2020_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpression6ES2020_es2015.2.minified.js @@ -9,5 +9,5 @@ export function foo() { export function backup() { return "backup"; } -let specify = bar() ? "./0" : void 0; +const specify = bar() ? "./0" : void 0; import(specify), import(void 0), import(bar() ? "./1" : null), import(null); diff --git a/crates/swc/tests/tsc-references/importCallExpression6ES2020_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpression6ES2020_es5.1.normal.js index 34e5356c648b..935feafc7427 100644 --- a/crates/swc/tests/tsc-references/importCallExpression6ES2020_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpression6ES2020_es5.1.normal.js @@ -20,6 +20,7 @@ export function foo() { export function backup() { return "backup"; } +// @filename: 2.ts var specify = bar() ? "./0" : undefined; var myModule = import(specify); var myModule1 = import(undefined); diff --git a/crates/swc/tests/tsc-references/importCallExpressionCheckReturntype1_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionCheckReturntype1_es2015.1.normal.js index de62ad3f4430..682bb89538ff 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionCheckReturntype1_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionCheckReturntype1_es2015.1.normal.js @@ -7,6 +7,8 @@ export class D { // @filename: defaultPath.ts export class C { } +// @filename: 1.ts let p1 = import("./defaultPath"); let p2 = import("./defaultPath"); let p3 = import("./defaultPath"); +export { }; diff --git a/crates/swc/tests/tsc-references/importCallExpressionCheckReturntype1_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionCheckReturntype1_es2015.2.minified.js index f84d920d95a6..e6bd82862e55 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionCheckReturntype1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionCheckReturntype1_es2015.2.minified.js @@ -3,3 +3,4 @@ export class D { export class C { } import("./defaultPath"), import("./defaultPath"), import("./defaultPath"); +export { }; diff --git a/crates/swc/tests/tsc-references/importCallExpressionCheckReturntype1_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionCheckReturntype1_es5.1.normal.js index a50567b652bc..b9df7ab08e5f 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionCheckReturntype1_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionCheckReturntype1_es5.1.normal.js @@ -8,10 +8,13 @@ export var D = function D() { _class_call_check(this, D); }; // @filename: defaultPath.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export var C = function C() { "use strict"; _class_call_check(this, C); }; +// @filename: 1.ts var p1 = import("./defaultPath"); var p2 = import("./defaultPath"); var p3 = import("./defaultPath"); +export { }; diff --git a/crates/swc/tests/tsc-references/importCallExpressionCheckReturntype1_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionCheckReturntype1_es5.2.minified.js index 622c684b1c91..af9cf3587b3b 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionCheckReturntype1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionCheckReturntype1_es5.2.minified.js @@ -3,8 +3,10 @@ export var D = function() { "use strict"; _class_call_check(this, D); }; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export var C = function() { "use strict"; _class_call_check(this, C); }; import("./defaultPath"), import("./defaultPath"), import("./defaultPath"); +export { }; diff --git a/crates/swc/tests/tsc-references/importCallExpressionDeclarationEmit3_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionDeclarationEmit3_es2015.1.normal.js index 1feea8e2e53e..25234b15011f 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionDeclarationEmit3_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionDeclarationEmit3_es2015.1.normal.js @@ -5,6 +5,7 @@ export function foo() { return "foo"; } +// @filename: 1.ts import("./0"); export var p0 = import(getPath()); export var p1 = import("./0"); diff --git a/crates/swc/tests/tsc-references/importCallExpressionDeclarationEmit3_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionDeclarationEmit3_es5.1.normal.js index 1feea8e2e53e..25234b15011f 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionDeclarationEmit3_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionDeclarationEmit3_es5.1.normal.js @@ -5,6 +5,7 @@ export function foo() { return "foo"; } +// @filename: 1.ts import("./0"); export var p0 = import(getPath()); export var p1 = import("./0"); diff --git a/crates/swc/tests/tsc-references/importCallExpressionES5AMD_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionES5AMD_es5.1.normal.js index 6c45ce795c32..97ba5415420a 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionES5AMD_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionES5AMD_es5.1.normal.js @@ -2,12 +2,12 @@ // @target: es5 // @lib: es6 // @filename: 0.ts -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export function foo() { return "foo"; } // @filename: 1.ts import("./0"); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var p1 = import("./0"); p1.then(function(zero) { return zero.foo(); diff --git a/crates/swc/tests/tsc-references/importCallExpressionES5AMD_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionES5AMD_es5.2.minified.js index ce0188bae2aa..f80e0190a3eb 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionES5AMD_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionES5AMD_es5.2.minified.js @@ -1,8 +1,9 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export function foo() { return "foo"; } -import("./0"), import("./0").then(function(zero) { +import("./0"); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import("./0").then(function(zero) { return zero.foo(); }); export var p2 = import("./0"); diff --git a/crates/swc/tests/tsc-references/importCallExpressionES5CJS_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionES5CJS_es5.1.normal.js index e60e3ce85e60..8a8fde469365 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionES5CJS_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionES5CJS_es5.1.normal.js @@ -2,12 +2,12 @@ // @target: es5 // @lib: es6 // @filename: 0.ts -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export function foo() { return "foo"; } // @filename: 1.ts import("./0"); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var p1 = import("./0"); p1.then(function(zero) { return zero.foo(); diff --git a/crates/swc/tests/tsc-references/importCallExpressionES5CJS_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionES5CJS_es5.2.minified.js index ce0188bae2aa..f80e0190a3eb 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionES5CJS_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionES5CJS_es5.2.minified.js @@ -1,8 +1,9 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export function foo() { return "foo"; } -import("./0"), import("./0").then(function(zero) { +import("./0"); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import("./0").then(function(zero) { return zero.foo(); }); export var p2 = import("./0"); diff --git a/crates/swc/tests/tsc-references/importCallExpressionES5System_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionES5System_es5.1.normal.js index f1c027a60b69..3e77dddbcf65 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionES5System_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionES5System_es5.1.normal.js @@ -2,12 +2,12 @@ // @target: es5 // @lib: es6 // @filename: 0.ts -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export function foo() { return "foo"; } // @filename: 1.ts import("./0"); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var p1 = import("./0"); p1.then(function(zero) { return zero.foo(); diff --git a/crates/swc/tests/tsc-references/importCallExpressionES5System_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionES5System_es5.2.minified.js index ce0188bae2aa..f80e0190a3eb 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionES5System_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionES5System_es5.2.minified.js @@ -1,8 +1,9 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export function foo() { return "foo"; } -import("./0"), import("./0").then(function(zero) { +import("./0"); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import("./0").then(function(zero) { return zero.foo(); }); export var p2 = import("./0"); diff --git a/crates/swc/tests/tsc-references/importCallExpressionES5UMD_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionES5UMD_es5.1.normal.js index 548df485eda0..ed27672f5892 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionES5UMD_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionES5UMD_es5.1.normal.js @@ -2,12 +2,12 @@ // @target: es5 // @lib: es6 // @filename: 0.ts -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export function foo() { return "foo"; } // @filename: 1.ts import("./0"); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var p1 = import("./0"); p1.then(function(zero) { return zero.foo(); diff --git a/crates/swc/tests/tsc-references/importCallExpressionES5UMD_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionES5UMD_es5.2.minified.js index ce0188bae2aa..f80e0190a3eb 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionES5UMD_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionES5UMD_es5.2.minified.js @@ -1,8 +1,9 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export function foo() { return "foo"; } -import("./0"), import("./0").then(function(zero) { +import("./0"); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import("./0").then(function(zero) { return zero.foo(); }); export var p2 = import("./0"); diff --git a/crates/swc/tests/tsc-references/importCallExpressionES6AMD_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionES6AMD_es5.1.normal.js index 0b17219eb837..ecb1e5eec592 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionES6AMD_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionES6AMD_es5.1.normal.js @@ -1,12 +1,12 @@ // @module: amd // @target: es6 // @filename: 0.ts -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export function foo() { return "foo"; } // @filename: 1.ts import("./0"); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var p1 = import("./0"); p1.then(function(zero) { return zero.foo(); diff --git a/crates/swc/tests/tsc-references/importCallExpressionES6AMD_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionES6AMD_es5.2.minified.js index ce0188bae2aa..f80e0190a3eb 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionES6AMD_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionES6AMD_es5.2.minified.js @@ -1,8 +1,9 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export function foo() { return "foo"; } -import("./0"), import("./0").then(function(zero) { +import("./0"); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import("./0").then(function(zero) { return zero.foo(); }); export var p2 = import("./0"); diff --git a/crates/swc/tests/tsc-references/importCallExpressionES6CJS_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionES6CJS_es5.1.normal.js index a47678622025..c55abf577856 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionES6CJS_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionES6CJS_es5.1.normal.js @@ -1,12 +1,12 @@ // @module: commonjs // @target: es6 // @filename: 0.ts -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export function foo() { return "foo"; } // @filename: 1.ts import("./0"); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var p1 = import("./0"); p1.then(function(zero) { return zero.foo(); diff --git a/crates/swc/tests/tsc-references/importCallExpressionES6CJS_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionES6CJS_es5.2.minified.js index ce0188bae2aa..f80e0190a3eb 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionES6CJS_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionES6CJS_es5.2.minified.js @@ -1,8 +1,9 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export function foo() { return "foo"; } -import("./0"), import("./0").then(function(zero) { +import("./0"); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import("./0").then(function(zero) { return zero.foo(); }); export var p2 = import("./0"); diff --git a/crates/swc/tests/tsc-references/importCallExpressionES6System_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionES6System_es5.1.normal.js index 9f27ef3b640a..908c6098177f 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionES6System_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionES6System_es5.1.normal.js @@ -1,12 +1,12 @@ // @module: system // @target: es6 // @filename: 0.ts -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export function foo() { return "foo"; } // @filename: 1.ts import("./0"); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var p1 = import("./0"); p1.then(function(zero) { return zero.foo(); diff --git a/crates/swc/tests/tsc-references/importCallExpressionES6System_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionES6System_es5.2.minified.js index ce0188bae2aa..f80e0190a3eb 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionES6System_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionES6System_es5.2.minified.js @@ -1,8 +1,9 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export function foo() { return "foo"; } -import("./0"), import("./0").then(function(zero) { +import("./0"); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import("./0").then(function(zero) { return zero.foo(); }); export var p2 = import("./0"); diff --git a/crates/swc/tests/tsc-references/importCallExpressionES6UMD_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionES6UMD_es5.1.normal.js index 7cf647247b7b..6861fe0e711c 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionES6UMD_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionES6UMD_es5.1.normal.js @@ -1,12 +1,12 @@ // @module: umd // @target: es6 // @filename: 0.ts -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export function foo() { return "foo"; } // @filename: 1.ts import("./0"); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var p1 = import("./0"); p1.then(function(zero) { return zero.foo(); diff --git a/crates/swc/tests/tsc-references/importCallExpressionES6UMD_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionES6UMD_es5.2.minified.js index ce0188bae2aa..f80e0190a3eb 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionES6UMD_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionES6UMD_es5.2.minified.js @@ -1,8 +1,9 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export function foo() { return "foo"; } -import("./0"), import("./0").then(function(zero) { +import("./0"); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import("./0").then(function(zero) { return zero.foo(); }); export var p2 = import("./0"); diff --git a/crates/swc/tests/tsc-references/importCallExpressionInAMD3_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInAMD3_es2015.1.normal.js index 83383177cf5e..6ed84a52de65 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInAMD3_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInAMD3_es2015.1.normal.js @@ -1,18 +1,18 @@ // @module: amd // @target: esnext // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class B { print() { return "I am B"; } } +// @filename: 2.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: 2.ts - _async_to_generator(function*() { + _foo = _async_to_generator(function*() { class C extends (yield import("./0")).B { } var c = new C(); diff --git a/crates/swc/tests/tsc-references/importCallExpressionInAMD3_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInAMD3_es2015.2.minified.js index 911c1b8804f6..587ad9da14d3 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInAMD3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInAMD3_es2015.2.minified.js @@ -1,9 +1,9 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class B { print() { return "I am B"; } } +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function _foo() { return (_foo = _async_to_generator(function*() { class C extends (yield import("./0")).B { diff --git a/crates/swc/tests/tsc-references/importCallExpressionInAMD3_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInAMD3_es5.1.normal.js index a0b7bba50e68..244d61e144d7 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInAMD3_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInAMD3_es5.1.normal.js @@ -1,11 +1,7 @@ // @module: amd // @target: esnext // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var B = /*#__PURE__*/ function() { "use strict"; function B() { @@ -17,12 +13,17 @@ export var B = /*#__PURE__*/ function() { }; return B; }(); +// @filename: 2.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: 2.ts - _async_to_generator(regeneratorRuntime.mark(function _callee() { + _foo = _async_to_generator(regeneratorRuntime.mark(function _callee() { var C, c; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ diff --git a/crates/swc/tests/tsc-references/importCallExpressionInAMD3_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInAMD3_es5.2.minified.js index 622553ec4998..27b173373359 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInAMD3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInAMD3_es5.2.minified.js @@ -1,8 +1,4 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var B = function() { "use strict"; function B() { @@ -12,6 +8,11 @@ export var B = function() { return "I am B"; }, B; }(); +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function _foo() { return (_foo = _async_to_generator(regeneratorRuntime.mark(function _callee() { var C, c; diff --git a/crates/swc/tests/tsc-references/importCallExpressionInAMD4_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInAMD4_es2015.1.normal.js index 0f56bdec7ccd..c692817802a5 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInAMD4_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInAMD4_es2015.1.normal.js @@ -2,7 +2,6 @@ // @target: esnext // @useDefineForClassFields: false // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class B { print() { return "I am B"; @@ -15,6 +14,8 @@ export function foo() { export function backup() { return "backup"; } +// @filename: 2.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; class C { method() { const loadAsync = import("./0"); diff --git a/crates/swc/tests/tsc-references/importCallExpressionInAMD4_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInAMD4_es2015.2.minified.js index 6ad9c76ea695..5ef9cdfc4cab 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInAMD4_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInAMD4_es2015.2.minified.js @@ -1,4 +1,3 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class B { print() { return "I am B"; @@ -10,6 +9,7 @@ export function foo() { export function backup() { return "backup"; } +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class D { method() { var _ref; diff --git a/crates/swc/tests/tsc-references/importCallExpressionInAMD4_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInAMD4_es5.1.normal.js index f8880d6b0b80..5c45b04c7f3a 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInAMD4_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInAMD4_es5.1.normal.js @@ -2,9 +2,7 @@ // @target: esnext // @useDefineForClassFields: false // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var B = /*#__PURE__*/ function() { "use strict"; function B() { @@ -23,6 +21,10 @@ export function foo() { export function backup() { return "backup"; } +// @filename: 2.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/importCallExpressionInAMD4_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInAMD4_es5.2.minified.js index 11f5eb40acf7..e3d755642f78 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInAMD4_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInAMD4_es5.2.minified.js @@ -1,6 +1,4 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var B = function() { "use strict"; function B() { @@ -16,6 +14,9 @@ export function foo() { export function backup() { return "backup"; } +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C = function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/importCallExpressionInCJS2_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInCJS2_es2015.1.normal.js index 5a2efd71aa15..362804183c0d 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInCJS2_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInCJS2_es2015.1.normal.js @@ -1,7 +1,6 @@ // @module: commonjs // @target: esnext // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export function foo() { return "foo"; } @@ -9,12 +8,13 @@ export function foo() { export function backup() { return "backup"; } +// @filename: 2.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function compute(promise) { return _compute.apply(this, arguments); } function _compute() { - _compute = // @filename: 2.ts - _async_to_generator(function*(promise) { + _compute = _async_to_generator(function*(promise) { let j = yield promise; if (!j) { j = yield import("./1"); diff --git a/crates/swc/tests/tsc-references/importCallExpressionInCJS2_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInCJS2_es2015.2.minified.js index 097948c88403..3722b67c8f0b 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInCJS2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInCJS2_es2015.2.minified.js @@ -1,10 +1,10 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export function foo() { return "foo"; } export function backup() { return "backup"; } +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function _compute() { return (_compute = _async_to_generator(function*(promise) { let j = yield promise; diff --git a/crates/swc/tests/tsc-references/importCallExpressionInCJS2_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInCJS2_es5.1.normal.js index 216fba66ec18..092434018b3c 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInCJS2_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInCJS2_es5.1.normal.js @@ -1,8 +1,6 @@ // @module: commonjs // @target: esnext // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export function foo() { return "foo"; } @@ -10,12 +8,14 @@ export function foo() { export function backup() { return "backup"; } +// @filename: 2.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function compute(promise) { return _compute.apply(this, arguments); } function _compute() { - _compute = // @filename: 2.ts - _async_to_generator(regeneratorRuntime.mark(function _callee(promise) { + _compute = _async_to_generator(regeneratorRuntime.mark(function _callee(promise) { var j; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ diff --git a/crates/swc/tests/tsc-references/importCallExpressionInCJS2_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInCJS2_es5.2.minified.js index df921408d9cb..9066ab713fea 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInCJS2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInCJS2_es5.2.minified.js @@ -1,11 +1,11 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export function foo() { return "foo"; } export function backup() { return "backup"; } +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function _compute() { return (_compute = _async_to_generator(regeneratorRuntime.mark(function _callee(promise) { var j; diff --git a/crates/swc/tests/tsc-references/importCallExpressionInCJS4_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInCJS4_es2015.1.normal.js index debd6de8fc62..30c1140406ea 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInCJS4_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInCJS4_es2015.1.normal.js @@ -1,18 +1,18 @@ // @module: commonjs // @target: esnext // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class B { print() { return "I am B"; } } +// @filename: 2.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: 2.ts - _async_to_generator(function*() { + _foo = _async_to_generator(function*() { class C extends (yield import("./0")).B { } var c = new C(); diff --git a/crates/swc/tests/tsc-references/importCallExpressionInCJS4_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInCJS4_es2015.2.minified.js index 911c1b8804f6..587ad9da14d3 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInCJS4_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInCJS4_es2015.2.minified.js @@ -1,9 +1,9 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class B { print() { return "I am B"; } } +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function _foo() { return (_foo = _async_to_generator(function*() { class C extends (yield import("./0")).B { diff --git a/crates/swc/tests/tsc-references/importCallExpressionInCJS4_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInCJS4_es5.1.normal.js index d5b034c9613f..2e5d854f91e6 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInCJS4_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInCJS4_es5.1.normal.js @@ -1,11 +1,7 @@ // @module: commonjs // @target: esnext // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var B = /*#__PURE__*/ function() { "use strict"; function B() { @@ -17,12 +13,17 @@ export var B = /*#__PURE__*/ function() { }; return B; }(); +// @filename: 2.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: 2.ts - _async_to_generator(regeneratorRuntime.mark(function _callee() { + _foo = _async_to_generator(regeneratorRuntime.mark(function _callee() { var C, c; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ diff --git a/crates/swc/tests/tsc-references/importCallExpressionInCJS4_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInCJS4_es5.2.minified.js index 622553ec4998..27b173373359 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInCJS4_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInCJS4_es5.2.minified.js @@ -1,8 +1,4 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var B = function() { "use strict"; function B() { @@ -12,6 +8,11 @@ export var B = function() { return "I am B"; }, B; }(); +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function _foo() { return (_foo = _async_to_generator(regeneratorRuntime.mark(function _callee() { var C, c; diff --git a/crates/swc/tests/tsc-references/importCallExpressionInCJS5_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInCJS5_es2015.1.normal.js index 07a02803a38d..d233fb2bfed4 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInCJS5_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInCJS5_es2015.1.normal.js @@ -2,7 +2,6 @@ // @target: esnext // @useDefineForClassFields: false // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class B { print() { return "I am B"; @@ -15,6 +14,8 @@ export function foo() { export function backup() { return "backup"; } +// @filename: 2.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; class C { method() { const loadAsync = import("./0"); diff --git a/crates/swc/tests/tsc-references/importCallExpressionInCJS5_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInCJS5_es2015.2.minified.js index 6ad9c76ea695..5ef9cdfc4cab 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInCJS5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInCJS5_es2015.2.minified.js @@ -1,4 +1,3 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class B { print() { return "I am B"; @@ -10,6 +9,7 @@ export function foo() { export function backup() { return "backup"; } +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class D { method() { var _ref; diff --git a/crates/swc/tests/tsc-references/importCallExpressionInCJS5_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInCJS5_es5.1.normal.js index 664f20c104f1..fd4780abf88e 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInCJS5_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInCJS5_es5.1.normal.js @@ -2,9 +2,7 @@ // @target: esnext // @useDefineForClassFields: false // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var B = /*#__PURE__*/ function() { "use strict"; function B() { @@ -23,6 +21,10 @@ export function foo() { export function backup() { return "backup"; } +// @filename: 2.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/importCallExpressionInCJS5_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInCJS5_es5.2.minified.js index 11f5eb40acf7..e3d755642f78 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInCJS5_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInCJS5_es5.2.minified.js @@ -1,6 +1,4 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var B = function() { "use strict"; function B() { @@ -16,6 +14,9 @@ export function foo() { export function backup() { return "backup"; } +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C = function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsAMD_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsAMD_es2015.1.normal.js index 775ef0367b4d..e04cd5894bcd 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsAMD_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsAMD_es2015.1.normal.js @@ -3,3 +3,9 @@ // @filename: something.ts module.exports = 42; export { }; +// @filename: index.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +module.exports = _async_to_generator(function*() { + const something = yield import("./something"); +}); +export { }; diff --git a/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsAMD_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsAMD_es2015.2.minified.js index d8b61fd48f4b..deaf15d21ede 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsAMD_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsAMD_es2015.2.minified.js @@ -1,2 +1,6 @@ module.exports = 42; export { }; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +module.exports = _async_to_generator(function*() { + yield import("./something"); +}); diff --git a/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsAMD_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsAMD_es5.1.normal.js index 775ef0367b4d..d0d229e6a52f 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsAMD_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsAMD_es5.1.normal.js @@ -3,3 +3,22 @@ // @filename: something.ts module.exports = 42; export { }; +// @filename: index.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +module.exports = _async_to_generator(regeneratorRuntime.mark(function _callee() { + var something; + return regeneratorRuntime.wrap(function _callee$(_ctx) { + while(1)switch(_ctx.prev = _ctx.next){ + case 0: + _ctx.next = 2; + return import("./something"); + case 2: + something = _ctx.sent; + case 3: + case "end": + return _ctx.stop(); + } + }, _callee); +})); +export { }; diff --git a/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsAMD_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsAMD_es5.2.minified.js index d8b61fd48f4b..7655076e7321 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsAMD_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsAMD_es5.2.minified.js @@ -1,2 +1,18 @@ module.exports = 42; export { }; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +module.exports = _async_to_generator(regeneratorRuntime.mark(function _callee() { + var something; + return regeneratorRuntime.wrap(function(_ctx) { + for(;;)switch(_ctx.prev = _ctx.next){ + case 0: + return _ctx.next = 2, import("./something"); + case 2: + something = _ctx.sent; + case 3: + case "end": + return _ctx.stop(); + } + }, _callee); +})); diff --git a/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsCJS_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsCJS_es2015.1.normal.js index 8748fccf8f58..6422c9be9363 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsCJS_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsCJS_es2015.1.normal.js @@ -3,3 +3,9 @@ // @filename: something.ts module.exports = 42; export { }; +// @filename: index.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +module.exports = _async_to_generator(function*() { + const something = yield import("./something"); +}); +export { }; diff --git a/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsCJS_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsCJS_es2015.2.minified.js index d8b61fd48f4b..deaf15d21ede 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsCJS_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsCJS_es2015.2.minified.js @@ -1,2 +1,6 @@ module.exports = 42; export { }; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +module.exports = _async_to_generator(function*() { + yield import("./something"); +}); diff --git a/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsCJS_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsCJS_es5.1.normal.js index 8748fccf8f58..5991266b90c8 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsCJS_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsCJS_es5.1.normal.js @@ -3,3 +3,22 @@ // @filename: something.ts module.exports = 42; export { }; +// @filename: index.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +module.exports = _async_to_generator(regeneratorRuntime.mark(function _callee() { + var something; + return regeneratorRuntime.wrap(function _callee$(_ctx) { + while(1)switch(_ctx.prev = _ctx.next){ + case 0: + _ctx.next = 2; + return import("./something"); + case 2: + something = _ctx.sent; + case 3: + case "end": + return _ctx.stop(); + } + }, _callee); +})); +export { }; diff --git a/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsCJS_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsCJS_es5.2.minified.js index d8b61fd48f4b..7655076e7321 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsCJS_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsCJS_es5.2.minified.js @@ -1,2 +1,18 @@ module.exports = 42; export { }; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +module.exports = _async_to_generator(regeneratorRuntime.mark(function _callee() { + var something; + return regeneratorRuntime.wrap(function(_ctx) { + for(;;)switch(_ctx.prev = _ctx.next){ + case 0: + return _ctx.next = 2, import("./something"); + case 2: + something = _ctx.sent; + case 3: + case "end": + return _ctx.stop(); + } + }, _callee); +})); diff --git a/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsUMD_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsUMD_es2015.1.normal.js index 984d52d0f066..507b6349d536 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsUMD_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsUMD_es2015.1.normal.js @@ -3,3 +3,9 @@ // @filename: something.ts module.exports = 42; export { }; +// @filename: index.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +module.exports = _async_to_generator(function*() { + const something = yield import("./something"); +}); +export { }; diff --git a/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsUMD_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsUMD_es2015.2.minified.js index d8b61fd48f4b..deaf15d21ede 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsUMD_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsUMD_es2015.2.minified.js @@ -1,2 +1,6 @@ module.exports = 42; export { }; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +module.exports = _async_to_generator(function*() { + yield import("./something"); +}); diff --git a/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsUMD_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsUMD_es5.1.normal.js index 984d52d0f066..f39fe9c8fa2e 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsUMD_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsUMD_es5.1.normal.js @@ -3,3 +3,22 @@ // @filename: something.ts module.exports = 42; export { }; +// @filename: index.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +module.exports = _async_to_generator(regeneratorRuntime.mark(function _callee() { + var something; + return regeneratorRuntime.wrap(function _callee$(_ctx) { + while(1)switch(_ctx.prev = _ctx.next){ + case 0: + _ctx.next = 2; + return import("./something"); + case 2: + something = _ctx.sent; + case 3: + case "end": + return _ctx.stop(); + } + }, _callee); +})); +export { }; diff --git a/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsUMD_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsUMD_es5.2.minified.js index d8b61fd48f4b..7655076e7321 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsUMD_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInExportEqualsUMD_es5.2.minified.js @@ -1,2 +1,18 @@ module.exports = 42; export { }; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +module.exports = _async_to_generator(regeneratorRuntime.mark(function _callee() { + var something; + return regeneratorRuntime.wrap(function(_ctx) { + for(;;)switch(_ctx.prev = _ctx.next){ + case 0: + return _ctx.next = 2, import("./something"); + case 2: + something = _ctx.sent; + case 3: + case "end": + return _ctx.stop(); + } + }, _callee); +})); diff --git a/crates/swc/tests/tsc-references/importCallExpressionInSystem3_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInSystem3_es2015.1.normal.js index 8f38023aaea8..fd1f32e04c37 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInSystem3_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInSystem3_es2015.1.normal.js @@ -1,18 +1,18 @@ // @module: system // @target: esnext // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class B { print() { return "I am B"; } } +// @filename: 2.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: 2.ts - _async_to_generator(function*() { + _foo = _async_to_generator(function*() { class C extends (yield import("./0")).B { } var c = new C(); diff --git a/crates/swc/tests/tsc-references/importCallExpressionInSystem3_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInSystem3_es2015.2.minified.js index 911c1b8804f6..587ad9da14d3 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInSystem3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInSystem3_es2015.2.minified.js @@ -1,9 +1,9 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class B { print() { return "I am B"; } } +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function _foo() { return (_foo = _async_to_generator(function*() { class C extends (yield import("./0")).B { diff --git a/crates/swc/tests/tsc-references/importCallExpressionInSystem3_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInSystem3_es5.1.normal.js index 6e16063efc78..586ced3e69ba 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInSystem3_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInSystem3_es5.1.normal.js @@ -1,11 +1,7 @@ // @module: system // @target: esnext // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var B = /*#__PURE__*/ function() { "use strict"; function B() { @@ -17,12 +13,17 @@ export var B = /*#__PURE__*/ function() { }; return B; }(); +// @filename: 2.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: 2.ts - _async_to_generator(regeneratorRuntime.mark(function _callee() { + _foo = _async_to_generator(regeneratorRuntime.mark(function _callee() { var C, c; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ diff --git a/crates/swc/tests/tsc-references/importCallExpressionInSystem3_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInSystem3_es5.2.minified.js index 622553ec4998..27b173373359 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInSystem3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInSystem3_es5.2.minified.js @@ -1,8 +1,4 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var B = function() { "use strict"; function B() { @@ -12,6 +8,11 @@ export var B = function() { return "I am B"; }, B; }(); +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function _foo() { return (_foo = _async_to_generator(regeneratorRuntime.mark(function _callee() { var C, c; diff --git a/crates/swc/tests/tsc-references/importCallExpressionInSystem4_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInSystem4_es2015.1.normal.js index 3dc260f80811..5e2323943ce1 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInSystem4_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInSystem4_es2015.1.normal.js @@ -2,7 +2,6 @@ // @target: esnext // @useDefineForClassFields: false // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class B { print() { return "I am B"; @@ -15,6 +14,8 @@ export function foo() { export function backup() { return "backup"; } +// @filename: 2.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; class C { method() { const loadAsync = import("./0"); diff --git a/crates/swc/tests/tsc-references/importCallExpressionInSystem4_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInSystem4_es2015.2.minified.js index 6ad9c76ea695..5ef9cdfc4cab 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInSystem4_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInSystem4_es2015.2.minified.js @@ -1,4 +1,3 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class B { print() { return "I am B"; @@ -10,6 +9,7 @@ export function foo() { export function backup() { return "backup"; } +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class D { method() { var _ref; diff --git a/crates/swc/tests/tsc-references/importCallExpressionInSystem4_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInSystem4_es5.1.normal.js index 23dd20fbe2cb..dc7e667d7811 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInSystem4_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInSystem4_es5.1.normal.js @@ -2,9 +2,7 @@ // @target: esnext // @useDefineForClassFields: false // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var B = /*#__PURE__*/ function() { "use strict"; function B() { @@ -23,6 +21,10 @@ export function foo() { export function backup() { return "backup"; } +// @filename: 2.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/importCallExpressionInSystem4_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInSystem4_es5.2.minified.js index 11f5eb40acf7..e3d755642f78 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInSystem4_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInSystem4_es5.2.minified.js @@ -1,6 +1,4 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var B = function() { "use strict"; function B() { @@ -16,6 +14,9 @@ export function foo() { export function backup() { return "backup"; } +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C = function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/importCallExpressionInUMD3_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInUMD3_es2015.1.normal.js index e8b5f50fa805..b79f6ba92965 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInUMD3_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInUMD3_es2015.1.normal.js @@ -1,18 +1,18 @@ // @module: umd // @target: esnext // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class B { print() { return "I am B"; } } +// @filename: 2.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: 2.ts - _async_to_generator(function*() { + _foo = _async_to_generator(function*() { class C extends (yield import("./0")).B { } var c = new C(); diff --git a/crates/swc/tests/tsc-references/importCallExpressionInUMD3_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInUMD3_es2015.2.minified.js index 911c1b8804f6..587ad9da14d3 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInUMD3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInUMD3_es2015.2.minified.js @@ -1,9 +1,9 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class B { print() { return "I am B"; } } +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function _foo() { return (_foo = _async_to_generator(function*() { class C extends (yield import("./0")).B { diff --git a/crates/swc/tests/tsc-references/importCallExpressionInUMD3_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInUMD3_es5.1.normal.js index c259b2bb698b..655973448375 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInUMD3_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInUMD3_es5.1.normal.js @@ -1,11 +1,7 @@ // @module: umd // @target: esnext // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var B = /*#__PURE__*/ function() { "use strict"; function B() { @@ -17,12 +13,17 @@ export var B = /*#__PURE__*/ function() { }; return B; }(); +// @filename: 2.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: 2.ts - _async_to_generator(regeneratorRuntime.mark(function _callee() { + _foo = _async_to_generator(regeneratorRuntime.mark(function _callee() { var C, c; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ diff --git a/crates/swc/tests/tsc-references/importCallExpressionInUMD3_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInUMD3_es5.2.minified.js index 622553ec4998..27b173373359 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInUMD3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInUMD3_es5.2.minified.js @@ -1,8 +1,4 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var B = function() { "use strict"; function B() { @@ -12,6 +8,11 @@ export var B = function() { return "I am B"; }, B; }(); +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function _foo() { return (_foo = _async_to_generator(regeneratorRuntime.mark(function _callee() { var C, c; diff --git a/crates/swc/tests/tsc-references/importCallExpressionInUMD4_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInUMD4_es2015.1.normal.js index fc4df8751f6e..2325fffafa11 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInUMD4_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInUMD4_es2015.1.normal.js @@ -2,7 +2,6 @@ // @target: esnext // @useDefineForClassFields: false // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class B { print() { return "I am B"; @@ -15,6 +14,8 @@ export function foo() { export function backup() { return "backup"; } +// @filename: 2.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; class C { method() { const loadAsync = import("./0"); diff --git a/crates/swc/tests/tsc-references/importCallExpressionInUMD4_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInUMD4_es2015.2.minified.js index 6ad9c76ea695..5ef9cdfc4cab 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInUMD4_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInUMD4_es2015.2.minified.js @@ -1,4 +1,3 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class B { print() { return "I am B"; @@ -10,6 +9,7 @@ export function foo() { export function backup() { return "backup"; } +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class D { method() { var _ref; diff --git a/crates/swc/tests/tsc-references/importCallExpressionInUMD4_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInUMD4_es5.1.normal.js index 41938e3c6bab..8161591baa55 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInUMD4_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInUMD4_es5.1.normal.js @@ -2,9 +2,7 @@ // @target: esnext // @useDefineForClassFields: false // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var B = /*#__PURE__*/ function() { "use strict"; function B() { @@ -23,6 +21,10 @@ export function foo() { export function backup() { return "backup"; } +// @filename: 2.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/importCallExpressionInUMD4_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInUMD4_es5.2.minified.js index 11f5eb40acf7..e3d755642f78 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInUMD4_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInUMD4_es5.2.minified.js @@ -1,6 +1,4 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var B = function() { "use strict"; function B() { @@ -16,6 +14,9 @@ export function foo() { export function backup() { return "backup"; } +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C = function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/importCallExpressionInUMD5_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInUMD5_es2015.1.normal.js index 1483dd82ace4..c532af7ef3ed 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInUMD5_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInUMD5_es2015.1.normal.js @@ -1,17 +1,17 @@ // @module: umd // @target: es2015 // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export function foo() { return "foo"; } +// @filename: 1.ts +// https://github.com/microsoft/TypeScript/issues/36780 +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function func() { return _func.apply(this, arguments); } function _func() { - _func = // @filename: 1.ts - // https://github.com/microsoft/TypeScript/issues/36780 - _async_to_generator(function*() { + _func = _async_to_generator(function*() { const packageName = '.'; const packageJson = yield import(packageName + '/package.json'); }); diff --git a/crates/swc/tests/tsc-references/importCallExpressionInUMD5_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInUMD5_es2015.2.minified.js index d34b692697bb..c1637f2b41b6 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInUMD5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInUMD5_es2015.2.minified.js @@ -1,4 +1,4 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export function foo() { return "foo"; } +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionInUMD5_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionInUMD5_es5.1.normal.js index 44a6030fa484..c20d640f6428 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInUMD5_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInUMD5_es5.1.normal.js @@ -1,18 +1,18 @@ // @module: umd // @target: es2015 // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export function foo() { return "foo"; } +// @filename: 1.ts +// https://github.com/microsoft/TypeScript/issues/36780 +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; function func() { return _func.apply(this, arguments); } function _func() { - _func = // @filename: 1.ts - // https://github.com/microsoft/TypeScript/issues/36780 - _async_to_generator(regeneratorRuntime.mark(function _callee() { + _func = _async_to_generator(regeneratorRuntime.mark(function _callee() { var packageName, packageJson; return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ diff --git a/crates/swc/tests/tsc-references/importCallExpressionInUMD5_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInUMD5_es5.2.minified.js index a018f80a76aa..7cfcc256f61c 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInUMD5_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInUMD5_es5.2.minified.js @@ -1,5 +1,5 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export function foo() { return "foo"; } +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import regeneratorRuntime from "regenerator-runtime"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedAMD2_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNestedAMD2_es2015.1.normal.js index 4f075319b534..8109c71f2d7c 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedAMD2_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedAMD2_es2015.1.normal.js @@ -3,14 +3,14 @@ // @skipLibCheck: true // @lib: es6 // @filename: foo.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export default "./foo"; +// @filename: index.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: index.ts - _async_to_generator(function*() { + _foo = _async_to_generator(function*() { return yield import((yield import("./foo")).default); }); return _foo.apply(this, arguments); diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedAMD2_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedAMD2_es2015.2.minified.js index cf78ab1856e1..660bcb029f55 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedAMD2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedAMD2_es2015.2.minified.js @@ -1,2 +1,2 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export default "./foo"; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedAMD2_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNestedAMD2_es5.1.normal.js index c46f6882fb1a..10c3fac3b8c8 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedAMD2_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedAMD2_es5.1.normal.js @@ -3,15 +3,15 @@ // @skipLibCheck: true // @lib: es6 // @filename: foo.ts +export default "./foo"; +// @filename: index.ts import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; -export default "./foo"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: index.ts - _async_to_generator(regeneratorRuntime.mark(function _callee() { + _foo = _async_to_generator(regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ case 0: diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedAMD2_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedAMD2_es5.2.minified.js index a7609b071a23..cf8ad2fce58c 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedAMD2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedAMD2_es5.2.minified.js @@ -1,3 +1,3 @@ +export default "./foo"; import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; -export default "./foo"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedAMD_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNestedAMD_es2015.1.normal.js index 24805da2d4bd..a99eeee57312 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedAMD_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedAMD_es2015.1.normal.js @@ -3,14 +3,14 @@ // @skipLibCheck: true // @lib: es6 // @filename: foo.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export default "./foo"; +// @filename: index.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: index.ts - _async_to_generator(function*() { + _foo = _async_to_generator(function*() { return yield import((yield import("./foo")).default); }); return _foo.apply(this, arguments); diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedAMD_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedAMD_es2015.2.minified.js index cf78ab1856e1..660bcb029f55 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedAMD_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedAMD_es2015.2.minified.js @@ -1,2 +1,2 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export default "./foo"; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedAMD_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNestedAMD_es5.1.normal.js index a5c9b3631c59..a86847cb51c3 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedAMD_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedAMD_es5.1.normal.js @@ -3,15 +3,15 @@ // @skipLibCheck: true // @lib: es6 // @filename: foo.ts +export default "./foo"; +// @filename: index.ts import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; -export default "./foo"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: index.ts - _async_to_generator(regeneratorRuntime.mark(function _callee() { + _foo = _async_to_generator(regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ case 0: diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedAMD_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedAMD_es5.2.minified.js index a7609b071a23..cf8ad2fce58c 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedAMD_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedAMD_es5.2.minified.js @@ -1,3 +1,3 @@ +export default "./foo"; import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; -export default "./foo"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedCJS2_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNestedCJS2_es2015.1.normal.js index 5762cc4e81b4..84a5a96f7c6c 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedCJS2_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedCJS2_es2015.1.normal.js @@ -3,14 +3,14 @@ // @skipLibCheck: true // @lib: es6 // @filename: foo.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export default "./foo"; +// @filename: index.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: index.ts - _async_to_generator(function*() { + _foo = _async_to_generator(function*() { return yield import((yield import("./foo")).default); }); return _foo.apply(this, arguments); diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedCJS2_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedCJS2_es2015.2.minified.js index cf78ab1856e1..660bcb029f55 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedCJS2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedCJS2_es2015.2.minified.js @@ -1,2 +1,2 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export default "./foo"; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedCJS2_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNestedCJS2_es5.1.normal.js index 4a80794970e5..e22db33d4ed1 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedCJS2_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedCJS2_es5.1.normal.js @@ -3,15 +3,15 @@ // @skipLibCheck: true // @lib: es6 // @filename: foo.ts +export default "./foo"; +// @filename: index.ts import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; -export default "./foo"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: index.ts - _async_to_generator(regeneratorRuntime.mark(function _callee() { + _foo = _async_to_generator(regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ case 0: diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedCJS2_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedCJS2_es5.2.minified.js index a7609b071a23..cf8ad2fce58c 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedCJS2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedCJS2_es5.2.minified.js @@ -1,3 +1,3 @@ +export default "./foo"; import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; -export default "./foo"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedCJS_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNestedCJS_es2015.1.normal.js index 604eb03a5b53..cd0b416d597d 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedCJS_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedCJS_es2015.1.normal.js @@ -3,14 +3,14 @@ // @skipLibCheck: true // @lib: es6 // @filename: foo.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export default "./foo"; +// @filename: index.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: index.ts - _async_to_generator(function*() { + _foo = _async_to_generator(function*() { return yield import((yield import("./foo")).default); }); return _foo.apply(this, arguments); diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedCJS_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedCJS_es2015.2.minified.js index cf78ab1856e1..660bcb029f55 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedCJS_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedCJS_es2015.2.minified.js @@ -1,2 +1,2 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export default "./foo"; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedCJS_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNestedCJS_es5.1.normal.js index 90dc29f083ce..11151d6c9e46 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedCJS_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedCJS_es5.1.normal.js @@ -3,15 +3,15 @@ // @skipLibCheck: true // @lib: es6 // @filename: foo.ts +export default "./foo"; +// @filename: index.ts import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; -export default "./foo"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: index.ts - _async_to_generator(regeneratorRuntime.mark(function _callee() { + _foo = _async_to_generator(regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ case 0: diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedCJS_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedCJS_es5.2.minified.js index a7609b071a23..cf8ad2fce58c 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedCJS_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedCJS_es5.2.minified.js @@ -1,3 +1,3 @@ +export default "./foo"; import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; -export default "./foo"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedES20152_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNestedES20152_es2015.1.normal.js index 593177a9d782..cd43cd57c254 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedES20152_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedES20152_es2015.1.normal.js @@ -3,14 +3,14 @@ // @skipLibCheck: true // @lib: es6 // @filename: foo.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export default "./foo"; +// @filename: index.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: index.ts - _async_to_generator(function*() { + _foo = _async_to_generator(function*() { return yield import((yield import("./foo")).default); }); return _foo.apply(this, arguments); diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedES20152_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedES20152_es2015.2.minified.js index cf78ab1856e1..660bcb029f55 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedES20152_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedES20152_es2015.2.minified.js @@ -1,2 +1,2 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export default "./foo"; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedES20152_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNestedES20152_es5.1.normal.js index 5ec9020ed8f7..f353106d9d84 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedES20152_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedES20152_es5.1.normal.js @@ -3,15 +3,15 @@ // @skipLibCheck: true // @lib: es6 // @filename: foo.ts +export default "./foo"; +// @filename: index.ts import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; -export default "./foo"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: index.ts - _async_to_generator(regeneratorRuntime.mark(function _callee() { + _foo = _async_to_generator(regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ case 0: diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedES20152_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedES20152_es5.2.minified.js index a7609b071a23..cf8ad2fce58c 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedES20152_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedES20152_es5.2.minified.js @@ -1,3 +1,3 @@ +export default "./foo"; import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; -export default "./foo"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedES2015_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNestedES2015_es2015.1.normal.js index 210c5c471101..6f14ef8bf463 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedES2015_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedES2015_es2015.1.normal.js @@ -3,14 +3,14 @@ // @skipLibCheck: true // @lib: es6 // @filename: foo.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export default "./foo"; +// @filename: index.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: index.ts - _async_to_generator(function*() { + _foo = _async_to_generator(function*() { return yield import((yield import("./foo")).default); }); return _foo.apply(this, arguments); diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedES2015_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedES2015_es2015.2.minified.js index cf78ab1856e1..660bcb029f55 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedES2015_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedES2015_es2015.2.minified.js @@ -1,2 +1,2 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export default "./foo"; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedES2015_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNestedES2015_es5.1.normal.js index 81cfa2d2caaa..46f12fb39df6 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedES2015_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedES2015_es5.1.normal.js @@ -3,15 +3,15 @@ // @skipLibCheck: true // @lib: es6 // @filename: foo.ts +export default "./foo"; +// @filename: index.ts import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; -export default "./foo"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: index.ts - _async_to_generator(regeneratorRuntime.mark(function _callee() { + _foo = _async_to_generator(regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ case 0: diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedES2015_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedES2015_es5.2.minified.js index a7609b071a23..cf8ad2fce58c 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedES2015_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedES2015_es5.2.minified.js @@ -1,3 +1,3 @@ +export default "./foo"; import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; -export default "./foo"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedES20202_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNestedES20202_es2015.1.normal.js index ee56587c2e07..dfcff0eac082 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedES20202_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedES20202_es2015.1.normal.js @@ -3,14 +3,14 @@ // @skipLibCheck: true // @lib: es6 // @filename: foo.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export default "./foo"; +// @filename: index.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: index.ts - _async_to_generator(function*() { + _foo = _async_to_generator(function*() { return yield import((yield import("./foo")).default); }); return _foo.apply(this, arguments); diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedES20202_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedES20202_es2015.2.minified.js index cf78ab1856e1..660bcb029f55 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedES20202_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedES20202_es2015.2.minified.js @@ -1,2 +1,2 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export default "./foo"; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedES20202_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNestedES20202_es5.1.normal.js index acb58253d0a9..762832b4807e 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedES20202_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedES20202_es5.1.normal.js @@ -3,15 +3,15 @@ // @skipLibCheck: true // @lib: es6 // @filename: foo.ts +export default "./foo"; +// @filename: index.ts import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; -export default "./foo"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: index.ts - _async_to_generator(regeneratorRuntime.mark(function _callee() { + _foo = _async_to_generator(regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ case 0: diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedES20202_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedES20202_es5.2.minified.js index a7609b071a23..cf8ad2fce58c 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedES20202_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedES20202_es5.2.minified.js @@ -1,3 +1,3 @@ +export default "./foo"; import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; -export default "./foo"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedES2020_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNestedES2020_es2015.1.normal.js index 11c2e913b4f9..6ce6bb4f0dad 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedES2020_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedES2020_es2015.1.normal.js @@ -3,14 +3,14 @@ // @skipLibCheck: true // @lib: es6 // @filename: foo.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export default "./foo"; +// @filename: index.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: index.ts - _async_to_generator(function*() { + _foo = _async_to_generator(function*() { return yield import((yield import("./foo")).default); }); return _foo.apply(this, arguments); diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedES2020_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedES2020_es2015.2.minified.js index cf78ab1856e1..660bcb029f55 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedES2020_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedES2020_es2015.2.minified.js @@ -1,2 +1,2 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export default "./foo"; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedES2020_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNestedES2020_es5.1.normal.js index 77d085631991..341e2f00988d 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedES2020_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedES2020_es5.1.normal.js @@ -3,15 +3,15 @@ // @skipLibCheck: true // @lib: es6 // @filename: foo.ts +export default "./foo"; +// @filename: index.ts import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; -export default "./foo"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: index.ts - _async_to_generator(regeneratorRuntime.mark(function _callee() { + _foo = _async_to_generator(regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ case 0: diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedES2020_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedES2020_es5.2.minified.js index a7609b071a23..cf8ad2fce58c 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedES2020_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedES2020_es5.2.minified.js @@ -1,3 +1,3 @@ +export default "./foo"; import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; -export default "./foo"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedSystem2_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNestedSystem2_es2015.1.normal.js index 89d9ee9d9bf6..b781c5ab53ea 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedSystem2_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedSystem2_es2015.1.normal.js @@ -3,14 +3,14 @@ // @skipLibCheck: true // @lib: es6 // @filename: foo.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export default "./foo"; +// @filename: index.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: index.ts - _async_to_generator(function*() { + _foo = _async_to_generator(function*() { return yield import((yield import("./foo")).default); }); return _foo.apply(this, arguments); diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedSystem2_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedSystem2_es2015.2.minified.js index cf78ab1856e1..660bcb029f55 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedSystem2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedSystem2_es2015.2.minified.js @@ -1,2 +1,2 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export default "./foo"; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedSystem2_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNestedSystem2_es5.1.normal.js index 1a2a9fc78ca0..2dbb80a0d0bd 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedSystem2_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedSystem2_es5.1.normal.js @@ -3,15 +3,15 @@ // @skipLibCheck: true // @lib: es6 // @filename: foo.ts +export default "./foo"; +// @filename: index.ts import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; -export default "./foo"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: index.ts - _async_to_generator(regeneratorRuntime.mark(function _callee() { + _foo = _async_to_generator(regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ case 0: diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedSystem2_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedSystem2_es5.2.minified.js index a7609b071a23..cf8ad2fce58c 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedSystem2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedSystem2_es5.2.minified.js @@ -1,3 +1,3 @@ +export default "./foo"; import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; -export default "./foo"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedSystem_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNestedSystem_es2015.1.normal.js index b87c66552732..a6c63d04a5cf 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedSystem_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedSystem_es2015.1.normal.js @@ -3,14 +3,14 @@ // @skipLibCheck: true // @lib: es6 // @filename: foo.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export default "./foo"; +// @filename: index.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: index.ts - _async_to_generator(function*() { + _foo = _async_to_generator(function*() { return yield import((yield import("./foo")).default); }); return _foo.apply(this, arguments); diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedSystem_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedSystem_es2015.2.minified.js index cf78ab1856e1..660bcb029f55 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedSystem_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedSystem_es2015.2.minified.js @@ -1,2 +1,2 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export default "./foo"; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedSystem_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNestedSystem_es5.1.normal.js index 87207f31ade9..0374ac81ae3e 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedSystem_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedSystem_es5.1.normal.js @@ -3,15 +3,15 @@ // @skipLibCheck: true // @lib: es6 // @filename: foo.ts +export default "./foo"; +// @filename: index.ts import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; -export default "./foo"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: index.ts - _async_to_generator(regeneratorRuntime.mark(function _callee() { + _foo = _async_to_generator(regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ case 0: diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedSystem_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedSystem_es5.2.minified.js index a7609b071a23..cf8ad2fce58c 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedSystem_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedSystem_es5.2.minified.js @@ -1,3 +1,3 @@ +export default "./foo"; import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; -export default "./foo"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedUMD2_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNestedUMD2_es2015.1.normal.js index 6602eae4ec69..e7003269fab1 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedUMD2_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedUMD2_es2015.1.normal.js @@ -3,14 +3,14 @@ // @skipLibCheck: true // @lib: es6 // @filename: foo.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export default "./foo"; +// @filename: index.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: index.ts - _async_to_generator(function*() { + _foo = _async_to_generator(function*() { return yield import((yield import("./foo")).default); }); return _foo.apply(this, arguments); diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedUMD2_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedUMD2_es2015.2.minified.js index cf78ab1856e1..660bcb029f55 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedUMD2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedUMD2_es2015.2.minified.js @@ -1,2 +1,2 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export default "./foo"; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedUMD2_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNestedUMD2_es5.1.normal.js index 6139950736cc..c7d9fff4639a 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedUMD2_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedUMD2_es5.1.normal.js @@ -3,15 +3,15 @@ // @skipLibCheck: true // @lib: es6 // @filename: foo.ts +export default "./foo"; +// @filename: index.ts import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; -export default "./foo"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: index.ts - _async_to_generator(regeneratorRuntime.mark(function _callee() { + _foo = _async_to_generator(regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ case 0: diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedUMD2_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedUMD2_es5.2.minified.js index a7609b071a23..cf8ad2fce58c 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedUMD2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedUMD2_es5.2.minified.js @@ -1,3 +1,3 @@ +export default "./foo"; import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; -export default "./foo"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedUMD_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNestedUMD_es2015.1.normal.js index 974554cb7ec8..e15fa26f1374 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedUMD_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedUMD_es2015.1.normal.js @@ -3,14 +3,14 @@ // @skipLibCheck: true // @lib: es6 // @filename: foo.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export default "./foo"; +// @filename: index.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: index.ts - _async_to_generator(function*() { + _foo = _async_to_generator(function*() { return yield import((yield import("./foo")).default); }); return _foo.apply(this, arguments); diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedUMD_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedUMD_es2015.2.minified.js index cf78ab1856e1..660bcb029f55 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedUMD_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedUMD_es2015.2.minified.js @@ -1,2 +1,2 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export default "./foo"; +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedUMD_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNestedUMD_es5.1.normal.js index b6b1ef85120d..1dbc50848792 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedUMD_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedUMD_es5.1.normal.js @@ -3,15 +3,15 @@ // @skipLibCheck: true // @lib: es6 // @filename: foo.ts +export default "./foo"; +// @filename: index.ts import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; -export default "./foo"; function foo() { return _foo.apply(this, arguments); } function _foo() { - _foo = // @filename: index.ts - _async_to_generator(regeneratorRuntime.mark(function _callee() { + _foo = _async_to_generator(regeneratorRuntime.mark(function _callee() { return regeneratorRuntime.wrap(function _callee$(_ctx) { while(1)switch(_ctx.prev = _ctx.next){ case 0: diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedUMD_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedUMD_es5.2.minified.js index a7609b071a23..cf8ad2fce58c 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedUMD_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedUMD_es5.2.minified.js @@ -1,3 +1,3 @@ +export default "./foo"; import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import regeneratorRuntime from "regenerator-runtime"; -export default "./foo"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNoModuleKindSpecified_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNoModuleKindSpecified_es2015.1.normal.js index 523faf6390d0..a770d11e2d87 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNoModuleKindSpecified_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNoModuleKindSpecified_es2015.1.normal.js @@ -1,6 +1,5 @@ // @lib: es5 // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class B { print() { return "I am B"; @@ -13,6 +12,8 @@ export function foo() { export function backup() { return "backup"; } +// @filename: 2.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; class C { method() { const loadAsync = import("./0"); diff --git a/crates/swc/tests/tsc-references/importCallExpressionNoModuleKindSpecified_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNoModuleKindSpecified_es2015.2.minified.js index 3eb198ed5934..2e1781f4286f 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNoModuleKindSpecified_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNoModuleKindSpecified_es2015.2.minified.js @@ -1,4 +1,3 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; export class B { print() { return "I am B"; @@ -10,3 +9,4 @@ export function foo() { export function backup() { return "backup"; } +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; diff --git a/crates/swc/tests/tsc-references/importCallExpressionNoModuleKindSpecified_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionNoModuleKindSpecified_es5.1.normal.js index 2437c6ff4e2d..ab990c23475e 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNoModuleKindSpecified_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNoModuleKindSpecified_es5.1.normal.js @@ -1,8 +1,6 @@ // @lib: es5 // @filename: 0.ts -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var B = /*#__PURE__*/ function() { "use strict"; function B() { @@ -21,6 +19,10 @@ export function foo() { export function backup() { return "backup"; } +// @filename: 2.ts +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C = /*#__PURE__*/ function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/importCallExpressionNoModuleKindSpecified_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNoModuleKindSpecified_es5.2.minified.js index 940b5e30ea9c..197709aa2345 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNoModuleKindSpecified_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNoModuleKindSpecified_es5.2.minified.js @@ -1,6 +1,4 @@ -import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var B = function() { "use strict"; function B() { @@ -16,6 +14,9 @@ export function foo() { export function backup() { return "backup"; } +import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import regeneratorRuntime from "regenerator-runtime"; var C = function() { "use strict"; function C() { diff --git a/crates/swc/tests/tsc-references/importCallExpressionReturnPromiseOfAny_es2015.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionReturnPromiseOfAny_es2015.1.normal.js index 99bef21c091e..3bc4696955dc 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionReturnPromiseOfAny_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionReturnPromiseOfAny_es2015.1.normal.js @@ -4,6 +4,7 @@ // @filename: defaultPath.ts export class C { } +// @filename: 1.ts import(`${directory}\\${moduleFile}`); import(getSpecifier()); var p1 = import(ValidSomeCondition() ? "./0" : "externalModule"); @@ -21,3 +22,4 @@ function* loadModule(directories) { import((yield path)); } } +export { }; diff --git a/crates/swc/tests/tsc-references/importCallExpressionReturnPromiseOfAny_es2015.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionReturnPromiseOfAny_es2015.2.minified.js index 045751b04aaf..0d974c9693d8 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionReturnPromiseOfAny_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionReturnPromiseOfAny_es2015.2.minified.js @@ -3,3 +3,4 @@ export class C { import(`${directory}\\${moduleFile}`), import(getSpecifier()); var p1 = (import(ValidSomeCondition() ? "./0" : "externalModule"), import(getSpecifier())); import(getSpecifier()), import(whatToLoad ? getSpecifier() : "defaulPath"), p1.then((zero)=>zero.foo()), import(getSpecifier()); +export { }; diff --git a/crates/swc/tests/tsc-references/importCallExpressionReturnPromiseOfAny_es5.1.normal.js b/crates/swc/tests/tsc-references/importCallExpressionReturnPromiseOfAny_es5.1.normal.js index 1cd8594f661c..ca9b18d56cc3 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionReturnPromiseOfAny_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importCallExpressionReturnPromiseOfAny_es5.1.normal.js @@ -3,12 +3,13 @@ // @noImplicitAny: true // @filename: defaultPath.ts import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import regeneratorRuntime from "regenerator-runtime"; -var _marked = regeneratorRuntime.mark(loadModule); export var C = function C() { "use strict"; _class_call_check(this, C); }; +// @filename: 1.ts +import regeneratorRuntime from "regenerator-runtime"; +var _marked = regeneratorRuntime.mark(loadModule); import("".concat(directory, "\\").concat(moduleFile)); import(getSpecifier()); var p1 = import(ValidSomeCondition() ? "./0" : "externalModule"); @@ -88,3 +89,4 @@ function loadModule(directories) { ] ]); } +export { }; diff --git a/crates/swc/tests/tsc-references/importCallExpressionReturnPromiseOfAny_es5.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionReturnPromiseOfAny_es5.2.minified.js index 00b95d13a3f7..4c0c5b453fa1 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionReturnPromiseOfAny_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionReturnPromiseOfAny_es5.2.minified.js @@ -1,4 +1,8 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +export var C = function() { + "use strict"; + _class_call_check(this, C); +}; import regeneratorRuntime from "regenerator-runtime"; var _marked = regeneratorRuntime.mark(function(directories) { var _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _$directory, path; @@ -53,10 +57,6 @@ var _marked = regeneratorRuntime.mark(function(directories) { ] ]); }); -export var C = function() { - "use strict"; - _class_call_check(this, C); -}; import("".concat(directory, "\\").concat(moduleFile)), import(getSpecifier()); var p1 = (import(ValidSomeCondition() ? "./0" : "externalModule"), import(getSpecifier())); import(getSpecifier()), import(whatToLoad ? getSpecifier() : "defaulPath"), p1.then(function(zero) { diff --git a/crates/swc/tests/tsc-references/importClause_default_es2015.1.normal.js b/crates/swc/tests/tsc-references/importClause_default_es2015.1.normal.js index d5f7dcecec19..4c4d714a17e0 100644 --- a/crates/swc/tests/tsc-references/importClause_default_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importClause_default_es2015.1.normal.js @@ -1,6 +1,7 @@ // @Filename: /a.ts export default class A { }; +// @Filename: /b.ts new A(); let a = { a: '' @@ -8,3 +9,4 @@ let a = { let b = { A }; +export { }; diff --git a/crates/swc/tests/tsc-references/importClause_default_es2015.2.minified.js b/crates/swc/tests/tsc-references/importClause_default_es2015.2.minified.js index cbb702cdcc7f..14c2f409a084 100644 --- a/crates/swc/tests/tsc-references/importClause_default_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importClause_default_es2015.2.minified.js @@ -1,3 +1,4 @@ export default class A { }; new A(); +export { }; diff --git a/crates/swc/tests/tsc-references/importClause_default_es5.1.normal.js b/crates/swc/tests/tsc-references/importClause_default_es5.1.normal.js index 2753e09adc39..9461998821e5 100644 --- a/crates/swc/tests/tsc-references/importClause_default_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importClause_default_es5.1.normal.js @@ -5,6 +5,7 @@ var A = function A() { _class_call_check(this, A); }; export { A as default }; +// @Filename: /b.ts new A(); var a = { a: "" @@ -12,3 +13,4 @@ var a = { var b = { A: A }; +export { }; diff --git a/crates/swc/tests/tsc-references/importClause_default_es5.2.minified.js b/crates/swc/tests/tsc-references/importClause_default_es5.2.minified.js index 4b5cdd8ad0a3..368c2282409c 100644 --- a/crates/swc/tests/tsc-references/importClause_default_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importClause_default_es5.2.minified.js @@ -3,5 +3,6 @@ var A = function() { "use strict"; _class_call_check(this, A); }; -new A(); export { A as default }; +new A(); +export { }; diff --git a/crates/swc/tests/tsc-references/importDefaultNamedType_es2015.1.normal.js b/crates/swc/tests/tsc-references/importDefaultNamedType_es2015.1.normal.js index 07c42e41d5f6..882b1570f054 100644 --- a/crates/swc/tests/tsc-references/importDefaultNamedType_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importDefaultNamedType_es2015.1.normal.js @@ -1,3 +1,5 @@ // @Filename: /a.ts export default class A { }; +// @Filename: /b.ts +export { }; diff --git a/crates/swc/tests/tsc-references/importDefaultNamedType_es2015.2.minified.js b/crates/swc/tests/tsc-references/importDefaultNamedType_es2015.2.minified.js index 95220774f32a..6b325c14be88 100644 --- a/crates/swc/tests/tsc-references/importDefaultNamedType_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importDefaultNamedType_es2015.2.minified.js @@ -1,2 +1,3 @@ export default class A { }; +export { }; diff --git a/crates/swc/tests/tsc-references/importDefaultNamedType_es5.1.normal.js b/crates/swc/tests/tsc-references/importDefaultNamedType_es5.1.normal.js index 6e0fe2b07589..e4e499055a7a 100644 --- a/crates/swc/tests/tsc-references/importDefaultNamedType_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importDefaultNamedType_es5.1.normal.js @@ -5,3 +5,5 @@ var A = function A() { _class_call_check(this, A); }; export { A as default }; +// @Filename: /b.ts +export { }; diff --git a/crates/swc/tests/tsc-references/importDefaultNamedType_es5.2.minified.js b/crates/swc/tests/tsc-references/importDefaultNamedType_es5.2.minified.js index 32b7dd560e0c..29973a389dd7 100644 --- a/crates/swc/tests/tsc-references/importDefaultNamedType_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importDefaultNamedType_es5.2.minified.js @@ -4,3 +4,4 @@ var A = function() { _class_call_check(this, A); }; export { A as default }; +export { }; diff --git a/crates/swc/tests/tsc-references/importEquals2_es2015.1.normal.js b/crates/swc/tests/tsc-references/importEquals2_es2015.1.normal.js index 0ec230ab8679..1feff025d576 100644 --- a/crates/swc/tests/tsc-references/importEquals2_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importEquals2_es2015.1.normal.js @@ -2,9 +2,11 @@ // @Filename: /a.ts class A { } +export { }; // @Filename: /b.ts import * as a from './a'; +module.exports = a; // @Filename: /c.ts const a = require('./b'); new a.A(); // Error -module.exports = a; +export { }; diff --git a/crates/swc/tests/tsc-references/importEquals2_es2015.2.minified.js b/crates/swc/tests/tsc-references/importEquals2_es2015.2.minified.js index aed571b6ff57..90dd239a62b3 100644 --- a/crates/swc/tests/tsc-references/importEquals2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importEquals2_es2015.2.minified.js @@ -1,3 +1,6 @@ +export { }; import * as a from './a'; +module.exports = a; let a = require('./b'); -new a.A(), module.exports = a; +new a.A(); +export { }; diff --git a/crates/swc/tests/tsc-references/importEquals2_es5.1.normal.js b/crates/swc/tests/tsc-references/importEquals2_es5.1.normal.js index af35c1b5ef84..4ecf30c50621 100644 --- a/crates/swc/tests/tsc-references/importEquals2_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importEquals2_es5.1.normal.js @@ -5,9 +5,11 @@ var A = function A() { "use strict"; _class_call_check(this, A); }; +export { }; // @Filename: /b.ts import * as a from "./a"; +module.exports = a; // @Filename: /c.ts var a = require("./b"); new a.A(); // Error -module.exports = a; +export { }; diff --git a/crates/swc/tests/tsc-references/importEquals2_es5.2.minified.js b/crates/swc/tests/tsc-references/importEquals2_es5.2.minified.js index b067b687e7d2..9d9377942747 100644 --- a/crates/swc/tests/tsc-references/importEquals2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importEquals2_es5.2.minified.js @@ -4,5 +4,6 @@ var A = function() { _class_call_check(this, A); }; import * as a from "./a"; -var a = require("./b"); -new a.A(), module.exports = a; +module.exports = a; +new (require("./b")).A(); +export { }; diff --git a/crates/swc/tests/tsc-references/importImportOnlyModule_es2015.1.normal.js b/crates/swc/tests/tsc-references/importImportOnlyModule_es2015.1.normal.js index dcc6e1a4a7da..6b95eb227a09 100644 --- a/crates/swc/tests/tsc-references/importImportOnlyModule_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importImportOnlyModule_es2015.1.normal.js @@ -9,6 +9,8 @@ C1.s1 = true; // @Filename: foo_1.ts const c1 = require('./foo_0'); // Makes this an external module var answer = 42; // No exports +export { }; // @Filename: foo_2.ts const foo = require("./foo_1"); var x = foo; // Cause a runtime dependency +export { }; diff --git a/crates/swc/tests/tsc-references/importImportOnlyModule_es2015.2.minified.js b/crates/swc/tests/tsc-references/importImportOnlyModule_es2015.2.minified.js index 84c0a46ab7e1..dc1a46b95ece 100644 --- a/crates/swc/tests/tsc-references/importImportOnlyModule_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importImportOnlyModule_es2015.2.minified.js @@ -3,4 +3,8 @@ export class C1 { this.m1 = 42; } } -C1.s1 = !0, require('./foo_0'), require("./foo_1"); +C1.s1 = !0; +require('./foo_0'); +export { }; +require("./foo_1"); +export { }; diff --git a/crates/swc/tests/tsc-references/importImportOnlyModule_es5.1.normal.js b/crates/swc/tests/tsc-references/importImportOnlyModule_es5.1.normal.js index cbf7456c0e15..a266fbaf43b6 100644 --- a/crates/swc/tests/tsc-references/importImportOnlyModule_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importImportOnlyModule_es5.1.normal.js @@ -10,6 +10,8 @@ C1.s1 = true; // @Filename: foo_1.ts var c1 = require("./foo_0"); // Makes this an external module var answer = 42; // No exports +export { }; // @Filename: foo_2.ts var foo = require("./foo_1"); var x = foo; // Cause a runtime dependency +export { }; diff --git a/crates/swc/tests/tsc-references/importImportOnlyModule_es5.2.minified.js b/crates/swc/tests/tsc-references/importImportOnlyModule_es5.2.minified.js index a747f563f19d..df004a9b76b4 100644 --- a/crates/swc/tests/tsc-references/importImportOnlyModule_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importImportOnlyModule_es5.2.minified.js @@ -3,4 +3,8 @@ export var C1 = function() { "use strict"; _class_call_check(this, C1), this.m1 = 42; }; -C1.s1 = !0, require("./foo_0"), require("./foo_1"); +C1.s1 = !0; +require("./foo_0"); +export { }; +require("./foo_1"); +export { }; diff --git a/crates/swc/tests/tsc-references/importNonExternalModule_es5.2.minified.js b/crates/swc/tests/tsc-references/importNonExternalModule_es5.2.minified.js index b3213446825d..f1152e24b6ba 100644 --- a/crates/swc/tests/tsc-references/importNonExternalModule_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importNonExternalModule_es5.2.minified.js @@ -1,4 +1,4 @@ +var foo; (foo || (foo = {})).answer = 42; -var foo = require("./foo_0"); -foo.answer; +require("./foo_0").answer; export { }; diff --git a/crates/swc/tests/tsc-references/importTsBeforeDTs_es2015.1.normal.js b/crates/swc/tests/tsc-references/importTsBeforeDTs_es2015.1.normal.js index d301e4506585..ae44df2664a9 100644 --- a/crates/swc/tests/tsc-references/importTsBeforeDTs_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importTsBeforeDTs_es2015.1.normal.js @@ -7,3 +7,4 @@ export var y = 42; const foo = require("./foo_0"); var z1 = foo.x + 10; // Should error, as .ts preferred over .d.ts var z2 = foo.y + 10; // Should resolve +export { }; diff --git a/crates/swc/tests/tsc-references/importTsBeforeDTs_es2015.2.minified.js b/crates/swc/tests/tsc-references/importTsBeforeDTs_es2015.2.minified.js index 48cd017450fb..9661451ad0dc 100644 --- a/crates/swc/tests/tsc-references/importTsBeforeDTs_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importTsBeforeDTs_es2015.2.minified.js @@ -2,3 +2,4 @@ export var x = 42; export var y = 42; let foo = require("./foo_0"); foo.x, foo.y; +export { }; diff --git a/crates/swc/tests/tsc-references/importTsBeforeDTs_es5.1.normal.js b/crates/swc/tests/tsc-references/importTsBeforeDTs_es5.1.normal.js index f0a1b7aabafb..df364827ad15 100644 --- a/crates/swc/tests/tsc-references/importTsBeforeDTs_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importTsBeforeDTs_es5.1.normal.js @@ -7,3 +7,4 @@ export var y = 42; var foo = require("./foo_0"); var z1 = foo.x + 10; // Should error, as .ts preferred over .d.ts var z2 = foo.y + 10; // Should resolve +export { }; diff --git a/crates/swc/tests/tsc-references/importTsBeforeDTs_es5.2.minified.js b/crates/swc/tests/tsc-references/importTsBeforeDTs_es5.2.minified.js index 1dda33820bbd..e8df97e56685 100644 --- a/crates/swc/tests/tsc-references/importTsBeforeDTs_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importTsBeforeDTs_es5.2.minified.js @@ -2,3 +2,4 @@ export var x = 42; export var y = 42; var foo = require("./foo_0"); foo.x, foo.y; +export { }; diff --git a/crates/swc/tests/tsc-references/importTypeAmdBundleRewrite_es2015.1.normal.js b/crates/swc/tests/tsc-references/importTypeAmdBundleRewrite_es2015.1.normal.js index 899a07984ad2..af2014013957 100644 --- a/crates/swc/tests/tsc-references/importTypeAmdBundleRewrite_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importTypeAmdBundleRewrite_es2015.1.normal.js @@ -2,6 +2,7 @@ // @module: amd // @outFile: bundle.js // @filename: a/b/c.ts +export { }; // @filename: a/inner.ts const c = { x: 12 diff --git a/crates/swc/tests/tsc-references/importTypeAmdBundleRewrite_es2015.2.minified.js b/crates/swc/tests/tsc-references/importTypeAmdBundleRewrite_es2015.2.minified.js index 78fb204078d2..f45422b6210f 100644 --- a/crates/swc/tests/tsc-references/importTypeAmdBundleRewrite_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importTypeAmdBundleRewrite_es2015.2.minified.js @@ -1,7 +1,9 @@ +export { }; let c = { x: 12 }; +export { c }; let d = { x: 12 }; -export { c, d }; +export { d }; diff --git a/crates/swc/tests/tsc-references/importTypeAmdBundleRewrite_es5.1.normal.js b/crates/swc/tests/tsc-references/importTypeAmdBundleRewrite_es5.1.normal.js index 442b9457aa6a..d99415b4b26c 100644 --- a/crates/swc/tests/tsc-references/importTypeAmdBundleRewrite_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importTypeAmdBundleRewrite_es5.1.normal.js @@ -2,6 +2,7 @@ // @module: amd // @outFile: bundle.js // @filename: a/b/c.ts +export { }; // @filename: a/inner.ts var c = { x: 12 diff --git a/crates/swc/tests/tsc-references/importTypeAmdBundleRewrite_es5.2.minified.js b/crates/swc/tests/tsc-references/importTypeAmdBundleRewrite_es5.2.minified.js index 31cb5a64548f..356018d3aafa 100644 --- a/crates/swc/tests/tsc-references/importTypeAmdBundleRewrite_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importTypeAmdBundleRewrite_es5.2.minified.js @@ -1,7 +1,9 @@ +export { }; var c = { x: 12 }; +export { c }; var d = { x: 12 }; -export { c, d }; +export { d }; diff --git a/crates/swc/tests/tsc-references/importTypeGenericTypes_es2015.1.normal.js b/crates/swc/tests/tsc-references/importTypeGenericTypes_es2015.1.normal.js index 4852da96b363..89946f52fbb5 100644 --- a/crates/swc/tests/tsc-references/importTypeGenericTypes_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importTypeGenericTypes_es2015.1.normal.js @@ -1,6 +1,9 @@ // @declaration: true // @lib: es6 // @filename: foo.ts +module.exports = Point; +export { }; +// @filename: foo2.ts class Bar { constructor(input){} } @@ -26,4 +29,3 @@ export class Bar2 { export let shim = { Bar: Bar2 }; -module.exports = Point; diff --git a/crates/swc/tests/tsc-references/importTypeGenericTypes_es2015.2.minified.js b/crates/swc/tests/tsc-references/importTypeGenericTypes_es2015.2.minified.js index 33a9348cd99d..63b89c7540d2 100644 --- a/crates/swc/tests/tsc-references/importTypeGenericTypes_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importTypeGenericTypes_es2015.2.minified.js @@ -1,6 +1,9 @@ +module.exports = Point; +export { }; class Bar { constructor(input){} } +export { Bar }; export const x = { x: 0, y: 0, @@ -21,5 +24,3 @@ export class Bar2 { export let shim = { Bar: Bar2 }; -module.exports = Point; -export { Bar }; diff --git a/crates/swc/tests/tsc-references/importTypeGenericTypes_es5.1.normal.js b/crates/swc/tests/tsc-references/importTypeGenericTypes_es5.1.normal.js index 467f8b74ad5a..4642dde7386d 100644 --- a/crates/swc/tests/tsc-references/importTypeGenericTypes_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importTypeGenericTypes_es5.1.normal.js @@ -1,6 +1,9 @@ // @declaration: true // @lib: es6 // @filename: foo.ts +module.exports = Point; +export { }; +// @filename: foo2.ts import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var Bar = function Bar(input) { "use strict"; @@ -8,6 +11,7 @@ var Bar = function Bar(input) { }; export { Bar }; // @filename: usage.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export var x = { x: 0, y: 0, @@ -29,4 +33,3 @@ export var Bar2 = function Bar2(input) { export var shim = { Bar: Bar2 }; -module.exports = Point; diff --git a/crates/swc/tests/tsc-references/importTypeGenericTypes_es5.2.minified.js b/crates/swc/tests/tsc-references/importTypeGenericTypes_es5.2.minified.js index 762ca627b974..dde6b79eb2bf 100644 --- a/crates/swc/tests/tsc-references/importTypeGenericTypes_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importTypeGenericTypes_es5.2.minified.js @@ -1,8 +1,12 @@ +module.exports = Point; +export { }; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var Bar = function(input) { "use strict"; _class_call_check(this, Bar); }; +export { Bar }; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export var x = { x: 0, y: 0, @@ -24,5 +28,3 @@ export var Bar2 = function(input) { export var shim = { Bar: Bar2 }; -module.exports = Point; -export { Bar }; diff --git a/crates/swc/tests/tsc-references/importTypeInJSDoc_es2015.1.normal.js b/crates/swc/tests/tsc-references/importTypeInJSDoc_es2015.1.normal.js index 6b5298331ae9..9addf71cc3ef 100644 --- a/crates/swc/tests/tsc-references/importTypeInJSDoc_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importTypeInJSDoc_es2015.1.normal.js @@ -3,6 +3,8 @@ // @allowJs: true // @checkJs: true // @filename: externs.d.ts +module.exports = MyClass; +export { }; // @filename: index.js /** * @typedef {import("./externs")} Foo @@ -14,5 +16,3 @@ const q = /** @type {import("./externs").Bar} */ ({ doer: (q)=>q }); const r = /** @type {typeof import("./externs").Bar} */ ((r)=>r); -module.exports = MyClass; -export { }; diff --git a/crates/swc/tests/tsc-references/importTypeInJSDoc_es2015.2.minified.js b/crates/swc/tests/tsc-references/importTypeInJSDoc_es2015.2.minified.js index fe69ffd09d09..058ba3e61401 100644 --- a/crates/swc/tests/tsc-references/importTypeInJSDoc_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importTypeInJSDoc_es2015.2.minified.js @@ -1,4 +1,5 @@ +module.exports = MyClass; +export { }; new Foo({ doer: Foo.Bar -}), module.exports = MyClass; -export { }; +}); diff --git a/crates/swc/tests/tsc-references/importTypeInJSDoc_es5.1.normal.js b/crates/swc/tests/tsc-references/importTypeInJSDoc_es5.1.normal.js index a45c34e79540..28e041857cda 100644 --- a/crates/swc/tests/tsc-references/importTypeInJSDoc_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importTypeInJSDoc_es5.1.normal.js @@ -3,6 +3,8 @@ // @allowJs: true // @checkJs: true // @filename: externs.d.ts +module.exports = MyClass; +export { }; // @filename: index.js /** * @typedef {import("./externs")} Foo @@ -18,5 +20,3 @@ var q = /** @type {import("./externs").Bar} */ ({ var r = /** @type {typeof import("./externs").Bar} */ function(r) { return r; }; -module.exports = MyClass; -export { }; diff --git a/crates/swc/tests/tsc-references/importTypeInJSDoc_es5.2.minified.js b/crates/swc/tests/tsc-references/importTypeInJSDoc_es5.2.minified.js index fe69ffd09d09..058ba3e61401 100644 --- a/crates/swc/tests/tsc-references/importTypeInJSDoc_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importTypeInJSDoc_es5.2.minified.js @@ -1,4 +1,5 @@ +module.exports = MyClass; +export { }; new Foo({ doer: Foo.Bar -}), module.exports = MyClass; -export { }; +}); diff --git a/crates/swc/tests/tsc-references/importTypeLocalMissing_es2015.1.normal.js b/crates/swc/tests/tsc-references/importTypeLocalMissing_es2015.1.normal.js index ee913add08e8..35da7c419921 100644 --- a/crates/swc/tests/tsc-references/importTypeLocalMissing_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importTypeLocalMissing_es2015.1.normal.js @@ -1,6 +1,9 @@ // @declaration: true // @lib: es6 // @filename: foo.ts +module.exports = Point; +export { }; +// @filename: foo2.ts class Bar { constructor(input){} } @@ -24,4 +27,3 @@ export class Bar2 { export let shim = { Bar: Bar2 }; -module.exports = Point; diff --git a/crates/swc/tests/tsc-references/importTypeLocalMissing_es2015.2.minified.js b/crates/swc/tests/tsc-references/importTypeLocalMissing_es2015.2.minified.js index 73d7eff46d6f..95af08da2435 100644 --- a/crates/swc/tests/tsc-references/importTypeLocalMissing_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importTypeLocalMissing_es2015.2.minified.js @@ -1,6 +1,9 @@ +module.exports = Point; +export { }; class Bar { constructor(input){} } +export { Bar }; export const x = { x: 0, y: 0 @@ -19,5 +22,3 @@ export class Bar2 { export let shim = { Bar: Bar2 }; -module.exports = Point; -export { Bar }; diff --git a/crates/swc/tests/tsc-references/importTypeLocalMissing_es5.1.normal.js b/crates/swc/tests/tsc-references/importTypeLocalMissing_es5.1.normal.js index 68cf67a4feaa..2d14835137ac 100644 --- a/crates/swc/tests/tsc-references/importTypeLocalMissing_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importTypeLocalMissing_es5.1.normal.js @@ -1,6 +1,9 @@ // @declaration: true // @lib: es6 // @filename: foo.ts +module.exports = Point; +export { }; +// @filename: foo2.ts import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var Bar = function Bar(input) { "use strict"; @@ -8,6 +11,7 @@ var Bar = function Bar(input) { }; export { Bar }; // @filename: usage.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export var x = { x: 0, y: 0 @@ -27,4 +31,3 @@ export var Bar2 = function Bar2(input) { export var shim = { Bar: Bar2 }; -module.exports = Point; diff --git a/crates/swc/tests/tsc-references/importTypeLocalMissing_es5.2.minified.js b/crates/swc/tests/tsc-references/importTypeLocalMissing_es5.2.minified.js index 6f5a40366a94..225ebd2ee095 100644 --- a/crates/swc/tests/tsc-references/importTypeLocalMissing_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importTypeLocalMissing_es5.2.minified.js @@ -1,8 +1,12 @@ +module.exports = Point; +export { }; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var Bar = function(input) { "use strict"; _class_call_check(this, Bar); }; +export { Bar }; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export var x = { x: 0, y: 0 @@ -22,5 +26,3 @@ export var Bar2 = function(input) { export var shim = { Bar: Bar2 }; -module.exports = Point; -export { Bar }; diff --git a/crates/swc/tests/tsc-references/importTypeLocal_es2015.1.normal.js b/crates/swc/tests/tsc-references/importTypeLocal_es2015.1.normal.js index d6a0a3865bcd..0d810b9ac19d 100644 --- a/crates/swc/tests/tsc-references/importTypeLocal_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importTypeLocal_es2015.1.normal.js @@ -1,6 +1,9 @@ // @declaration: true // @lib: es6 // @filename: foo.ts +module.exports = Point; +export { }; +// @filename: foo2.ts class Bar { constructor(input){} } @@ -20,4 +23,3 @@ export class Bar2 { export let shim = { Bar: Bar2 }; -module.exports = Point; diff --git a/crates/swc/tests/tsc-references/importTypeLocal_es2015.2.minified.js b/crates/swc/tests/tsc-references/importTypeLocal_es2015.2.minified.js index d7bb58c9723e..d858a31e33fd 100644 --- a/crates/swc/tests/tsc-references/importTypeLocal_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importTypeLocal_es2015.2.minified.js @@ -1,6 +1,9 @@ +module.exports = Point; +export { }; class Bar { constructor(input){} } +export { Bar }; export const x = { x: 0, y: 0 @@ -15,5 +18,3 @@ export class Bar2 { export let shim = { Bar: Bar2 }; -module.exports = Point; -export { Bar }; diff --git a/crates/swc/tests/tsc-references/importTypeLocal_es5.1.normal.js b/crates/swc/tests/tsc-references/importTypeLocal_es5.1.normal.js index 259627ff3b03..c326da0d2144 100644 --- a/crates/swc/tests/tsc-references/importTypeLocal_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importTypeLocal_es5.1.normal.js @@ -1,6 +1,9 @@ // @declaration: true // @lib: es6 // @filename: foo.ts +module.exports = Point; +export { }; +// @filename: foo2.ts import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var Bar = function Bar(input) { "use strict"; @@ -8,6 +11,7 @@ var Bar = function Bar(input) { }; export { Bar }; // @filename: usage.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export var x = { x: 0, y: 0 @@ -23,4 +27,3 @@ export var Bar2 = function Bar2(input) { export var shim = { Bar: Bar2 }; -module.exports = Point; diff --git a/crates/swc/tests/tsc-references/importTypeLocal_es5.2.minified.js b/crates/swc/tests/tsc-references/importTypeLocal_es5.2.minified.js index cdacbb7d995b..024529f39905 100644 --- a/crates/swc/tests/tsc-references/importTypeLocal_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importTypeLocal_es5.2.minified.js @@ -1,8 +1,12 @@ +module.exports = Point; +export { }; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var Bar = function(input) { "use strict"; _class_call_check(this, Bar); }; +export { Bar }; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export var x = { x: 0, y: 0 @@ -18,5 +22,3 @@ export var Bar2 = function(input) { export var shim = { Bar: Bar2 }; -module.exports = Point; -export { Bar }; diff --git a/crates/swc/tests/tsc-references/importsImplicitlyReadonly_es2015.1.normal.js b/crates/swc/tests/tsc-references/importsImplicitlyReadonly_es2015.1.normal.js index 748c8a0ce811..5bb3cd224cdf 100644 --- a/crates/swc/tests/tsc-references/importsImplicitlyReadonly_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importsImplicitlyReadonly_es2015.1.normal.js @@ -3,14 +3,31 @@ export var x = 1; var y = 1; export { y }; -import * as a1 from "./a"; -const a2 = require("./a"); -const a3 = a1; -x = 1; // Error -y = 1; // Error -a1.x = 1; // Error -a1.y = 1; // Error -a2.x = 1; -a2.y = 1; -a3.x = 1; -a3.y = 1; +// @filename: b.ts +//! +//! x cannot reassign to an imported binding +//! ,-[2:1] +//! 2 | import { x, y } from "./a"; +//! : | +//! : `-- imported binding +//! 3 | import * as a1 from "./a"; +//! 4 | import a2 = require("./a"); +//! 5 | const a3 = a1; +//! 6 | +//! 7 | x = 1; // Error +//! : ^ +//! `---- +//! +//! x cannot reassign to an imported binding +//! ,-[2:1] +//! 2 | import { x, y } from "./a"; +//! : | +//! : `-- imported binding +//! 3 | import * as a1 from "./a"; +//! 4 | import a2 = require("./a"); +//! 5 | const a3 = a1; +//! 6 | +//! 7 | x = 1; // Error +//! 8 | y = 1; // Error +//! : ^ +//! `---- diff --git a/crates/swc/tests/tsc-references/importsImplicitlyReadonly_es2015.2.minified.js b/crates/swc/tests/tsc-references/importsImplicitlyReadonly_es2015.2.minified.js index b33234a91d7c..c7da3c366d9d 100644 --- a/crates/swc/tests/tsc-references/importsImplicitlyReadonly_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importsImplicitlyReadonly_es2015.2.minified.js @@ -1,6 +1,31 @@ export var x = 1; var y = 1; -import * as a1 from "./a"; -let a2 = require("./a"), a3 = a1; -y = 1, a1.x = 1, a1.y = 1, a2.x = 1, a2.y = 1, a3.x = 1, a3.y = 1; export { y }; +// @filename: b.ts +//! +//! x cannot reassign to an imported binding +//! ,-[2:1] +//! 2 | import { x, y } from "./a"; +//! : | +//! : `-- imported binding +//! 3 | import * as a1 from "./a"; +//! 4 | import a2 = require("./a"); +//! 5 | const a3 = a1; +//! 6 | +//! 7 | x = 1; // Error +//! : ^ +//! `---- +//! +//! x cannot reassign to an imported binding +//! ,-[2:1] +//! 2 | import { x, y } from "./a"; +//! : | +//! : `-- imported binding +//! 3 | import * as a1 from "./a"; +//! 4 | import a2 = require("./a"); +//! 5 | const a3 = a1; +//! 6 | +//! 7 | x = 1; // Error +//! 8 | y = 1; // Error +//! : ^ +//! `---- diff --git a/crates/swc/tests/tsc-references/importsImplicitlyReadonly_es5.1.normal.js b/crates/swc/tests/tsc-references/importsImplicitlyReadonly_es5.1.normal.js index 6eb0e592409a..5bb3cd224cdf 100644 --- a/crates/swc/tests/tsc-references/importsImplicitlyReadonly_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importsImplicitlyReadonly_es5.1.normal.js @@ -3,14 +3,31 @@ export var x = 1; var y = 1; export { y }; -import * as a1 from "./a"; -var a2 = require("./a"); -var a3 = a1; -x = 1; // Error -y = 1; // Error -a1.x = 1; // Error -a1.y = 1; // Error -a2.x = 1; -a2.y = 1; -a3.x = 1; -a3.y = 1; +// @filename: b.ts +//! +//! x cannot reassign to an imported binding +//! ,-[2:1] +//! 2 | import { x, y } from "./a"; +//! : | +//! : `-- imported binding +//! 3 | import * as a1 from "./a"; +//! 4 | import a2 = require("./a"); +//! 5 | const a3 = a1; +//! 6 | +//! 7 | x = 1; // Error +//! : ^ +//! `---- +//! +//! x cannot reassign to an imported binding +//! ,-[2:1] +//! 2 | import { x, y } from "./a"; +//! : | +//! : `-- imported binding +//! 3 | import * as a1 from "./a"; +//! 4 | import a2 = require("./a"); +//! 5 | const a3 = a1; +//! 6 | +//! 7 | x = 1; // Error +//! 8 | y = 1; // Error +//! : ^ +//! `---- diff --git a/crates/swc/tests/tsc-references/importsImplicitlyReadonly_es5.2.minified.js b/crates/swc/tests/tsc-references/importsImplicitlyReadonly_es5.2.minified.js index 0e84c533e8c1..c7da3c366d9d 100644 --- a/crates/swc/tests/tsc-references/importsImplicitlyReadonly_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importsImplicitlyReadonly_es5.2.minified.js @@ -1,6 +1,31 @@ export var x = 1; var y = 1; -import * as a1 from "./a"; -var a2 = require("./a"), a3 = a1; -y = 1, a1.x = 1, a1.y = 1, a2.x = 1, a2.y = 1, a3.x = 1, a3.y = 1; export { y }; +// @filename: b.ts +//! +//! x cannot reassign to an imported binding +//! ,-[2:1] +//! 2 | import { x, y } from "./a"; +//! : | +//! : `-- imported binding +//! 3 | import * as a1 from "./a"; +//! 4 | import a2 = require("./a"); +//! 5 | const a3 = a1; +//! 6 | +//! 7 | x = 1; // Error +//! : ^ +//! `---- +//! +//! x cannot reassign to an imported binding +//! ,-[2:1] +//! 2 | import { x, y } from "./a"; +//! : | +//! : `-- imported binding +//! 3 | import * as a1 from "./a"; +//! 4 | import a2 = require("./a"); +//! 5 | const a3 = a1; +//! 6 | +//! 7 | x = 1; // Error +//! 8 | y = 1; // Error +//! : ^ +//! `---- diff --git a/crates/swc/tests/tsc-references/importsNotUsedAsValues_error_es2015.1.normal.js b/crates/swc/tests/tsc-references/importsNotUsedAsValues_error_es2015.1.normal.js index 8e5dad25bdc7..2455978e6007 100644 --- a/crates/swc/tests/tsc-references/importsNotUsedAsValues_error_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/importsNotUsedAsValues_error_es2015.1.normal.js @@ -10,39 +10,58 @@ export var C; C[C["One"] = 0] = "One"; C[C["Two"] = 1] = "Two"; })(C || (C = {})); +// @Filename: /b.ts let a; let b; console.log(a, b); +export { }; +// @Filename: /c.ts let a; let b; console.log(a, b); +export { }; +// @Filename: /d.ts +import { A } from './a'; const a = A; let b; console.log(a, b); -0; -let c = 1; -let d = 1; +// @Filename: /e.ts +export { }; // noUnusedLocals error only +// @Filename: /f.ts +import { C } from './a'; +C.One; +let c = C.Two; +let d = C.Two; console.log(c, d); +// @Filename: /g.ts let c; let d; console.log(c, d); +export { }; // @Filename: /h.ts class H { } +module.exports = H; +export { }; // @Filename: /i.ts const H = require('./h'); // Error let h = {}; console.log(h); +export { }; // @Filename: /j.ts const H = require('./h'); // noUnusedLocals error only -var // @Filename: /k.ts -K; +export { }; +// @Filename: /k.ts +var K; (function(K) { K[K["One"] = 0] = "One"; K[K["Two"] = 1] = "Two"; })(K || (K = {})); +module.exports = K; +export { }; // @Filename: /l.ts const K = require('./k'); -0; // @Filename: /j.ts - // Sad face https://github.com/microsoft/TypeScript/blob/6b04f5039429b9d412696fe2febe39ecc69ad365/src/testRunner/compilerRunner.ts#L207 -module.exports = H; +K.One; +export { }; +// @Filename: /j.ts +// Sad face https://github.com/microsoft/TypeScript/blob/6b04f5039429b9d412696fe2febe39ecc69ad365/src/testRunner/compilerRunner.ts#L207 diff --git a/crates/swc/tests/tsc-references/importsNotUsedAsValues_error_es2015.2.minified.js b/crates/swc/tests/tsc-references/importsNotUsedAsValues_error_es2015.2.minified.js index 83aa09d54f59..a031c2042e4a 100644 --- a/crates/swc/tests/tsc-references/importsNotUsedAsValues_error_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/importsNotUsedAsValues_error_es2015.2.minified.js @@ -1,4 +1,3 @@ -var K; export default class { }; export class A { @@ -9,17 +8,33 @@ export var C; }(C || (C = {})); let a, b; console.log(a, b); +export { }; let a, b; console.log(a, b); -let a = A, b; -console.log(a, b), console.log(1, 1), console.log(1, 1); -class H { -} -let H = require('./h'); -console.log({}); -let H = require('./h'); +export { }; +import { A } from './a'; +let b; +console.log(A, b); +export { }; +import { C } from './a'; +C.One; +let c = C.Two, d = C.Two; +console.log(c, d); +let c, d; +console.log(c, d); +export { }; +module.exports = class { +}; +export { }; +require('./h'), console.log({}); +export { }; +require('./h'); +export { }; +var K; !function(K) { K[K.One = 0] = "One", K[K.Two = 1] = "Two"; -}(K || (K = {})); +}(K || (K = {})), module.exports = K; +export { }; let K = require('./k'); -module.exports = H; +K.One; +export { }; diff --git a/crates/swc/tests/tsc-references/importsNotUsedAsValues_error_es5.1.normal.js b/crates/swc/tests/tsc-references/importsNotUsedAsValues_error_es5.1.normal.js index a2172e1a051a..2e5e22e224ae 100644 --- a/crates/swc/tests/tsc-references/importsNotUsedAsValues_error_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/importsNotUsedAsValues_error_es5.1.normal.js @@ -16,41 +16,61 @@ export var C; C[C["One"] = 0] = "One"; C[C["Two"] = 1] = "Two"; })(C || (C = {})); +// @Filename: /b.ts var a; var b; console.log(a, b); +export { }; +// @Filename: /c.ts var a; var b; console.log(a, b); +export { }; +// @Filename: /d.ts +import { A } from "./a"; var a = A; var b; console.log(a, b); -0; -var c = 1; -var d = 1; +// @Filename: /e.ts +export { }; // noUnusedLocals error only +// @Filename: /f.ts +import { C } from "./a"; +C.One; +var c = C.Two; +var d = C.Two; console.log(c, d); +// @Filename: /g.ts var c; var d; console.log(c, d); +export { }; // @Filename: /h.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var H = function H() { "use strict"; _class_call_check(this, H); }; +module.exports = H; +export { }; // @Filename: /i.ts var H = require("./h"); // Error var h = {}; console.log(h); +export { }; // @Filename: /j.ts var H = require("./h"); // noUnusedLocals error only -var // @Filename: /k.ts -K; +export { }; +// @Filename: /k.ts +var K; (function(K) { K[K["One"] = 0] = "One"; K[K["Two"] = 1] = "Two"; })(K || (K = {})); +module.exports = K; +export { }; // @Filename: /l.ts var K = require("./k"); -0; // @Filename: /j.ts - // Sad face https://github.com/microsoft/TypeScript/blob/6b04f5039429b9d412696fe2febe39ecc69ad365/src/testRunner/compilerRunner.ts#L207 -module.exports = H; +K.One; +export { }; +// @Filename: /j.ts +// Sad face https://github.com/microsoft/TypeScript/blob/6b04f5039429b9d412696fe2febe39ecc69ad365/src/testRunner/compilerRunner.ts#L207 diff --git a/crates/swc/tests/tsc-references/importsNotUsedAsValues_error_es5.2.minified.js b/crates/swc/tests/tsc-references/importsNotUsedAsValues_error_es5.2.minified.js index 3baa8ff113c6..2820dba4ea60 100644 --- a/crates/swc/tests/tsc-references/importsNotUsedAsValues_error_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/importsNotUsedAsValues_error_es5.2.minified.js @@ -1,5 +1,5 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var a, b, c, d, K, _default = function() { +var _default = function() { "use strict"; _class_call_check(this, _default); }; @@ -10,17 +10,39 @@ export var A = function() { export var C; !function(C) { C[C.One = 0] = "One", C[C.Two = 1] = "Two"; -}(C || (C = {})), console.log(a, b), console.log(a, b); -var a = A; +}(C || (C = {})); +export { _default as default }; +var a, b; +console.log(a, b); +export { }; +var a, b; console.log(a, b); -var c = 1, d = 1; -console.log(c, d), console.log(c, d); -var H = require("./h"); -console.log({}); -var H = require("./h"); +export { }; +var b; +import { A } from "./a"; +console.log(A, b); +export { }; +import { C } from "./a"; +C.One; +var c = C.Two, d = C.Two; +console.log(c, d); +var c, d; +console.log(c, d); +export { }; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +var H = function() { + "use strict"; + _class_call_check(this, H); +}; +module.exports = H; +require("./h"), console.log({}); +export { }; +require("./h"); +export { }; +var K; !function(K) { K[K.One = 0] = "One", K[K.Two = 1] = "Two"; -}(K || (K = {})); -var K = require("./k"); -module.exports = H; -export { _default as default }; +}(K || (K = {})), module.exports = K; +export { }; +require("./k").One; +export { }; diff --git a/crates/swc/tests/tsc-references/incrementOperatorWithEnumTypeInvalidOperations_es2015.1.normal.js b/crates/swc/tests/tsc-references/incrementOperatorWithEnumTypeInvalidOperations_es2015.1.normal.js index a1e3936adf6a..f1b050a1362b 100644 --- a/crates/swc/tests/tsc-references/incrementOperatorWithEnumTypeInvalidOperations_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/incrementOperatorWithEnumTypeInvalidOperations_es2015.1.normal.js @@ -1,22 +1,18 @@ -var // ++ operator on enum type -ENUM; -(function(ENUM) {})(ENUM || (ENUM = {})); -var ENUM1; -(function(ENUM1) { - ENUM1[ENUM1["A"] = 0] = "A"; - ENUM1[ENUM1["B"] = 1] = "B"; - ENUM1[ENUM1[""] = 2] = ""; -})(ENUM1 || (ENUM1 = {})); -// enum type var -var ResultIsNumber1 = ++ENUM; -var ResultIsNumber2 = ++ENUM1; -var ResultIsNumber3 = ENUM++; -var ResultIsNumber4 = ENUM1++; -// enum type expressions -var ResultIsNumber5 = ++ENUM[1] + ENUM[2]; -var ResultIsNumber6 = ENUM[1] + ENUM[2]++; -// miss assignment operator -++ENUM; -++ENUM1; -ENUM++; -ENUM1++; +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 14 | var ResultIsNumber5 = ++(ENUM[1] + ENUM[2]); +//! : ^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 15 | var ResultIsNumber6 = (ENUM[1] + ENUM[2])++; +//! : ^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/incrementOperatorWithEnumTypeInvalidOperations_es2015.2.minified.js b/crates/swc/tests/tsc-references/incrementOperatorWithEnumTypeInvalidOperations_es2015.2.minified.js index 39951d0e7bf7..f1b050a1362b 100644 --- a/crates/swc/tests/tsc-references/incrementOperatorWithEnumTypeInvalidOperations_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/incrementOperatorWithEnumTypeInvalidOperations_es2015.2.minified.js @@ -1,4 +1,18 @@ -var ENUM, ENUM1; -!function(ENUM1) { - ENUM1[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = ""; -}(ENUM1 || (ENUM1 = {})), ++ENUM, ++ENUM1, ENUM++, ENUM1++, ++ENUM[1] + ENUM[2], ENUM[1] + ENUM[2]++, ++ENUM, ++ENUM1, ENUM++, ENUM1++; +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 14 | var ResultIsNumber5 = ++(ENUM[1] + ENUM[2]); +//! : ^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 15 | var ResultIsNumber6 = (ENUM[1] + ENUM[2])++; +//! : ^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/incrementOperatorWithEnumTypeInvalidOperations_es5.1.normal.js b/crates/swc/tests/tsc-references/incrementOperatorWithEnumTypeInvalidOperations_es5.1.normal.js index a1e3936adf6a..f1b050a1362b 100644 --- a/crates/swc/tests/tsc-references/incrementOperatorWithEnumTypeInvalidOperations_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/incrementOperatorWithEnumTypeInvalidOperations_es5.1.normal.js @@ -1,22 +1,18 @@ -var // ++ operator on enum type -ENUM; -(function(ENUM) {})(ENUM || (ENUM = {})); -var ENUM1; -(function(ENUM1) { - ENUM1[ENUM1["A"] = 0] = "A"; - ENUM1[ENUM1["B"] = 1] = "B"; - ENUM1[ENUM1[""] = 2] = ""; -})(ENUM1 || (ENUM1 = {})); -// enum type var -var ResultIsNumber1 = ++ENUM; -var ResultIsNumber2 = ++ENUM1; -var ResultIsNumber3 = ENUM++; -var ResultIsNumber4 = ENUM1++; -// enum type expressions -var ResultIsNumber5 = ++ENUM[1] + ENUM[2]; -var ResultIsNumber6 = ENUM[1] + ENUM[2]++; -// miss assignment operator -++ENUM; -++ENUM1; -ENUM++; -ENUM1++; +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 14 | var ResultIsNumber5 = ++(ENUM[1] + ENUM[2]); +//! : ^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 15 | var ResultIsNumber6 = (ENUM[1] + ENUM[2])++; +//! : ^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/incrementOperatorWithEnumTypeInvalidOperations_es5.2.minified.js b/crates/swc/tests/tsc-references/incrementOperatorWithEnumTypeInvalidOperations_es5.2.minified.js index 39951d0e7bf7..f1b050a1362b 100644 --- a/crates/swc/tests/tsc-references/incrementOperatorWithEnumTypeInvalidOperations_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/incrementOperatorWithEnumTypeInvalidOperations_es5.2.minified.js @@ -1,4 +1,18 @@ -var ENUM, ENUM1; -!function(ENUM1) { - ENUM1[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = ""; -}(ENUM1 || (ENUM1 = {})), ++ENUM, ++ENUM1, ENUM++, ENUM1++, ++ENUM[1] + ENUM[2], ENUM[1] + ENUM[2]++, ++ENUM, ++ENUM1, ENUM++, ENUM1++; +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 14 | var ResultIsNumber5 = ++(ENUM[1] + ENUM[2]); +//! : ^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 15 | var ResultIsNumber6 = (ENUM[1] + ENUM[2])++; +//! : ^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/incrementOperatorWithNumberTypeInvalidOperations_es2015.1.normal.js b/crates/swc/tests/tsc-references/incrementOperatorWithNumberTypeInvalidOperations_es2015.1.normal.js new file mode 100644 index 000000000000..007285e2d464 --- /dev/null +++ b/crates/swc/tests/tsc-references/incrementOperatorWithNumberTypeInvalidOperations_es2015.1.normal.js @@ -0,0 +1,102 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 22 | var ResultIsNumber3 = ++1; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 23 | var ResultIsNumber4 = ++{ x: 1, y: 2}; +//! : ^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 24 | var ResultIsNumber5 = ++{ x: 1, y: (n: number) => { return n; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 26 | var ResultIsNumber6 = 1++; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 27 | var ResultIsNumber7 = { x: 1, y: 2 }++; +//! : ^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 28 | var ResultIsNumber8 = { x: 1, y: (n: number) => { return n; } }++; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 31 | var ResultIsNumber9 = ++foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 32 | var ResultIsNumber10 = ++A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 33 | var ResultIsNumber11 = ++(NUMBER + NUMBER); +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 35 | var ResultIsNumber12 = foo()++; +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 36 | var ResultIsNumber13 = A.foo()++; +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 37 | var ResultIsNumber14 = (NUMBER + NUMBER)++; +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 40 | ++1; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 42 | ++foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 44 | 1++; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 46 | foo()++; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/incrementOperatorWithNumberTypeInvalidOperations_es2015.2.minified.js b/crates/swc/tests/tsc-references/incrementOperatorWithNumberTypeInvalidOperations_es2015.2.minified.js new file mode 100644 index 000000000000..007285e2d464 --- /dev/null +++ b/crates/swc/tests/tsc-references/incrementOperatorWithNumberTypeInvalidOperations_es2015.2.minified.js @@ -0,0 +1,102 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 22 | var ResultIsNumber3 = ++1; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 23 | var ResultIsNumber4 = ++{ x: 1, y: 2}; +//! : ^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 24 | var ResultIsNumber5 = ++{ x: 1, y: (n: number) => { return n; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 26 | var ResultIsNumber6 = 1++; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 27 | var ResultIsNumber7 = { x: 1, y: 2 }++; +//! : ^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 28 | var ResultIsNumber8 = { x: 1, y: (n: number) => { return n; } }++; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 31 | var ResultIsNumber9 = ++foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 32 | var ResultIsNumber10 = ++A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 33 | var ResultIsNumber11 = ++(NUMBER + NUMBER); +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 35 | var ResultIsNumber12 = foo()++; +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 36 | var ResultIsNumber13 = A.foo()++; +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 37 | var ResultIsNumber14 = (NUMBER + NUMBER)++; +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 40 | ++1; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 42 | ++foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 44 | 1++; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 46 | foo()++; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/incrementOperatorWithNumberTypeInvalidOperations_es5.1.normal.js b/crates/swc/tests/tsc-references/incrementOperatorWithNumberTypeInvalidOperations_es5.1.normal.js new file mode 100644 index 000000000000..007285e2d464 --- /dev/null +++ b/crates/swc/tests/tsc-references/incrementOperatorWithNumberTypeInvalidOperations_es5.1.normal.js @@ -0,0 +1,102 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 22 | var ResultIsNumber3 = ++1; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 23 | var ResultIsNumber4 = ++{ x: 1, y: 2}; +//! : ^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 24 | var ResultIsNumber5 = ++{ x: 1, y: (n: number) => { return n; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 26 | var ResultIsNumber6 = 1++; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 27 | var ResultIsNumber7 = { x: 1, y: 2 }++; +//! : ^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 28 | var ResultIsNumber8 = { x: 1, y: (n: number) => { return n; } }++; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 31 | var ResultIsNumber9 = ++foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 32 | var ResultIsNumber10 = ++A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 33 | var ResultIsNumber11 = ++(NUMBER + NUMBER); +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 35 | var ResultIsNumber12 = foo()++; +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 36 | var ResultIsNumber13 = A.foo()++; +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 37 | var ResultIsNumber14 = (NUMBER + NUMBER)++; +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 40 | ++1; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 42 | ++foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 44 | 1++; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 46 | foo()++; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/incrementOperatorWithNumberTypeInvalidOperations_es5.2.minified.js b/crates/swc/tests/tsc-references/incrementOperatorWithNumberTypeInvalidOperations_es5.2.minified.js new file mode 100644 index 000000000000..007285e2d464 --- /dev/null +++ b/crates/swc/tests/tsc-references/incrementOperatorWithNumberTypeInvalidOperations_es5.2.minified.js @@ -0,0 +1,102 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 22 | var ResultIsNumber3 = ++1; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 23 | var ResultIsNumber4 = ++{ x: 1, y: 2}; +//! : ^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 24 | var ResultIsNumber5 = ++{ x: 1, y: (n: number) => { return n; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 26 | var ResultIsNumber6 = 1++; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 27 | var ResultIsNumber7 = { x: 1, y: 2 }++; +//! : ^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 28 | var ResultIsNumber8 = { x: 1, y: (n: number) => { return n; } }++; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 31 | var ResultIsNumber9 = ++foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 32 | var ResultIsNumber10 = ++A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 33 | var ResultIsNumber11 = ++(NUMBER + NUMBER); +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 35 | var ResultIsNumber12 = foo()++; +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 36 | var ResultIsNumber13 = A.foo()++; +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 37 | var ResultIsNumber14 = (NUMBER + NUMBER)++; +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 40 | ++1; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 42 | ++foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 44 | 1++; +//! : ^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 46 | foo()++; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/incrementOperatorWithUnsupportedBooleanType_es2015.1.normal.js b/crates/swc/tests/tsc-references/incrementOperatorWithUnsupportedBooleanType_es2015.1.normal.js new file mode 100644 index 000000000000..695d8e0c8c3b --- /dev/null +++ b/crates/swc/tests/tsc-references/incrementOperatorWithUnsupportedBooleanType_es2015.1.normal.js @@ -0,0 +1,90 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 22 | var ResultIsNumber3 = ++true; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 23 | var ResultIsNumber4 = ++{ x: true, y: false }; +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 24 | var ResultIsNumber5 = ++{ x: true, y: (n: boolean) => { return n; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 26 | var ResultIsNumber6 = true++; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 27 | var ResultIsNumber7 = { x: true, y: false }++; +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 28 | var ResultIsNumber8 = { x: true, y: (n: boolean) => { return n; } }++; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 33 | var ResultIsNumber11 = ++foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 34 | var ResultIsNumber12 = ++A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 36 | var ResultIsNumber13 = foo()++; +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 37 | var ResultIsNumber14 = A.foo()++; +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 42 | ++true; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 44 | ++foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 49 | true++; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 51 | foo()++; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/incrementOperatorWithUnsupportedBooleanType_es2015.2.minified.js b/crates/swc/tests/tsc-references/incrementOperatorWithUnsupportedBooleanType_es2015.2.minified.js new file mode 100644 index 000000000000..695d8e0c8c3b --- /dev/null +++ b/crates/swc/tests/tsc-references/incrementOperatorWithUnsupportedBooleanType_es2015.2.minified.js @@ -0,0 +1,90 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 22 | var ResultIsNumber3 = ++true; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 23 | var ResultIsNumber4 = ++{ x: true, y: false }; +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 24 | var ResultIsNumber5 = ++{ x: true, y: (n: boolean) => { return n; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 26 | var ResultIsNumber6 = true++; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 27 | var ResultIsNumber7 = { x: true, y: false }++; +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 28 | var ResultIsNumber8 = { x: true, y: (n: boolean) => { return n; } }++; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 33 | var ResultIsNumber11 = ++foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 34 | var ResultIsNumber12 = ++A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 36 | var ResultIsNumber13 = foo()++; +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 37 | var ResultIsNumber14 = A.foo()++; +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 42 | ++true; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 44 | ++foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 49 | true++; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 51 | foo()++; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/incrementOperatorWithUnsupportedBooleanType_es5.1.normal.js b/crates/swc/tests/tsc-references/incrementOperatorWithUnsupportedBooleanType_es5.1.normal.js new file mode 100644 index 000000000000..695d8e0c8c3b --- /dev/null +++ b/crates/swc/tests/tsc-references/incrementOperatorWithUnsupportedBooleanType_es5.1.normal.js @@ -0,0 +1,90 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 22 | var ResultIsNumber3 = ++true; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 23 | var ResultIsNumber4 = ++{ x: true, y: false }; +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 24 | var ResultIsNumber5 = ++{ x: true, y: (n: boolean) => { return n; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 26 | var ResultIsNumber6 = true++; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 27 | var ResultIsNumber7 = { x: true, y: false }++; +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 28 | var ResultIsNumber8 = { x: true, y: (n: boolean) => { return n; } }++; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 33 | var ResultIsNumber11 = ++foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 34 | var ResultIsNumber12 = ++A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 36 | var ResultIsNumber13 = foo()++; +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 37 | var ResultIsNumber14 = A.foo()++; +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 42 | ++true; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 44 | ++foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 49 | true++; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 51 | foo()++; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/incrementOperatorWithUnsupportedBooleanType_es5.2.minified.js b/crates/swc/tests/tsc-references/incrementOperatorWithUnsupportedBooleanType_es5.2.minified.js new file mode 100644 index 000000000000..695d8e0c8c3b --- /dev/null +++ b/crates/swc/tests/tsc-references/incrementOperatorWithUnsupportedBooleanType_es5.2.minified.js @@ -0,0 +1,90 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 22 | var ResultIsNumber3 = ++true; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 23 | var ResultIsNumber4 = ++{ x: true, y: false }; +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 24 | var ResultIsNumber5 = ++{ x: true, y: (n: boolean) => { return n; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 26 | var ResultIsNumber6 = true++; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 27 | var ResultIsNumber7 = { x: true, y: false }++; +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 28 | var ResultIsNumber8 = { x: true, y: (n: boolean) => { return n; } }++; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 33 | var ResultIsNumber11 = ++foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 34 | var ResultIsNumber12 = ++A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 36 | var ResultIsNumber13 = foo()++; +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 37 | var ResultIsNumber14 = A.foo()++; +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 42 | ++true; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 44 | ++foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 49 | true++; +//! : ^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 51 | foo()++; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/incrementOperatorWithUnsupportedStringType_es2015.1.normal.js b/crates/swc/tests/tsc-references/incrementOperatorWithUnsupportedStringType_es2015.1.normal.js new file mode 100644 index 000000000000..c741905b44b2 --- /dev/null +++ b/crates/swc/tests/tsc-references/incrementOperatorWithUnsupportedStringType_es2015.1.normal.js @@ -0,0 +1,102 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 25 | var ResultIsNumber5 = ++""; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 26 | var ResultIsNumber6 = ++{ x: "", y: "" }; +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 27 | var ResultIsNumber7 = ++{ x: "", y: (s: string) => { return s; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 29 | var ResultIsNumber8 = ""++; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 30 | var ResultIsNumber9 = { x: "", y: "" }++; +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 31 | var ResultIsNumber10 = { x: "", y: (s: string) => { return s; } }++; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 37 | var ResultIsNumber14 = ++foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 38 | var ResultIsNumber15 = ++A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 39 | var ResultIsNumber16 = ++(STRING + STRING); +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 44 | var ResultIsNumber20 = foo()++; +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 45 | var ResultIsNumber21 = A.foo()++; +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 46 | var ResultIsNumber22 = (STRING + STRING)++; +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 49 | ++""; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 53 | ++foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 58 | ""++; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 62 | foo()++; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/incrementOperatorWithUnsupportedStringType_es2015.2.minified.js b/crates/swc/tests/tsc-references/incrementOperatorWithUnsupportedStringType_es2015.2.minified.js new file mode 100644 index 000000000000..c741905b44b2 --- /dev/null +++ b/crates/swc/tests/tsc-references/incrementOperatorWithUnsupportedStringType_es2015.2.minified.js @@ -0,0 +1,102 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 25 | var ResultIsNumber5 = ++""; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 26 | var ResultIsNumber6 = ++{ x: "", y: "" }; +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 27 | var ResultIsNumber7 = ++{ x: "", y: (s: string) => { return s; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 29 | var ResultIsNumber8 = ""++; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 30 | var ResultIsNumber9 = { x: "", y: "" }++; +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 31 | var ResultIsNumber10 = { x: "", y: (s: string) => { return s; } }++; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 37 | var ResultIsNumber14 = ++foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 38 | var ResultIsNumber15 = ++A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 39 | var ResultIsNumber16 = ++(STRING + STRING); +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 44 | var ResultIsNumber20 = foo()++; +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 45 | var ResultIsNumber21 = A.foo()++; +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 46 | var ResultIsNumber22 = (STRING + STRING)++; +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 49 | ++""; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 53 | ++foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 58 | ""++; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 62 | foo()++; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/incrementOperatorWithUnsupportedStringType_es5.1.normal.js b/crates/swc/tests/tsc-references/incrementOperatorWithUnsupportedStringType_es5.1.normal.js new file mode 100644 index 000000000000..c741905b44b2 --- /dev/null +++ b/crates/swc/tests/tsc-references/incrementOperatorWithUnsupportedStringType_es5.1.normal.js @@ -0,0 +1,102 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 25 | var ResultIsNumber5 = ++""; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 26 | var ResultIsNumber6 = ++{ x: "", y: "" }; +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 27 | var ResultIsNumber7 = ++{ x: "", y: (s: string) => { return s; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 29 | var ResultIsNumber8 = ""++; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 30 | var ResultIsNumber9 = { x: "", y: "" }++; +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 31 | var ResultIsNumber10 = { x: "", y: (s: string) => { return s; } }++; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 37 | var ResultIsNumber14 = ++foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 38 | var ResultIsNumber15 = ++A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 39 | var ResultIsNumber16 = ++(STRING + STRING); +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 44 | var ResultIsNumber20 = foo()++; +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 45 | var ResultIsNumber21 = A.foo()++; +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 46 | var ResultIsNumber22 = (STRING + STRING)++; +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 49 | ++""; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 53 | ++foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 58 | ""++; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 62 | foo()++; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/incrementOperatorWithUnsupportedStringType_es5.2.minified.js b/crates/swc/tests/tsc-references/incrementOperatorWithUnsupportedStringType_es5.2.minified.js new file mode 100644 index 000000000000..c741905b44b2 --- /dev/null +++ b/crates/swc/tests/tsc-references/incrementOperatorWithUnsupportedStringType_es5.2.minified.js @@ -0,0 +1,102 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 25 | var ResultIsNumber5 = ++""; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 26 | var ResultIsNumber6 = ++{ x: "", y: "" }; +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 27 | var ResultIsNumber7 = ++{ x: "", y: (s: string) => { return s; } }; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 29 | var ResultIsNumber8 = ""++; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 30 | var ResultIsNumber9 = { x: "", y: "" }++; +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 31 | var ResultIsNumber10 = { x: "", y: (s: string) => { return s; } }++; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 37 | var ResultIsNumber14 = ++foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 38 | var ResultIsNumber15 = ++A.foo(); +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 39 | var ResultIsNumber16 = ++(STRING + STRING); +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 44 | var ResultIsNumber20 = foo()++; +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 45 | var ResultIsNumber21 = A.foo()++; +//! : ^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 46 | var ResultIsNumber22 = (STRING + STRING)++; +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 49 | ++""; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 53 | ++foo(); +//! : ^^^^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 58 | ""++; +//! : ^^ +//! `---- +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 62 | foo()++; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/inferringClassStaticMembersFromAssignments_es2015.2.minified.js b/crates/swc/tests/tsc-references/inferringClassStaticMembersFromAssignments_es2015.2.minified.js index 0b72c4fb14db..1e9ddd549858 100644 --- a/crates/swc/tests/tsc-references/inferringClassStaticMembersFromAssignments_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/inferringClassStaticMembersFromAssignments_es2015.2.minified.js @@ -8,14 +8,8 @@ export var C2 = class { C2.staticProp = 0; export let F2 = function() {}; F2.staticProp = 0; -class C3 { -} -function F3() {} -C3.staticProp = 0, F3.staticProp = 0; -var C4 = class { -}; -C4.staticProp = 0; -let F4 = function() {}; -F4.staticProp = 0; +(class { +}).staticProp = 0, (function() {}).staticProp = 0, (class { +}).staticProp = 0, (function() {}).staticProp = 0; import * as a from "./a"; a.C1.staticProp, a.C2.staticProp, a.F1.staticProp, a.F2.staticProp, C3.staticProp, C4.staticProp, F3.staticProp, F4.staticProp; diff --git a/crates/swc/tests/tsc-references/inferringClassStaticMembersFromAssignments_es5.1.normal.js b/crates/swc/tests/tsc-references/inferringClassStaticMembersFromAssignments_es5.1.normal.js index 3f94f1008db1..0fcf9395c111 100644 --- a/crates/swc/tests/tsc-references/inferringClassStaticMembersFromAssignments_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/inferringClassStaticMembersFromAssignments_es5.1.normal.js @@ -17,6 +17,7 @@ C2.staticProp = 0; export var F2 = function F2() {}; F2.staticProp = 0; //@filename: global.js +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var C3 = function C3() { "use strict"; _class_call_check(this, C3); diff --git a/crates/swc/tests/tsc-references/inferringClassStaticMembersFromAssignments_es5.2.minified.js b/crates/swc/tests/tsc-references/inferringClassStaticMembersFromAssignments_es5.2.minified.js index e98b923a5ddc..d903361c6dc5 100644 --- a/crates/swc/tests/tsc-references/inferringClassStaticMembersFromAssignments_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/inferringClassStaticMembersFromAssignments_es5.2.minified.js @@ -13,18 +13,16 @@ export var C2 = function() { C2.staticProp = 0; export var F2 = function() {}; F2.staticProp = 0; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var C3 = function() { "use strict"; _class_call_check(this, C3); }; -function F3() {} -C3.staticProp = 0, F3.staticProp = 0; +C3.staticProp = 0, (function() {}).staticProp = 0; var C4 = function() { "use strict"; _class_call_check(this, C4); }; -C4.staticProp = 0; -var F4 = function() {}; -F4.staticProp = 0; +C4.staticProp = 0, (function() {}).staticProp = 0; import * as a from "./a"; a.C1.staticProp, a.C2.staticProp, a.F1.staticProp, a.F2.staticProp, C3.staticProp, C4.staticProp, F3.staticProp, F4.staticProp; diff --git a/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragmaOverridesCompilerOptions_es2015.1.normal.js b/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragmaOverridesCompilerOptions_es2015.1.normal.js index a7f133c0e4eb..b007082f25d3 100644 --- a/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragmaOverridesCompilerOptions_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragmaOverridesCompilerOptions_es2015.1.normal.js @@ -2,7 +2,14 @@ // @jsxFactory: createElement // @jsxFragmentFactory: Fragment // @filename: react.d.ts -/*#__PURE__*/ h(Frag, null, /*#__PURE__*/ h("span", null)); +export { }; +// @filename: preact.d.ts +export { }; +// @filename: snabbdom.d.ts +export { }; +// @filename: reacty.tsx +/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("span", null)); +export { }; // @filename: preacty.tsx /** * @jsx h @@ -14,7 +21,8 @@ * @jsx h * @jsxfrag null */ import { h } from "./snabbdom"; -/*#__PURE__*/ h(Frag, null, /*#__PURE__*/ h("div", null)); +/*#__PURE__*/ h(React.Fragment, null, /*#__PURE__*/ h("div", null)); // @filename: mix-n-match.tsx /* @jsx h */ /* @jsxFrag Fragment */ import { h } from "./preact"; -/*#__PURE__*/ h(Frag, null, /*#__PURE__*/ h("span", null)); +import { Fragment } from "./react"; +/*#__PURE__*/ h(Fragment, null, /*#__PURE__*/ h("span", null)); diff --git a/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragmaOverridesCompilerOptions_es2015.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragmaOverridesCompilerOptions_es2015.2.minified.js index 3d67ad68af7f..4689d16f393f 100644 --- a/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragmaOverridesCompilerOptions_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragmaOverridesCompilerOptions_es2015.2.minified.js @@ -1,3 +1,10 @@ +export { }; +export { }; +export { }; +React.Fragment; +export { }; import { h, Frag } from "./preact"; import { h } from "./snabbdom"; +React.Fragment; import { h } from "./preact"; +import { Fragment } from "./react"; diff --git a/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragmaOverridesCompilerOptions_es5.1.normal.js b/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragmaOverridesCompilerOptions_es5.1.normal.js index a7f133c0e4eb..b007082f25d3 100644 --- a/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragmaOverridesCompilerOptions_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragmaOverridesCompilerOptions_es5.1.normal.js @@ -2,7 +2,14 @@ // @jsxFactory: createElement // @jsxFragmentFactory: Fragment // @filename: react.d.ts -/*#__PURE__*/ h(Frag, null, /*#__PURE__*/ h("span", null)); +export { }; +// @filename: preact.d.ts +export { }; +// @filename: snabbdom.d.ts +export { }; +// @filename: reacty.tsx +/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("span", null)); +export { }; // @filename: preacty.tsx /** * @jsx h @@ -14,7 +21,8 @@ * @jsx h * @jsxfrag null */ import { h } from "./snabbdom"; -/*#__PURE__*/ h(Frag, null, /*#__PURE__*/ h("div", null)); +/*#__PURE__*/ h(React.Fragment, null, /*#__PURE__*/ h("div", null)); // @filename: mix-n-match.tsx /* @jsx h */ /* @jsxFrag Fragment */ import { h } from "./preact"; -/*#__PURE__*/ h(Frag, null, /*#__PURE__*/ h("span", null)); +import { Fragment } from "./react"; +/*#__PURE__*/ h(Fragment, null, /*#__PURE__*/ h("span", null)); diff --git a/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragmaOverridesCompilerOptions_es5.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragmaOverridesCompilerOptions_es5.2.minified.js index 3d67ad68af7f..4689d16f393f 100644 --- a/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragmaOverridesCompilerOptions_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragmaOverridesCompilerOptions_es5.2.minified.js @@ -1,3 +1,10 @@ +export { }; +export { }; +export { }; +React.Fragment; +export { }; import { h, Frag } from "./preact"; import { h } from "./snabbdom"; +React.Fragment; import { h } from "./preact"; +import { Fragment } from "./react"; diff --git a/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragma_es2015.1.normal.js b/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragma_es2015.1.normal.js index 48db12a3ad50..8496cd3ca88d 100644 --- a/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragma_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragma_es2015.1.normal.js @@ -1,20 +1,25 @@ // @jsx: react // @noUnusedLocals: true // @filename: renderer.d.ts +export { }; // @filename: preacty.tsx /** * @jsx h * @jsxFrag Fragment */ import { h, Fragment } from "./renderer"; /*#__PURE__*/ h(Fragment, null, /*#__PURE__*/ h("div", null)); -/*#__PURE__*/ h(Fragment, null, /*#__PURE__*/ h("span", null)); +// @filename: snabbdomy.tsx +/* @jsx jsx */ /* @jsxfrag null */ import { jsx } from "./renderer"; +/*#__PURE__*/ jsx(React.Fragment, null, /*#__PURE__*/ jsx("span", null)); // @filename: preacty-only-fragment.tsx /** * @jsx h * @jsxFrag Fragment */ import { h, Fragment } from "./renderer"; /*#__PURE__*/ h(Fragment, null); -/*#__PURE__*/ h(Fragment, null); +// @filename: snabbdomy-only-fragment.tsx +/* @jsx jsx */ /* @jsxfrag null */ import { jsx } from "./renderer"; +/*#__PURE__*/ jsx(React.Fragment, null); // @filename: preacty-only-fragment-no-jsx.tsx /** * @jsx h @@ -23,14 +28,16 @@ /*#__PURE__*/ h(Fragment, null); // @filename: snabbdomy-only-fragment-no-jsx.tsx /* @jsx jsx */ /* @jsxfrag null */ import "./renderer"; -/*#__PURE__*/ h(Fragment, null); +/*#__PURE__*/ jsx(React.Fragment, null); // @filename: preacty-no-fragment.tsx /** * @jsx h * @jsxFrag Fragment */ import { h, Fragment } from "./renderer"; /*#__PURE__*/ h("div", null); -/*#__PURE__*/ h("div", null); +// @filename: snabbdomy-no-fragment.tsx +/* @jsx jsx */ /* @jsxfrag null */ import { jsx } from "./renderer"; +/*#__PURE__*/ jsx("div", null); // @filename: preacty-only-component.tsx /** * @jsx h diff --git a/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragma_es2015.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragma_es2015.2.minified.js index 2715214423d7..9acdbd8a2903 100644 --- a/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragma_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragma_es2015.2.minified.js @@ -1,6 +1,13 @@ +export { }; import { h, Fragment } from "./renderer"; +import { jsx } from "./renderer"; +React.Fragment; import { h, Fragment } from "./renderer"; +import { jsx } from "./renderer"; +React.Fragment; import { Fragment } from "./renderer"; import "./renderer"; +React.Fragment; import { h, Fragment } from "./renderer"; +import { jsx } from "./renderer"; import { h } from "./renderer"; diff --git a/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragma_es5.1.normal.js b/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragma_es5.1.normal.js index 48db12a3ad50..8496cd3ca88d 100644 --- a/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragma_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragma_es5.1.normal.js @@ -1,20 +1,25 @@ // @jsx: react // @noUnusedLocals: true // @filename: renderer.d.ts +export { }; // @filename: preacty.tsx /** * @jsx h * @jsxFrag Fragment */ import { h, Fragment } from "./renderer"; /*#__PURE__*/ h(Fragment, null, /*#__PURE__*/ h("div", null)); -/*#__PURE__*/ h(Fragment, null, /*#__PURE__*/ h("span", null)); +// @filename: snabbdomy.tsx +/* @jsx jsx */ /* @jsxfrag null */ import { jsx } from "./renderer"; +/*#__PURE__*/ jsx(React.Fragment, null, /*#__PURE__*/ jsx("span", null)); // @filename: preacty-only-fragment.tsx /** * @jsx h * @jsxFrag Fragment */ import { h, Fragment } from "./renderer"; /*#__PURE__*/ h(Fragment, null); -/*#__PURE__*/ h(Fragment, null); +// @filename: snabbdomy-only-fragment.tsx +/* @jsx jsx */ /* @jsxfrag null */ import { jsx } from "./renderer"; +/*#__PURE__*/ jsx(React.Fragment, null); // @filename: preacty-only-fragment-no-jsx.tsx /** * @jsx h @@ -23,14 +28,16 @@ /*#__PURE__*/ h(Fragment, null); // @filename: snabbdomy-only-fragment-no-jsx.tsx /* @jsx jsx */ /* @jsxfrag null */ import "./renderer"; -/*#__PURE__*/ h(Fragment, null); +/*#__PURE__*/ jsx(React.Fragment, null); // @filename: preacty-no-fragment.tsx /** * @jsx h * @jsxFrag Fragment */ import { h, Fragment } from "./renderer"; /*#__PURE__*/ h("div", null); -/*#__PURE__*/ h("div", null); +// @filename: snabbdomy-no-fragment.tsx +/* @jsx jsx */ /* @jsxfrag null */ import { jsx } from "./renderer"; +/*#__PURE__*/ jsx("div", null); // @filename: preacty-only-component.tsx /** * @jsx h diff --git a/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragma_es5.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragma_es5.2.minified.js index 2715214423d7..9acdbd8a2903 100644 --- a/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragma_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragma_es5.2.minified.js @@ -1,6 +1,13 @@ +export { }; import { h, Fragment } from "./renderer"; +import { jsx } from "./renderer"; +React.Fragment; import { h, Fragment } from "./renderer"; +import { jsx } from "./renderer"; +React.Fragment; import { Fragment } from "./renderer"; import "./renderer"; +React.Fragment; import { h, Fragment } from "./renderer"; +import { jsx } from "./renderer"; import { h } from "./renderer"; diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes_es2015.1.normal.js b/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes_es2015.1.normal.js index 89d3cac04957..dabae8832abe 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes_es2015.1.normal.js @@ -1,63 +1,25 @@ // @jsx: react // @filename: renderer.d.ts +export { }; +// @filename: renderer2.d.ts +export { }; // @filename: component.tsx -/** @jsx predom */ import { predom } from "./renderer2"; -export const MySFC = (props)=>/*#__PURE__*/ predom("p", null, props.x, " + ", props.y, " = ", props.x + props.y); -export class MyClass { - render() { - return /*#__PURE__*/ predom("p", null, this.props.x, " + ", this.props.y, " = ", this.props.x + this.props.y); - } - constructor(props){ - this.props = props; - } -} -export const tree = /*#__PURE__*/ predom(MySFC, { - x: 1, - y: 2 -}, /*#__PURE__*/ predom(MyClass, { - x: 3, - y: 4 -}), /*#__PURE__*/ predom(MyClass, { - x: 5, - y: 6 -})); -export default /*#__PURE__*/ predom("h", null); -import prerendered from "./component"; -let elem = prerendered; -elem = /*#__PURE__*/ predom("h", null); // Expect assignability error here -const DOMSFC = (props)=>/*#__PURE__*/ predom("p", null, props.x, " + ", props.y, " = ", props.x + props.y, props.children); -class DOMClass { - render() { - return /*#__PURE__*/ predom("p", null, this.props.x, " + ", this.props.y, " = ", this.props.x + this.props.y); - } - constructor(props){ - this.props = props; - } -} -// Should work, everything is a DOM element -const _tree = /*#__PURE__*/ predom(DOMSFC, { - x: 1, - y: 2 -}, /*#__PURE__*/ predom(DOMClass, { - x: 3, - y: 4 -}), /*#__PURE__*/ predom(DOMClass, { - x: 5, - y: 6 -})); -// Should fail, no dom elements -const _brokenTree = /*#__PURE__*/ predom(MySFC, { - x: 1, - y: 2 -}, /*#__PURE__*/ predom(MyClass, { - x: 3, - y: 4 -}), /*#__PURE__*/ predom(MyClass, { - x: 5, - y: 6 -})); -// Should fail, nondom isn't allowed as children of dom -const _brokenTree2 = /*#__PURE__*/ predom(DOMSFC, { - x: 1, - y: 2 -}, tree, tree); +//! +//! x Spread children are not supported in React. +//! ,---- +//! 5 | export const MySFC = (props: {x: number, y: number, children?: predom.JSX.Element[]}) =>

{props.x} + {props.y} = {props.x + props.y}{...this.props.children}

; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x Spread children are not supported in React. +//! ,---- +//! 13 | {...this.props.children} +//! : ^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +// @filename: index.tsx +//! +//! x Spread children are not supported in React. +//! ,---- +//! 14 | return

{this.props.x} + {this.props.y} = {this.props.x + this.props.y}{...this.props.children}

; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes_es2015.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes_es2015.2.minified.js index 606a630ac6ad..3b1219bda1f4 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes_es2015.2.minified.js @@ -1,22 +1,22 @@ -import { predom } from "./renderer2"; -export const MySFC = (props)=>predom("p", null, props.x, " + ", props.y, " = ", props.x + props.y); -export class MyClass { - render() { - return predom("p", null, this.props.x, " + ", this.props.y, " = ", this.props.x + this.props.y); - } - constructor(props){ - this.props = props; - } -} -export const tree = predom(MySFC, { - x: 1, - y: 2 -}, predom(MyClass, { - x: 3, - y: 4 -}), predom(MyClass, { - x: 5, - y: 6 -})); -export default predom("h", null); -import prerendered from "./component"; +export { }; +export { }; +// @filename: component.tsx +//! +//! x Spread children are not supported in React. +//! ,---- +//! 5 | export const MySFC = (props: {x: number, y: number, children?: predom.JSX.Element[]}) =>

{props.x} + {props.y} = {props.x + props.y}{...this.props.children}

; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x Spread children are not supported in React. +//! ,---- +//! 13 | {...this.props.children} +//! : ^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +// @filename: index.tsx +//! +//! x Spread children are not supported in React. +//! ,---- +//! 14 | return

{this.props.x} + {this.props.y} = {this.props.x + this.props.y}{...this.props.children}

; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes_es5.1.normal.js b/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes_es5.1.normal.js index f9b9b7f8c6e3..dabae8832abe 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes_es5.1.normal.js @@ -1,76 +1,25 @@ // @jsx: react // @filename: renderer.d.ts -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +export { }; +// @filename: renderer2.d.ts +export { }; // @filename: component.tsx -/** @jsx predom */ import { predom } from "./renderer2"; -export var MySFC = function(props) { - return /*#__PURE__*/ predom("p", null, props.x, " + ", props.y, " = ", props.x + props.y); -}; -export var MyClass = /*#__PURE__*/ function() { - "use strict"; - function MyClass(props) { - _class_call_check(this, MyClass); - this.props = props; - } - var _proto = MyClass.prototype; - _proto.render = function render() { - return /*#__PURE__*/ predom("p", null, this.props.x, " + ", this.props.y, " = ", this.props.x + this.props.y); - }; - return MyClass; -}(); -export var tree = /*#__PURE__*/ predom(MySFC, { - x: 1, - y: 2 -}, /*#__PURE__*/ predom(MyClass, { - x: 3, - y: 4 -}), /*#__PURE__*/ predom(MyClass, { - x: 5, - y: 6 -})); -export default /*#__PURE__*/ predom("h", null); -import prerendered from "./component"; -var elem = prerendered; -elem = /*#__PURE__*/ predom("h", null); // Expect assignability error here -var DOMSFC = function(props) { - return /*#__PURE__*/ predom("p", null, props.x, " + ", props.y, " = ", props.x + props.y, props.children); -}; -var DOMClass = /*#__PURE__*/ function() { - "use strict"; - function DOMClass(props) { - _class_call_check(this, DOMClass); - this.props = props; - } - var _proto = DOMClass.prototype; - _proto.render = function render() { - return /*#__PURE__*/ predom("p", null, this.props.x, " + ", this.props.y, " = ", this.props.x + this.props.y); - }; - return DOMClass; -}(); -// Should work, everything is a DOM element -var _tree = /*#__PURE__*/ predom(DOMSFC, { - x: 1, - y: 2 -}, /*#__PURE__*/ predom(DOMClass, { - x: 3, - y: 4 -}), /*#__PURE__*/ predom(DOMClass, { - x: 5, - y: 6 -})); -// Should fail, no dom elements -var _brokenTree = /*#__PURE__*/ predom(MySFC, { - x: 1, - y: 2 -}, /*#__PURE__*/ predom(MyClass, { - x: 3, - y: 4 -}), /*#__PURE__*/ predom(MyClass, { - x: 5, - y: 6 -})); -// Should fail, nondom isn't allowed as children of dom -var _brokenTree2 = /*#__PURE__*/ predom(DOMSFC, { - x: 1, - y: 2 -}, tree, tree); +//! +//! x Spread children are not supported in React. +//! ,---- +//! 5 | export const MySFC = (props: {x: number, y: number, children?: predom.JSX.Element[]}) =>

{props.x} + {props.y} = {props.x + props.y}{...this.props.children}

; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x Spread children are not supported in React. +//! ,---- +//! 13 | {...this.props.children} +//! : ^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +// @filename: index.tsx +//! +//! x Spread children are not supported in React. +//! ,---- +//! 14 | return

{this.props.x} + {this.props.y} = {this.props.x + this.props.y}{...this.props.children}

; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes_es5.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes_es5.2.minified.js index 673ca04752da..3b1219bda1f4 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes_es5.2.minified.js @@ -1,35 +1,22 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import { predom } from "./renderer2"; -export var MySFC = function(props) { - return predom("p", null, props.x, " + ", props.y, " = ", props.x + props.y); -}; -export var MyClass = function() { - "use strict"; - function MyClass(props) { - _class_call_check(this, MyClass), this.props = props; - } - return MyClass.prototype.render = function() { - return predom("p", null, this.props.x, " + ", this.props.y, " = ", this.props.x + this.props.y); - }, MyClass; -}(); -export var tree = predom(MySFC, { - x: 1, - y: 2 -}, predom(MyClass, { - x: 3, - y: 4 -}), predom(MyClass, { - x: 5, - y: 6 -})); -export default predom("h", null); -import prerendered from "./component"; -var DOMClass = function() { - "use strict"; - function DOMClass(props) { - _class_call_check(this, DOMClass), this.props = props; - } - return DOMClass.prototype.render = function() { - return predom("p", null, this.props.x, " + ", this.props.y, " = ", this.props.x + this.props.y); - }, DOMClass; -}(); +export { }; +export { }; +// @filename: component.tsx +//! +//! x Spread children are not supported in React. +//! ,---- +//! 5 | export const MySFC = (props: {x: number, y: number, children?: predom.JSX.Element[]}) =>

{props.x} + {props.y} = {props.x + props.y}{...this.props.children}

; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x Spread children are not supported in React. +//! ,---- +//! 13 | {...this.props.children} +//! : ^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +// @filename: index.tsx +//! +//! x Spread children are not supported in React. +//! ,---- +//! 14 | return

{this.props.x} + {this.props.y} = {this.props.x + this.props.y}{...this.props.children}

; +//! : ^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarations_es2015.1.normal.js b/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarations_es2015.1.normal.js new file mode 100644 index 000000000000..688ee92dc5e0 --- /dev/null +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarations_es2015.1.normal.js @@ -0,0 +1,33 @@ +// @jsx: react +// @filename: renderer.d.ts +export { dom as default }; +// @filename: otherreacty.tsx +/** @jsx React.createElement */ import * as React from "./renderer"; +/*#__PURE__*/ React.createElement("h", null); +// @filename: other.tsx +/** @jsx h */ import { dom as h } from "./renderer"; +export const prerendered = /*#__PURE__*/ h("h", null); +// @filename: othernoalias.tsx +/** @jsx otherdom */ import { otherdom } from "./renderer"; +export const prerendered2 = /*#__PURE__*/ otherdom("h", null); +// @filename: reacty.tsx +import React from "./renderer"; +export const prerendered3 = /*#__PURE__*/ React.createElement("h", null); +// @filename: index.tsx +//! +//! x Expression expected +//! ,---- +//! 4 | +//! : ^ +//! `---- +//! +//! x Unexpected token `/`. Expected jsx identifier +//! ,---- +//! 4 | +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarations_es2015.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarations_es2015.2.minified.js new file mode 100644 index 000000000000..61f996bed3d8 --- /dev/null +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarations_es2015.2.minified.js @@ -0,0 +1,26 @@ +export { dom as default }; +import * as React from "./renderer"; +import { dom as h } from "./renderer"; +export const prerendered = h("h", null); +import { otherdom } from "./renderer"; +export const prerendered2 = otherdom("h", null); +import React from "./renderer"; +export const prerendered3 = React.createElement("h", null); +// @filename: index.tsx +//! +//! x Expression expected +//! ,---- +//! 4 | +//! : ^ +//! `---- +//! +//! x Unexpected token `/`. Expected jsx identifier +//! ,---- +//! 4 | +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarations_es5.1.normal.js b/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarations_es5.1.normal.js new file mode 100644 index 000000000000..c4b9033e485e --- /dev/null +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarations_es5.1.normal.js @@ -0,0 +1,33 @@ +// @jsx: react +// @filename: renderer.d.ts +export { dom as default }; +// @filename: otherreacty.tsx +/** @jsx React.createElement */ import * as React from "./renderer"; +/*#__PURE__*/ React.createElement("h", null); +// @filename: other.tsx +/** @jsx h */ import { dom as h } from "./renderer"; +export var prerendered = /*#__PURE__*/ h("h", null); +// @filename: othernoalias.tsx +/** @jsx otherdom */ import { otherdom } from "./renderer"; +export var prerendered2 = /*#__PURE__*/ otherdom("h", null); +// @filename: reacty.tsx +import React from "./renderer"; +export var prerendered3 = /*#__PURE__*/ React.createElement("h", null); +// @filename: index.tsx +//! +//! x Expression expected +//! ,---- +//! 4 | +//! : ^ +//! `---- +//! +//! x Unexpected token `/`. Expected jsx identifier +//! ,---- +//! 4 | +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarations_es5.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarations_es5.2.minified.js new file mode 100644 index 000000000000..65b0cc791ca3 --- /dev/null +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarations_es5.2.minified.js @@ -0,0 +1,26 @@ +export { dom as default }; +import * as React from "./renderer"; +import { dom as h } from "./renderer"; +export var prerendered = h("h", null); +import { otherdom } from "./renderer"; +export var prerendered2 = otherdom("h", null); +import React from "./renderer"; +export var prerendered3 = React.createElement("h", null); +// @filename: index.tsx +//! +//! x Expression expected +//! ,---- +//! 4 | +//! : ^ +//! `---- +//! +//! x Unexpected token `/`. Expected jsx identifier +//! ,---- +//! 4 | +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryLocalTypeGlobalFallback_es2015.1.normal.js b/crates/swc/tests/tsc-references/inlineJsxFactoryLocalTypeGlobalFallback_es2015.1.normal.js index a7ca9785bf38..5dcda9b07bc9 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryLocalTypeGlobalFallback_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryLocalTypeGlobalFallback_es2015.1.normal.js @@ -1,8 +1,13 @@ // @jsx: react // @filename: renderer.d.ts +export { }; +// @filename: renderer2.d.ts +export { }; // @filename: component.tsx /** @jsx predom */ import { predom } from "./renderer2"; export default /*#__PURE__*/ predom("h", null); +// @filename: index.tsx +/** @jsx dom */ import { dom } from "./renderer"; import prerendered from "./component"; let elem = prerendered; -elem = /*#__PURE__*/ predom("h", null); // Expect assignability error here +elem = /*#__PURE__*/ dom("h", null); // Expect assignability error here diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryLocalTypeGlobalFallback_es2015.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxFactoryLocalTypeGlobalFallback_es2015.2.minified.js index c5afd4162064..bb8c4451fbc7 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryLocalTypeGlobalFallback_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryLocalTypeGlobalFallback_es2015.2.minified.js @@ -1,3 +1,6 @@ +export { }; +export { }; import { predom } from "./renderer2"; export default predom("h", null); +import { dom } from "./renderer"; import prerendered from "./component"; diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryLocalTypeGlobalFallback_es5.1.normal.js b/crates/swc/tests/tsc-references/inlineJsxFactoryLocalTypeGlobalFallback_es5.1.normal.js index c04ac20d110b..9fafb12cd549 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryLocalTypeGlobalFallback_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryLocalTypeGlobalFallback_es5.1.normal.js @@ -1,8 +1,13 @@ // @jsx: react // @filename: renderer.d.ts +export { }; +// @filename: renderer2.d.ts +export { }; // @filename: component.tsx /** @jsx predom */ import { predom } from "./renderer2"; export default /*#__PURE__*/ predom("h", null); +// @filename: index.tsx +/** @jsx dom */ import { dom } from "./renderer"; import prerendered from "./component"; var elem = prerendered; -elem = /*#__PURE__*/ predom("h", null); // Expect assignability error here +elem = /*#__PURE__*/ dom("h", null); // Expect assignability error here diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryLocalTypeGlobalFallback_es5.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxFactoryLocalTypeGlobalFallback_es5.2.minified.js index c5afd4162064..bb8c4451fbc7 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryLocalTypeGlobalFallback_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryLocalTypeGlobalFallback_es5.2.minified.js @@ -1,3 +1,6 @@ +export { }; +export { }; import { predom } from "./renderer2"; export default predom("h", null); +import { dom } from "./renderer"; import prerendered from "./component"; diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryOverridesCompilerOption_es2015.1.normal.js b/crates/swc/tests/tsc-references/inlineJsxFactoryOverridesCompilerOption_es2015.1.normal.js index 0e6f928ec28a..42625b754444 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryOverridesCompilerOption_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryOverridesCompilerOption_es2015.1.normal.js @@ -6,5 +6,5 @@ export { dom as p }; /** @jsx dom */ import { dom } from "./renderer"; /*#__PURE__*/ dom("h", null); // @filename: index.tsx -import { p } from "./renderer"; -/*#__PURE__*/ dom("h", null); +/*#__PURE__*/ React.createElement("h", null); +export { }; diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryOverridesCompilerOption_es2015.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxFactoryOverridesCompilerOption_es2015.2.minified.js index 21a94df3c1d3..302a2fb6a702 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryOverridesCompilerOption_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryOverridesCompilerOption_es2015.2.minified.js @@ -1,3 +1,3 @@ -import { dom } from "./renderer"; -import { p } from "./renderer"; export { dom as p }; +import { dom } from "./renderer"; +export { }; diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryOverridesCompilerOption_es5.1.normal.js b/crates/swc/tests/tsc-references/inlineJsxFactoryOverridesCompilerOption_es5.1.normal.js index 0e6f928ec28a..42625b754444 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryOverridesCompilerOption_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryOverridesCompilerOption_es5.1.normal.js @@ -6,5 +6,5 @@ export { dom as p }; /** @jsx dom */ import { dom } from "./renderer"; /*#__PURE__*/ dom("h", null); // @filename: index.tsx -import { p } from "./renderer"; -/*#__PURE__*/ dom("h", null); +/*#__PURE__*/ React.createElement("h", null); +export { }; diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryOverridesCompilerOption_es5.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxFactoryOverridesCompilerOption_es5.2.minified.js index 21a94df3c1d3..302a2fb6a702 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryOverridesCompilerOption_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryOverridesCompilerOption_es5.2.minified.js @@ -1,3 +1,3 @@ -import { dom } from "./renderer"; -import { p } from "./renderer"; export { dom as p }; +import { dom } from "./renderer"; +export { }; diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryWithFragmentIsError_es2015.1.normal.js b/crates/swc/tests/tsc-references/inlineJsxFactoryWithFragmentIsError_es2015.1.normal.js index 99a8577fc336..1386e8ab7782 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryWithFragmentIsError_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryWithFragmentIsError_es2015.1.normal.js @@ -1,6 +1,9 @@ // @jsx: react // @filename: renderer.d.ts +export { }; // @filename: reacty.tsx /** @jsx React.createElement */ import * as React from "./renderer"; /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("h", null)); -/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("h", null)); +// @filename: index.tsx +/** @jsx dom */ import { dom } from "./renderer"; +/*#__PURE__*/ dom(React.Fragment, null, /*#__PURE__*/ dom("h", null)); diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryWithFragmentIsError_es2015.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxFactoryWithFragmentIsError_es2015.2.minified.js index 82ae9ee69dd4..aa863cfabf7b 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryWithFragmentIsError_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryWithFragmentIsError_es2015.2.minified.js @@ -1,2 +1,5 @@ +export { }; import * as React from "./renderer"; -React.Fragment, React.Fragment; +React.Fragment; +import { dom } from "./renderer"; +React.Fragment; diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryWithFragmentIsError_es5.1.normal.js b/crates/swc/tests/tsc-references/inlineJsxFactoryWithFragmentIsError_es5.1.normal.js index 99a8577fc336..1386e8ab7782 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryWithFragmentIsError_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryWithFragmentIsError_es5.1.normal.js @@ -1,6 +1,9 @@ // @jsx: react // @filename: renderer.d.ts +export { }; // @filename: reacty.tsx /** @jsx React.createElement */ import * as React from "./renderer"; /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("h", null)); -/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("h", null)); +// @filename: index.tsx +/** @jsx dom */ import { dom } from "./renderer"; +/*#__PURE__*/ dom(React.Fragment, null, /*#__PURE__*/ dom("h", null)); diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryWithFragmentIsError_es5.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxFactoryWithFragmentIsError_es5.2.minified.js index 82ae9ee69dd4..aa863cfabf7b 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryWithFragmentIsError_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryWithFragmentIsError_es5.2.minified.js @@ -1,2 +1,5 @@ +export { }; import * as React from "./renderer"; -React.Fragment, React.Fragment; +React.Fragment; +import { dom } from "./renderer"; +React.Fragment; diff --git a/crates/swc/tests/tsc-references/interfaceExtendingOptionalChain_es2015.1.normal.js b/crates/swc/tests/tsc-references/interfaceExtendingOptionalChain_es2015.1.normal.js new file mode 100644 index 000000000000..ed9ca98233cc --- /dev/null +++ b/crates/swc/tests/tsc-references/interfaceExtendingOptionalChain_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x An interface can only extend an identifier/qualified-name with optional type arguments. +//! ,---- +//! 5 | interface C1 extends Foo?.Bar {} +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/interfaceExtendingOptionalChain_es2015.2.minified.js b/crates/swc/tests/tsc-references/interfaceExtendingOptionalChain_es2015.2.minified.js new file mode 100644 index 000000000000..ed9ca98233cc --- /dev/null +++ b/crates/swc/tests/tsc-references/interfaceExtendingOptionalChain_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x An interface can only extend an identifier/qualified-name with optional type arguments. +//! ,---- +//! 5 | interface C1 extends Foo?.Bar {} +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/interfaceExtendingOptionalChain_es5.1.normal.js b/crates/swc/tests/tsc-references/interfaceExtendingOptionalChain_es5.1.normal.js new file mode 100644 index 000000000000..ed9ca98233cc --- /dev/null +++ b/crates/swc/tests/tsc-references/interfaceExtendingOptionalChain_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x An interface can only extend an identifier/qualified-name with optional type arguments. +//! ,---- +//! 5 | interface C1 extends Foo?.Bar {} +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/interfaceExtendingOptionalChain_es5.2.minified.js b/crates/swc/tests/tsc-references/interfaceExtendingOptionalChain_es5.2.minified.js new file mode 100644 index 000000000000..ed9ca98233cc --- /dev/null +++ b/crates/swc/tests/tsc-references/interfaceExtendingOptionalChain_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x An interface can only extend an identifier/qualified-name with optional type arguments. +//! ,---- +//! 5 | interface C1 extends Foo?.Bar {} +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/interfacesWithPredefinedTypesAsNames_es2015.1.normal.js b/crates/swc/tests/tsc-references/interfacesWithPredefinedTypesAsNames_es2015.1.normal.js new file mode 100644 index 000000000000..eebd786ac31b --- /dev/null +++ b/crates/swc/tests/tsc-references/interfacesWithPredefinedTypesAsNames_es2015.1.normal.js @@ -0,0 +1,48 @@ +//! +//! x interface name is invalid +//! ,---- +//! 1 | interface any { } +//! : ^^^ +//! `---- +//! +//! x interface name is invalid +//! ,---- +//! 2 | interface number { } +//! : ^^^^^^ +//! `---- +//! +//! x interface name is invalid +//! ,---- +//! 3 | interface string { } +//! : ^^^^^^ +//! `---- +//! +//! x interface name is invalid +//! ,---- +//! 4 | interface boolean { } +//! : ^^^^^^^ +//! `---- +//! +//! x interface name is invalid +//! ,---- +//! 5 | interface void {} +//! : ^^^^ +//! `---- +//! +//! x interface name is invalid +//! ,---- +//! 6 | interface unknown {} +//! : ^^^^^^^ +//! `---- +//! +//! x interface name is invalid +//! ,---- +//! 7 | interface never {} +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/interfacesWithPredefinedTypesAsNames_es2015.2.minified.js b/crates/swc/tests/tsc-references/interfacesWithPredefinedTypesAsNames_es2015.2.minified.js new file mode 100644 index 000000000000..eebd786ac31b --- /dev/null +++ b/crates/swc/tests/tsc-references/interfacesWithPredefinedTypesAsNames_es2015.2.minified.js @@ -0,0 +1,48 @@ +//! +//! x interface name is invalid +//! ,---- +//! 1 | interface any { } +//! : ^^^ +//! `---- +//! +//! x interface name is invalid +//! ,---- +//! 2 | interface number { } +//! : ^^^^^^ +//! `---- +//! +//! x interface name is invalid +//! ,---- +//! 3 | interface string { } +//! : ^^^^^^ +//! `---- +//! +//! x interface name is invalid +//! ,---- +//! 4 | interface boolean { } +//! : ^^^^^^^ +//! `---- +//! +//! x interface name is invalid +//! ,---- +//! 5 | interface void {} +//! : ^^^^ +//! `---- +//! +//! x interface name is invalid +//! ,---- +//! 6 | interface unknown {} +//! : ^^^^^^^ +//! `---- +//! +//! x interface name is invalid +//! ,---- +//! 7 | interface never {} +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/interfacesWithPredefinedTypesAsNames_es5.1.normal.js b/crates/swc/tests/tsc-references/interfacesWithPredefinedTypesAsNames_es5.1.normal.js new file mode 100644 index 000000000000..eebd786ac31b --- /dev/null +++ b/crates/swc/tests/tsc-references/interfacesWithPredefinedTypesAsNames_es5.1.normal.js @@ -0,0 +1,48 @@ +//! +//! x interface name is invalid +//! ,---- +//! 1 | interface any { } +//! : ^^^ +//! `---- +//! +//! x interface name is invalid +//! ,---- +//! 2 | interface number { } +//! : ^^^^^^ +//! `---- +//! +//! x interface name is invalid +//! ,---- +//! 3 | interface string { } +//! : ^^^^^^ +//! `---- +//! +//! x interface name is invalid +//! ,---- +//! 4 | interface boolean { } +//! : ^^^^^^^ +//! `---- +//! +//! x interface name is invalid +//! ,---- +//! 5 | interface void {} +//! : ^^^^ +//! `---- +//! +//! x interface name is invalid +//! ,---- +//! 6 | interface unknown {} +//! : ^^^^^^^ +//! `---- +//! +//! x interface name is invalid +//! ,---- +//! 7 | interface never {} +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/interfacesWithPredefinedTypesAsNames_es5.2.minified.js b/crates/swc/tests/tsc-references/interfacesWithPredefinedTypesAsNames_es5.2.minified.js new file mode 100644 index 000000000000..eebd786ac31b --- /dev/null +++ b/crates/swc/tests/tsc-references/interfacesWithPredefinedTypesAsNames_es5.2.minified.js @@ -0,0 +1,48 @@ +//! +//! x interface name is invalid +//! ,---- +//! 1 | interface any { } +//! : ^^^ +//! `---- +//! +//! x interface name is invalid +//! ,---- +//! 2 | interface number { } +//! : ^^^^^^ +//! `---- +//! +//! x interface name is invalid +//! ,---- +//! 3 | interface string { } +//! : ^^^^^^ +//! `---- +//! +//! x interface name is invalid +//! ,---- +//! 4 | interface boolean { } +//! : ^^^^^^^ +//! `---- +//! +//! x interface name is invalid +//! ,---- +//! 5 | interface void {} +//! : ^^^^ +//! `---- +//! +//! x interface name is invalid +//! ,---- +//! 6 | interface unknown {} +//! : ^^^^^^^ +//! `---- +//! +//! x interface name is invalid +//! ,---- +//! 7 | interface never {} +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/intersectionsAndEmptyObjects_es2015.1.normal.js b/crates/swc/tests/tsc-references/intersectionsAndEmptyObjects_es2015.1.normal.js index a1f7b2529967..d3e9917bb6f3 100644 --- a/crates/swc/tests/tsc-references/intersectionsAndEmptyObjects_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/intersectionsAndEmptyObjects_es2015.1.normal.js @@ -41,4 +41,5 @@ var myChoicesAndEmpty; var unknownChoices; var unknownChoicesAndEmpty; mock(import('./ex')); +// @filename: ex.d.ts export { }; diff --git a/crates/swc/tests/tsc-references/intersectionsAndEmptyObjects_es2015.2.minified.js b/crates/swc/tests/tsc-references/intersectionsAndEmptyObjects_es2015.2.minified.js index 84e619a3ce6d..d9276d98a29a 100644 --- a/crates/swc/tests/tsc-references/intersectionsAndEmptyObjects_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/intersectionsAndEmptyObjects_es2015.2.minified.js @@ -1,15 +1,15 @@ -let intersectDictionaries = (d1, d2)=>Object.assign({}, d1, d2), testDictionary = (_value)=>{}, d1 = {}; +const intersectDictionaries = (d1, d2)=>Object.assign({}, d1, d2), testDictionary = (_value)=>{}, d1 = {}; testDictionary(d1); -let d2 = intersectDictionaries(d1, d1); +const d2 = intersectDictionaries(d1, d1); testDictionary(d2); -let d3 = { +const d3 = { s: '' }; testDictionary(d3); -let d4 = intersectDictionaries(d1, d3); +const d4 = intersectDictionaries(d1, d3); testDictionary(d4); -let d5 = intersectDictionaries(d3, d1); +const d5 = intersectDictionaries(d3, d1); testDictionary(d5); -let d6 = intersectDictionaries(d3, d3); +const d6 = intersectDictionaries(d3, d3); testDictionary(d6), mock(import('./ex')); export { }; diff --git a/crates/swc/tests/tsc-references/intersectionsAndEmptyObjects_es5.1.normal.js b/crates/swc/tests/tsc-references/intersectionsAndEmptyObjects_es5.1.normal.js index 36891e96f888..8a31a398fb35 100644 --- a/crates/swc/tests/tsc-references/intersectionsAndEmptyObjects_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/intersectionsAndEmptyObjects_es5.1.normal.js @@ -43,4 +43,5 @@ var myChoicesAndEmpty; var unknownChoices; var unknownChoicesAndEmpty; mock(import("./ex")); +// @filename: ex.d.ts export { }; diff --git a/crates/swc/tests/tsc-references/invalidInstantiatedModule_es2015.1.normal.js b/crates/swc/tests/tsc-references/invalidInstantiatedModule_es2015.1.normal.js index e419320d9be0..b5440e22e9dc 100644 --- a/crates/swc/tests/tsc-references/invalidInstantiatedModule_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/invalidInstantiatedModule_es2015.1.normal.js @@ -1,13 +1,10 @@ -var M; -(function(M) { - class Point { - } - M.Point = Point; - var Point = M.Point = 1; -})(M || (M = {})); -var M2; -(function(M2) { - var Point = M2.Point = 1; -})(M2 || (M2 = {})); -var m = M2; -var p; // Error +//! +//! x the name `Point` is defined multiple times +//! ,-[2:5] +//! 2 | export class Point { x: number; y: number } +//! : ^^|^^ +//! : `-- previous definition of `Point` here +//! 3 | export var Point = 1; // Error +//! : ^^|^^ +//! : `-- `Point` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/invalidInstantiatedModule_es2015.2.minified.js b/crates/swc/tests/tsc-references/invalidInstantiatedModule_es2015.2.minified.js index b427a6afebc7..b5440e22e9dc 100644 --- a/crates/swc/tests/tsc-references/invalidInstantiatedModule_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/invalidInstantiatedModule_es2015.2.minified.js @@ -1,7 +1,10 @@ -var M, M2; -!function(M) { - class Point { - } - M.Point = Point; - var Point = M.Point = 1; -}(M || (M = {})), (M2 || (M2 = {})).Point = 1; +//! +//! x the name `Point` is defined multiple times +//! ,-[2:5] +//! 2 | export class Point { x: number; y: number } +//! : ^^|^^ +//! : `-- previous definition of `Point` here +//! 3 | export var Point = 1; // Error +//! : ^^|^^ +//! : `-- `Point` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/invalidInstantiatedModule_es5.1.normal.js b/crates/swc/tests/tsc-references/invalidInstantiatedModule_es5.1.normal.js index e4cddeee8ec4..b5440e22e9dc 100644 --- a/crates/swc/tests/tsc-references/invalidInstantiatedModule_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/invalidInstantiatedModule_es5.1.normal.js @@ -1,16 +1,10 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var M; -(function(M) { - var Point = function Point() { - "use strict"; - _class_call_check(this, Point); - }; - M.Point = Point; - var Point = M.Point = 1; -})(M || (M = {})); -var M2; -(function(M2) { - var Point = M2.Point = 1; -})(M2 || (M2 = {})); -var m = M2; -var p; // Error +//! +//! x the name `Point` is defined multiple times +//! ,-[2:5] +//! 2 | export class Point { x: number; y: number } +//! : ^^|^^ +//! : `-- previous definition of `Point` here +//! 3 | export var Point = 1; // Error +//! : ^^|^^ +//! : `-- `Point` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/invalidInstantiatedModule_es5.2.minified.js b/crates/swc/tests/tsc-references/invalidInstantiatedModule_es5.2.minified.js index ba502aab3642..b5440e22e9dc 100644 --- a/crates/swc/tests/tsc-references/invalidInstantiatedModule_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/invalidInstantiatedModule_es5.2.minified.js @@ -1,10 +1,10 @@ -var M, M2; -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -!function(M) { - var Point = function() { - "use strict"; - _class_call_check(this, Point); - }; - M.Point = Point; - var Point = M.Point = 1; -}(M || (M = {})), (M2 || (M2 = {})).Point = 1; +//! +//! x the name `Point` is defined multiple times +//! ,-[2:5] +//! 2 | export class Point { x: number; y: number } +//! : ^^|^^ +//! : `-- previous definition of `Point` here +//! 3 | export var Point = 1; // Error +//! : ^^|^^ +//! : `-- `Point` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/jsContainerMergeJsContainer_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsContainerMergeJsContainer_es2015.2.minified.js index c975bb09fc0e..3a1d22b5ca08 100644 --- a/crates/swc/tests/tsc-references/jsContainerMergeJsContainer_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsContainerMergeJsContainer_es2015.2.minified.js @@ -1,2 +1,3 @@ const a = {}; -a.d = function() {}, a.d.prototype = {}; +a.d = function() {}; +a.d.prototype = {}; diff --git a/crates/swc/tests/tsc-references/jsContainerMergeJsContainer_es5.2.minified.js b/crates/swc/tests/tsc-references/jsContainerMergeJsContainer_es5.2.minified.js index 8f094e55a146..1500631efac8 100644 --- a/crates/swc/tests/tsc-references/jsContainerMergeJsContainer_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsContainerMergeJsContainer_es5.2.minified.js @@ -1,2 +1,2 @@ -var a = {}; -a.d = function() {}, a.d.prototype = {}; +({}).d = function() {}; +a.d.prototype = {}; diff --git a/crates/swc/tests/tsc-references/jsContainerMergeTsDeclaration_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsContainerMergeTsDeclaration_es2015.2.minified.js index 39e6fc25b792..346e3e3778b7 100644 --- a/crates/swc/tests/tsc-references/jsContainerMergeTsDeclaration_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsContainerMergeTsDeclaration_es2015.2.minified.js @@ -1,3 +1 @@ -var x = function() {}; -x.a = function() {}; -var x = 1; +(function() {}).a = function() {}; diff --git a/crates/swc/tests/tsc-references/jsContainerMergeTsDeclaration_es5.2.minified.js b/crates/swc/tests/tsc-references/jsContainerMergeTsDeclaration_es5.2.minified.js index 39e6fc25b792..346e3e3778b7 100644 --- a/crates/swc/tests/tsc-references/jsContainerMergeTsDeclaration_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsContainerMergeTsDeclaration_es5.2.minified.js @@ -1,3 +1 @@ -var x = function() {}; -x.a = function() {}; -var x = 1; +(function() {}).a = function() {}; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsClassAccessor_es2015.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsClassAccessor_es2015.1.normal.js index c9982beb58b7..878aa1e74107 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsClassAccessor_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsClassAccessor_es2015.1.normal.js @@ -4,6 +4,7 @@ // @outDir: ./out // @declaration: true // @filename: supplement.d.ts +export { }; // @filename: base.js export class Base { toJSON() { @@ -16,6 +17,8 @@ export class Base { } constructor(){} } +// @filename: argument.js +import { Base } from "./base.js"; export class Argument extends Base { /** * @param {*} tokeniser diff --git a/crates/swc/tests/tsc-references/jsDeclarationsClassAccessor_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsClassAccessor_es2015.2.minified.js index 72e884c82657..bf714bae143f 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsClassAccessor_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsClassAccessor_es2015.2.minified.js @@ -1,3 +1,4 @@ +export { }; export class Base { toJSON() { return { @@ -8,6 +9,7 @@ export class Base { } constructor(){} } +import { Base } from "./base.js"; export class Argument extends Base { static parse(tokeniser) {} get type() { diff --git a/crates/swc/tests/tsc-references/jsDeclarationsClassAccessor_es5.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsClassAccessor_es5.1.normal.js index a35a94c2a0c8..7ec252cd17e8 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsClassAccessor_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsClassAccessor_es5.1.normal.js @@ -4,12 +4,9 @@ // @outDir: ./out // @declaration: true // @filename: supplement.d.ts -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _create_class from "@swc/helpers/src/_create_class.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; -import regeneratorRuntime from "regenerator-runtime"; +export { }; // @filename: base.js +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export var Base = /*#__PURE__*/ function() { "use strict"; function Base() { @@ -26,6 +23,13 @@ export var Base = /*#__PURE__*/ function() { }; return Base; }(); +// @filename: argument.js +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _create_class from "@swc/helpers/src/_create_class.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import { Base } from "./base.js"; export var Argument = /*#__PURE__*/ function(Base) { "use strict"; _inherits(Argument, Base); diff --git a/crates/swc/tests/tsc-references/jsDeclarationsClassAccessor_es5.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsClassAccessor_es5.2.minified.js index c7042808cf95..c24a77275633 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsClassAccessor_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsClassAccessor_es5.2.minified.js @@ -1,8 +1,5 @@ +export { }; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _create_class from "@swc/helpers/src/_create_class.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; -import regeneratorRuntime from "regenerator-runtime"; export var Base = function() { "use strict"; function Base() { @@ -16,6 +13,12 @@ export var Base = function() { }; }, Base; }(); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _create_class from "@swc/helpers/src/_create_class.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +import regeneratorRuntime from "regenerator-runtime"; +import { Base } from "./base.js"; export var Argument = function(Base) { "use strict"; _inherits(Argument, Base); diff --git a/crates/swc/tests/tsc-references/jsDeclarationsClassExtendsVisibility_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsClassExtendsVisibility_es2015.2.minified.js index d82269664036..e792f34c3970 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsClassExtendsVisibility_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsClassExtendsVisibility_es2015.2.minified.js @@ -1,6 +1,5 @@ -class Bar { -} -module.exports = Bar; +module.exports = class { +}; const Bar = require("./bar"); module.exports = class extends Bar { }, module.exports.Strings = { diff --git a/crates/swc/tests/tsc-references/jsDeclarationsClassExtendsVisibility_es5.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsClassExtendsVisibility_es5.1.normal.js index 158ed2a55a97..a13b66dca776 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsClassExtendsVisibility_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsClassExtendsVisibility_es5.1.normal.js @@ -5,14 +5,15 @@ // @declaration: true // @filename: bar.js import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; var Bar = function Bar() { "use strict"; _class_call_check(this, Bar); }; module.exports = Bar; // @filename: cls.js +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var Bar = require("./bar"); var Strings = { a: "A", diff --git a/crates/swc/tests/tsc-references/jsDeclarationsClassExtendsVisibility_es5.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsClassExtendsVisibility_es5.2.minified.js index 08aa054d4bcd..eea55c9d3a8a 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsClassExtendsVisibility_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsClassExtendsVisibility_es5.2.minified.js @@ -1,12 +1,13 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; var Bar = function() { "use strict"; _class_call_check(this, Bar); }; module.exports = Bar; -var Bar = require("./bar"), Foo = function(Bar) { +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var Foo = function(Bar) { "use strict"; _inherits(Foo, Bar); var _super = _create_super(Foo); @@ -14,7 +15,7 @@ var Bar = require("./bar"), Foo = function(Bar) { return _class_call_check(this, Foo), _super.apply(this, arguments); } return Foo; -}(Bar); +}(require("./bar")); module.exports = Foo, module.exports.Strings = { a: "A", b: "B" diff --git a/crates/swc/tests/tsc-references/jsDeclarationsClassImplementsGenericsSerialization_es2015.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsClassImplementsGenericsSerialization_es2015.1.normal.js index 844a074f22da..6fb9fcc826de 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsClassImplementsGenericsSerialization_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsClassImplementsGenericsSerialization_es2015.1.normal.js @@ -4,6 +4,7 @@ // @outDir: ./out // @declaration: true // @filename: interface.ts +export { }; // @filename: lib.js /** * @template T diff --git a/crates/swc/tests/tsc-references/jsDeclarationsClassImplementsGenericsSerialization_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsClassImplementsGenericsSerialization_es2015.2.minified.js index daaf2f4e07f1..9abbfa745803 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsClassImplementsGenericsSerialization_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsClassImplementsGenericsSerialization_es2015.2.minified.js @@ -1,3 +1,4 @@ +export { }; export class Encoder { encode(value) { return new Uint8Array(0); diff --git a/crates/swc/tests/tsc-references/jsDeclarationsClassImplementsGenericsSerialization_es5.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsClassImplementsGenericsSerialization_es5.1.normal.js index 83ac2e730d7e..50ed3119d677 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsClassImplementsGenericsSerialization_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsClassImplementsGenericsSerialization_es5.1.normal.js @@ -4,12 +4,13 @@ // @outDir: ./out // @declaration: true // @filename: interface.ts -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +export { }; // @filename: lib.js /** * @template T * @implements {IEncoder} - */ export var Encoder = /*#__PURE__*/ function() { + */ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +export var Encoder = /*#__PURE__*/ function() { "use strict"; function Encoder() { _class_call_check(this, Encoder); diff --git a/crates/swc/tests/tsc-references/jsDeclarationsClassImplementsGenericsSerialization_es5.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsClassImplementsGenericsSerialization_es5.2.minified.js index 0b463797969d..3eac85c64ce7 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsClassImplementsGenericsSerialization_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsClassImplementsGenericsSerialization_es5.2.minified.js @@ -1,3 +1,4 @@ +export { }; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export var Encoder = function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsCommonjsRelativePath_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsCommonjsRelativePath_es2015.2.minified.js index f5763e4b23af..8a90abee1230 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsCommonjsRelativePath_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsCommonjsRelativePath_es2015.2.minified.js @@ -1,9 +1,9 @@ 'use strict'; -class Thing { -} module.exports = { - Thing + Thing: class { + } }; +'use strict'; const Thing = require('./thing').Thing; module.exports = { Thing diff --git a/crates/swc/tests/tsc-references/jsDeclarationsCommonjsRelativePath_es5.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsCommonjsRelativePath_es5.2.minified.js index 0c2bed574985..a2ae3d6352db 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsCommonjsRelativePath_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsCommonjsRelativePath_es5.2.minified.js @@ -6,6 +6,7 @@ var Thing = function() { module.exports = { Thing: Thing }; +"use strict"; var Thing = require("./thing").Thing; module.exports = { Thing: Thing diff --git a/crates/swc/tests/tsc-references/jsDeclarationsComputedNames_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsComputedNames_es2015.2.minified.js index ebdfefaa79c1..1359c6e59a77 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsComputedNames_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsComputedNames_es2015.2.minified.js @@ -1,4 +1,4 @@ -let TopLevelSym = Symbol(), InnerSym = Symbol(); +const TopLevelSym = Symbol(), InnerSym = Symbol(); module.exports = { [TopLevelSym]: (x = 12)=>x, items: { diff --git a/crates/swc/tests/tsc-references/jsDeclarationsComputedNames_es5.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsComputedNames_es5.1.normal.js index 7edb2f23a759..0bd649c294c9 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsComputedNames_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsComputedNames_es5.1.normal.js @@ -5,7 +5,6 @@ // @outDir: ./out // @declaration: true // @filename: index.js -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _define_property from "@swc/helpers/src/_define_property.mjs"; var TopLevelSym = Symbol(); var InnerSym = Symbol(); @@ -20,6 +19,7 @@ module.exports = (_obj = {}, _define_property(_obj, TopLevelSym, function() { return arg.x; })), _obj); // @filename: index2.js +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var TopLevelSym = Symbol(); var InnerSym = Symbol(); var _InnerSym = InnerSym; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsComputedNames_es5.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsComputedNames_es5.2.minified.js index 9a4f98fb2a08..98ceb3a1bc59 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsComputedNames_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsComputedNames_es5.2.minified.js @@ -1,4 +1,3 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _define_property from "@swc/helpers/src/_define_property.mjs"; var _obj, TopLevelSym = Symbol(), InnerSym = Symbol(); module.exports = (_define_property(_obj = {}, TopLevelSym, function() { @@ -10,6 +9,7 @@ module.exports = (_define_property(_obj = {}, TopLevelSym, function() { }; return arg.x; })), _obj); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var TopLevelSym = Symbol(), InnerSym = Symbol(), _InnerSym = InnerSym; export var MyClass = function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsCrossfileMerge_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsCrossfileMerge_es2015.2.minified.js index b75d48e13a08..a8021c15ed6f 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsCrossfileMerge_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsCrossfileMerge_es2015.2.minified.js @@ -1,3 +1,3 @@ -let m = require("./exporter"); +const m = require("./exporter"); module.exports = m.default, module.exports.memberName = "thing"; export default function() {}; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsDefault_es2015.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsDefault_es2015.1.normal.js index fcaba39aeeb2..27132bf21a81 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsDefault_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsDefault_es2015.1.normal.js @@ -11,12 +11,12 @@ export default function foo() { }; export const x = foo; export { foo as bar }; +// @filename: index3.js class Foo { constructor(){ this.a = /** @type {Foo} */ (null); } } -// @filename: index3.js export { Foo as default }; export const X = Foo; export { Foo as Bar }; @@ -31,10 +31,10 @@ class Bar extends Fab { export default Bar; // @filename: index5.js // merge type alias and const (OK) -export default 12; -/** +export default 12; /** * @typedef {string | number} default - */ // @filename: index6.js + */ +// @filename: index6.js // merge type alias and function (OK) export default function func() {}; /** diff --git a/crates/swc/tests/tsc-references/jsDeclarationsDefault_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsDefault_es2015.2.minified.js index b9d25fce0968..a36fca8f86ad 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsDefault_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsDefault_es2015.2.minified.js @@ -3,12 +3,14 @@ export default function foo() { return foo; }; export const x = foo; +export { foo as bar }; class Foo { constructor(){ this.a = null; } } export const X = Foo; +export { Foo as default, Foo as Bar }; import Fab from "./index3"; export default class extends Fab { constructor(...args){ @@ -17,4 +19,3 @@ export default class extends Fab { }; export default 12; export default function func() {}; -export { foo as bar, Foo as default, Foo as Bar }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsDefault_es5.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsDefault_es5.1.normal.js index 0a4732e13afb..38eb4c7b66d9 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsDefault_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsDefault_es5.1.normal.js @@ -4,9 +4,6 @@ // @outDir: ./out // @declaration: true // @filename: index1.js -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; export default 12; // @filename: index2.js export default function foo() { @@ -14,16 +11,20 @@ export default function foo() { }; export var x = foo; export { foo as bar }; +// @filename: index3.js +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var Foo = function Foo() { "use strict"; _class_call_check(this, Foo); this.a = /** @type {Foo} */ (null); }; -// @filename: index3.js export { Foo as default }; export var X = Foo; export { Foo as Bar }; // @filename: index4.js +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; import Fab from "./index3"; var Bar = /*#__PURE__*/ function(Fab) { "use strict"; @@ -41,10 +42,10 @@ var Bar = /*#__PURE__*/ function(Fab) { export default Bar; // @filename: index5.js // merge type alias and const (OK) -export default 12; -/** +export default 12; /** * @typedef {string | number} default - */ // @filename: index6.js + */ +// @filename: index6.js // merge type alias and function (OK) export default function func() {}; /** diff --git a/crates/swc/tests/tsc-references/jsDeclarationsDefault_es5.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsDefault_es5.2.minified.js index 938aba1efc48..0f26cc15c427 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsDefault_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsDefault_es5.2.minified.js @@ -1,16 +1,19 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; export default 12; export default function foo() { return foo; }; export var x = foo; +export { foo as bar }; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var Foo = function() { "use strict"; _class_call_check(this, Foo), this.a = null; }; export var X = Foo; +export { Foo as default, Foo as Bar }; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; import Fab from "./index3"; var Bar = function(Fab) { "use strict"; @@ -25,4 +28,3 @@ var Bar = function(Fab) { export default Bar; export default 12; export default function func() {}; -export { foo as bar, Foo as default, Foo as Bar }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsDefaultsErr_es2015.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsDefaultsErr_es2015.1.normal.js index c0691bd69b5f..cd2cbc3a1a0b 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsDefaultsErr_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsDefaultsErr_es2015.1.normal.js @@ -11,15 +11,14 @@ class Cls { } } Cls.y = "ok"; -export default Cls; -class C { -} -/** +export default Cls; /** * @typedef {string | number} default - */ // @filename: index2.js + */ +// @filename: index2.js // merge type alias and class (error message improvement needed, see #32368) -export { C as default }; -/** +export default class C { +}; + /** * @typedef {string | number} default */ // @filename: index3.js // merge type alias and variable (behavior is borked, see #32366) diff --git a/crates/swc/tests/tsc-references/jsDeclarationsDefaultsErr_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsDefaultsErr_es2015.2.minified.js index 3386b07b070e..a43b17441fa5 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsDefaultsErr_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsDefaultsErr_es2015.2.minified.js @@ -5,7 +5,7 @@ class Cls { } Cls.y = "ok"; export default Cls; -class C { -} +export default class C { +}; let x = 12; -export { C as default, x as default }; +export { x as default }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsDefaultsErr_es5.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsDefaultsErr_es5.1.normal.js index 3766e7b50fcd..fdab54f5fbea 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsDefaultsErr_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsDefaultsErr_es5.1.normal.js @@ -12,17 +12,18 @@ var Cls = function Cls() { this.x = 12; }; Cls.y = "ok"; -export default Cls; +export default Cls; /** + * @typedef {string | number} default + */ +// @filename: index2.js +// merge type alias and class (error message improvement needed, see #32368) +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var C = function C() { "use strict"; _class_call_check(this, C); }; -/** - * @typedef {string | number} default - */ // @filename: index2.js -// merge type alias and class (error message improvement needed, see #32368) export { C as default }; -/** + /** * @typedef {string | number} default */ // @filename: index3.js // merge type alias and variable (behavior is borked, see #32366) diff --git a/crates/swc/tests/tsc-references/jsDeclarationsDefaultsErr_es5.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsDefaultsErr_es5.2.minified.js index 04fd1ebd2f70..0da8998d2a82 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsDefaultsErr_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsDefaultsErr_es5.2.minified.js @@ -5,9 +5,11 @@ var Cls = function() { }; Cls.y = "ok"; export default Cls; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var C = function() { "use strict"; _class_call_check(this, C); }; +export { C as default }; var x = 12; -export { C as default, x as default }; +export { x as default }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsExportAssignedVisibility_es5.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsExportAssignedVisibility_es5.1.normal.js index 28ba8207b2e6..1ce06a50a33c 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsExportAssignedVisibility_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsExportAssignedVisibility_es5.1.normal.js @@ -11,6 +11,7 @@ module.exports = function Obj() { this.x = 12; }; // @filename: index.js +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var Obj = require("./obj"); var Container = function Container() { "use strict"; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsExportAssignedVisibility_es5.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsExportAssignedVisibility_es5.2.minified.js index 734e272c17e3..dc150563b9e8 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsExportAssignedVisibility_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsExportAssignedVisibility_es5.2.minified.js @@ -3,6 +3,7 @@ module.exports = function Obj() { "use strict"; _class_call_check(this, Obj), this.x = 12; }; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var Obj = require("./obj"), Container = function() { "use strict"; _class_call_check(this, Container), this.usage = new Obj(); diff --git a/crates/swc/tests/tsc-references/jsDeclarationsExportForms_es2015.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsExportForms_es2015.1.normal.js index fb2db7872ef3..19f5d0ee8603 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsExportForms_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsExportForms_es2015.1.normal.js @@ -13,9 +13,17 @@ export * from "./cls"; // @filename: bar2.js export * from "./func"; export * from "./cls"; +// @filename: baz.js +import { Foo } from "./cls"; export { Foo }; +// @filename: bat.js +import * as ns from "./cls"; export default ns; +// @filename: ban.js +import * as ns from "./cls"; export { ns }; +// @filename: bol.js +import * as ns from "./cls"; export { ns as classContainer }; // @filename: cjs.js const ns = require("./cls"); diff --git a/crates/swc/tests/tsc-references/jsDeclarationsExportForms_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsExportForms_es2015.2.minified.js index 159bc2caa10b..8b17e1c9d4f3 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsExportForms_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsExportForms_es2015.2.minified.js @@ -4,16 +4,23 @@ export function func() {} export * from "./cls"; export * from "./func"; export * from "./cls"; +import { Foo } from "./cls"; +export { Foo }; +import * as ns from "./cls"; export default ns; -let ns = require("./cls"); +import * as ns from "./cls"; +export { ns }; +import * as ns from "./cls"; +export { ns as classContainer }; +const ns = require("./cls"); module.exports = { ns }; -let ns = require("./cls"); +const ns = require("./cls"); module.exports = ns; -let ns = require("./cls"); +const ns = require("./cls"); module.exports.ns = ns; -let ns = require("./cls"); +const ns = require("./cls"); module.exports.names = ns; import "./cjs4"; import "./cjs3"; @@ -25,4 +32,3 @@ import "./bat"; import "./baz"; import "./bar"; import "./bar2"; -export { Foo, ns, ns as classContainer }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsExportForms_es5.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsExportForms_es5.1.normal.js index b05c4aade42c..282c1544897b 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsExportForms_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsExportForms_es5.1.normal.js @@ -16,9 +16,17 @@ export * from "./cls"; // @filename: bar2.js export * from "./func"; export * from "./cls"; +// @filename: baz.js +import { Foo } from "./cls"; export { Foo }; +// @filename: bat.js +import * as ns from "./cls"; export default ns; +// @filename: ban.js +import * as ns from "./cls"; export { ns }; +// @filename: bol.js +import * as ns from "./cls"; export { ns as classContainer }; // @filename: cjs.js var ns = require("./cls"); diff --git a/crates/swc/tests/tsc-references/jsDeclarationsExportForms_es5.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsExportForms_es5.2.minified.js index ffc570543c74..12e3888460f7 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsExportForms_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsExportForms_es5.2.minified.js @@ -7,7 +7,14 @@ export function func() {} export * from "./cls"; export * from "./func"; export * from "./cls"; +import { Foo } from "./cls"; +export { Foo }; +import * as ns from "./cls"; export default ns; +import * as ns from "./cls"; +export { ns }; +import * as ns from "./cls"; +export { ns as classContainer }; var ns = require("./cls"); module.exports = { ns: ns @@ -28,4 +35,3 @@ import "./bat"; import "./baz"; import "./bar"; import "./bar2"; -export { Foo, ns, ns as classContainer }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsFunctionClassesCjsExportAssignment_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsFunctionClassesCjsExportAssignment_es2015.2.minified.js index f4102cf532ab..b259ca19d893 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsFunctionClassesCjsExportAssignment_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsFunctionClassesCjsExportAssignment_es2015.2.minified.js @@ -1,11 +1,13 @@ +module.exports = function(timeout) { + this.timeout = timeout; +}; +module.exports = function(handle) { + this.handle = handle; +}; function Context(input) { if (!(this instanceof Context)) return new Context(input); this.state = this.construct(input); } -module.exports = function(timeout) { - this.timeout = timeout; -}, module.exports = function(handle) { - this.handle = handle; -}, Context.prototype = { +Context.prototype = { construct: (input, handle = ()=>void 0)=>input }, module.exports = Context; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsFunctionClassesCjsExportAssignment_es5.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsFunctionClassesCjsExportAssignment_es5.1.normal.js index 197fb281ed90..d3a61173f209 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsFunctionClassesCjsExportAssignment_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsFunctionClassesCjsExportAssignment_es5.1.normal.js @@ -6,8 +6,7 @@ // @filename: timer.js /** * @param {number} timeout - */ import _instanceof from "@swc/helpers/src/_instanceof.mjs"; -function Timer(timeout) { + */ function Timer(timeout) { this.timeout = timeout; } module.exports = Timer; @@ -44,7 +43,8 @@ module.exports = Hook; * * @class * @param {Input} input - */ function Context(input) { + */ import _instanceof from "@swc/helpers/src/_instanceof.mjs"; +function Context(input) { if (!_instanceof(this, Context)) { return new Context(input); } diff --git a/crates/swc/tests/tsc-references/jsDeclarationsFunctionClassesCjsExportAssignment_es5.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsFunctionClassesCjsExportAssignment_es5.2.minified.js index 4bb5d140c9ca..5187b0e00e81 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsFunctionClassesCjsExportAssignment_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsFunctionClassesCjsExportAssignment_es5.2.minified.js @@ -1,13 +1,15 @@ +module.exports = function(timeout) { + this.timeout = timeout; +}; +module.exports = function(handle) { + this.handle = handle; +}; import _instanceof from "@swc/helpers/src/_instanceof.mjs"; function Context(input) { if (!_instanceof(this, Context)) return new Context(input); this.state = this.construct(input); } -module.exports = function(timeout) { - this.timeout = timeout; -}, module.exports = function(handle) { - this.handle = handle; -}, Context.prototype = { +Context.prototype = { construct: function(input) { return arguments.length > 1 && void 0 !== arguments[1] && arguments[1], input; } diff --git a/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2_es2015.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2_es2015.1.normal.js index 42607a87d69c..447d38e08975 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2_es2015.1.normal.js @@ -62,4 +62,6 @@ Point2D.prototype = { this.storage[1] = y; } }; +// @filename: referencer.js +import { Point2D } from "./source"; export const origin = new Point2D(0, 0); // export const res = Point2D(2, 3).dot(origin); // TODO: when __proto__ works, validate this diff --git a/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2_es2015.2.minified.js index 09cf15aa3436..ffa987cd364b 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2_es2015.2.minified.js @@ -33,4 +33,5 @@ Point2D.prototype = { this.storage[1] = y; } }; +import { Point2D } from "./source"; export const origin = new Point2D(0, 0); diff --git a/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2_es5.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2_es5.1.normal.js index 791c4a534300..2208bbc60431 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2_es5.1.normal.js @@ -63,4 +63,6 @@ Point2D.prototype = { this.storage[1] = y; } }; +// @filename: referencer.js +import { Point2D } from "./source"; export var origin = new Point2D(0, 0); // export const res = Point2D(2, 3).dot(origin); // TODO: when __proto__ works, validate this diff --git a/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2_es5.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2_es5.2.minified.js index a79b9970801d..cf5b2d278f08 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses2_es5.2.minified.js @@ -32,4 +32,5 @@ Point2D.prototype = { this.storage[1] = y; } }; +import { Point2D } from "./source"; export var origin = new Point2D(0, 0); diff --git a/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses_es2015.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses_es2015.1.normal.js index 7c03087a4052..5a8c9459d6f3 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses_es2015.1.normal.js @@ -14,6 +14,7 @@ this.x = x; this.y = y; } +// @filename: referencer.js /** * @param {Point} p */ export function magnitude(p) { diff --git a/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses_es5.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses_es5.1.normal.js index 9822473974f1..268f989eb7df 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsFunctionLikeClasses_es5.1.normal.js @@ -15,6 +15,7 @@ export function Point(x, y) { this.x = x; this.y = y; } +// @filename: referencer.js /** * @param {Point} p */ export function magnitude(p) { diff --git a/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespaceCjs_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespaceCjs_es2015.2.minified.js index 0f10cacdaf16..16a6667b36f9 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespaceCjs_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespaceCjs_es2015.2.minified.js @@ -1,5 +1,4 @@ -const myTypes = {}; -exports.myTypes = myTypes; +exports.myTypes = {}; const { myTypes } = require('./file.js'); module.exports = { testFn: function(input) { diff --git a/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespaceCjs_es5.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespaceCjs_es5.2.minified.js index 2ab1e0984309..2f91a7d09a9c 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespaceCjs_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespaceCjs_es5.2.minified.js @@ -1,7 +1,5 @@ -var myTypes = {}; -exports.myTypes = myTypes; -var myTypes = require("./file.js").myTypes; -module.exports = { +exports.myTypes = {}; +require("./file.js").myTypes, module.exports = { testFn: function(input) { return "number" == typeof input ? 2 * input : null; }, diff --git a/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespace_es2015.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespace_es2015.1.normal.js index c264b83d25a5..ca650b18cb5f 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespace_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespace_es2015.1.normal.js @@ -16,6 +16,7 @@ * @property {myTypes.typeA} prop1 - Prop 1. * @property {string} prop2 - Prop 2. */ /** @typedef {myTypes.typeB|Function} myTypes.typeC */ export { myTypes }; +// @filename: file2.js /** * @namespace testFnTypes * @global diff --git a/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespace_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespace_es2015.2.minified.js index 0accc7c28202..3d39ab4ee1ed 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespace_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespace_es2015.2.minified.js @@ -1,6 +1,7 @@ let myTypes = {}; +export { myTypes }; let testFnTypes = {}; function testFn(input) { return 'number' == typeof input ? 2 * input : null; } -export { myTypes, testFn, testFnTypes }; +export { testFn, testFnTypes }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespace_es5.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespace_es5.1.normal.js index d2e60d41180d..bf2e568318ee 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespace_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespace_es5.1.normal.js @@ -16,6 +16,7 @@ * @property {myTypes.typeA} prop1 - Prop 1. * @property {string} prop2 - Prop 2. */ /** @typedef {myTypes.typeB|Function} myTypes.typeC */ export { myTypes }; +// @filename: file2.js /** * @namespace testFnTypes * @global diff --git a/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespace_es5.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespace_es5.2.minified.js index be8961ba6ac4..8aa6e9c53b11 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespace_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsImportAliasExposedWithinNamespace_es5.2.minified.js @@ -1,6 +1,7 @@ var myTypes = {}; +export { myTypes }; var testFnTypes = {}; function testFn(input) { return "number" == typeof input ? 2 * input : null; } -export { myTypes, testFn, testFnTypes }; +export { testFn, testFnTypes }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsImportNamespacedType_es2015.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsImportNamespacedType_es2015.1.normal.js index e1f911e69cb3..18132b76c642 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsImportNamespacedType_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsImportNamespacedType_es2015.1.normal.js @@ -3,5 +3,6 @@ // @checkJs: true // @filename: file.js /** @type {import('./mod1').Dotted.Name} - should work */ var dot2; +export { }; // @filename: mod1.js /** @typedef {number} Dotted.Name */ export var dummy = 1; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsImportNamespacedType_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsImportNamespacedType_es2015.2.minified.js index 83c4fb71fe0b..f79371e2e4bf 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsImportNamespacedType_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsImportNamespacedType_es2015.2.minified.js @@ -1 +1,2 @@ +export { }; export var dummy = 1; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsImportNamespacedType_es5.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsImportNamespacedType_es5.1.normal.js index e1f911e69cb3..18132b76c642 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsImportNamespacedType_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsImportNamespacedType_es5.1.normal.js @@ -3,5 +3,6 @@ // @checkJs: true // @filename: file.js /** @type {import('./mod1').Dotted.Name} - should work */ var dot2; +export { }; // @filename: mod1.js /** @typedef {number} Dotted.Name */ export var dummy = 1; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsImportNamespacedType_es5.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsImportNamespacedType_es5.2.minified.js index 83c4fb71fe0b..f79371e2e4bf 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsImportNamespacedType_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsImportNamespacedType_es5.2.minified.js @@ -1 +1,2 @@ +export { }; export var dummy = 1; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsImportTypeBundled_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsImportTypeBundled_es2015.2.minified.js index 96ad9650cdeb..555b1ff31356 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsImportTypeBundled_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsImportTypeBundled_es2015.2.minified.js @@ -1,6 +1,7 @@ module.exports = { x: 12 -}, module.exports = [ +}; +module.exports = [ { x: 12 } diff --git a/crates/swc/tests/tsc-references/jsDeclarationsImportTypeBundled_es5.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsImportTypeBundled_es5.2.minified.js index 96ad9650cdeb..555b1ff31356 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsImportTypeBundled_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsImportTypeBundled_es5.2.minified.js @@ -1,6 +1,7 @@ module.exports = { x: 12 -}, module.exports = [ +}; +module.exports = [ { x: 12 } diff --git a/crates/swc/tests/tsc-references/jsDeclarationsReexportAliases_es5.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsReexportAliases_es5.2.minified.js index 6a37ef986d09..2e296518f89f 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsReexportAliases_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsReexportAliases_es5.2.minified.js @@ -3,7 +3,7 @@ var Foo = function() { "use strict"; _class_call_check(this, Foo); }; +export { Foo as default }; import { default as Fooa } from "./cls"; export var x = new Fooa(); export { default as Foob } from "./cls"; -export { Foo as default }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsReferenceToClassInstanceCrossFile_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsReferenceToClassInstanceCrossFile_es2015.2.minified.js index 0b2f5cf01fac..51241cb7fd2f 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsReferenceToClassInstanceCrossFile_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsReferenceToClassInstanceCrossFile_es2015.2.minified.js @@ -1,23 +1,21 @@ -class Rectangle { - constructor(){ - console.log("I'm a rectangle!"); - } -} module.exports = { - Rectangle + Rectangle: class { + constructor(){ + console.log("I'm a rectangle!"); + } + } }; const { Rectangle } = require('./rectangle'); -class Render { - addRectangle() { - let obj = new Rectangle(); - return this.objects.push(obj), obj; - } - constructor(){ - this.objects = []; - } -} module.exports = { - Render + Render: class { + addRectangle() { + let obj = new Rectangle(); + return this.objects.push(obj), obj; + } + constructor(){ + this.objects = []; + } + } }; const { Render } = require("./index"); let render = new Render(); diff --git a/crates/swc/tests/tsc-references/jsDeclarationsReferenceToClassInstanceCrossFile_es5.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsReferenceToClassInstanceCrossFile_es5.1.normal.js index 57a1c57bc2ee..83879a492c93 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsReferenceToClassInstanceCrossFile_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsReferenceToClassInstanceCrossFile_es5.1.normal.js @@ -14,6 +14,7 @@ module.exports = { Rectangle: Rectangle }; // @filename: index.js +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var Rectangle = require("./rectangle").Rectangle; var Render = /*#__PURE__*/ function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsReferenceToClassInstanceCrossFile_es5.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsReferenceToClassInstanceCrossFile_es5.2.minified.js index 56c1400e2bbd..483953fd00bb 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsReferenceToClassInstanceCrossFile_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsReferenceToClassInstanceCrossFile_es5.2.minified.js @@ -6,6 +6,7 @@ var Rectangle = function() { module.exports = { Rectangle: Rectangle }; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var Rectangle = require("./rectangle").Rectangle, Render = function() { "use strict"; function Render() { @@ -19,5 +20,5 @@ var Rectangle = require("./rectangle").Rectangle, Render = function() { module.exports = { Render: Render }; -var Render = require("./index").Render, render = new Render(); +var render = new (require("./index")).Render(); render.addRectangle(), console.log("Objects", render.objects); diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases_es2015.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases_es2015.1.normal.js index c29da76d5ac9..415eaf5fe18a 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases_es2015.1.normal.js @@ -3,25 +3,27 @@ // @outDir: ./out // @declaration: true // @filename: index.js -/** +export { }; // flag file as module + /** * @typedef {string | number | symbol} PropName - */ /** + */ /** * Callback * * @callback NumberToStringCb * @param {number} a * @returns {string} - */ /** + */ /** * @template T * @typedef {T & {name: string}} MixinName - */ /** + */ /** * Identity function * * @template T * @callback Identity * @param {T} x * @returns {T} - */ // @filename: mixed.js + */ +// @filename: mixed.js /** * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType */ /** @@ -46,4 +48,3 @@ class LocalThing { this.y = "ok"; } } -export { }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases_es2015.2.minified.js index b62dd801a77b..c0c4ea70d164 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases_es2015.2.minified.js @@ -1,3 +1,4 @@ +export { }; module.exports = { doTheThing: function(x) { return { @@ -10,4 +11,3 @@ module.exports = { } } }; -export { }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases_es5.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases_es5.1.normal.js index d7de74e4ac45..5501211a6dfc 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases_es5.1.normal.js @@ -3,32 +3,34 @@ // @outDir: ./out // @declaration: true // @filename: index.js -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -/** +export { }; // flag file as module + /** * @typedef {string | number | symbol} PropName - */ /** + */ /** * Callback * * @callback NumberToStringCb * @param {number} a * @returns {string} - */ /** + */ /** * @template T * @typedef {T & {name: string}} MixinName - */ /** + */ /** * Identity function * * @template T * @callback Identity * @param {T} x * @returns {T} - */ // @filename: mixed.js + */ +// @filename: mixed.js /** * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType */ /** * @param {number} x * @returns {SomeType} - */ function doTheThing(x) { + */ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +function doTheThing(x) { return { x: "" + x }; @@ -47,4 +49,3 @@ var LocalThing = function LocalThing() { _class_call_check(this, LocalThing); this.y = "ok"; }; -export { }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases_es5.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases_es5.2.minified.js index e22eacbbedf8..db6d30e3003a 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypeAliases_es5.2.minified.js @@ -1,3 +1,4 @@ +export { }; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var ExportedThing = function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration2_es2015.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration2_es2015.1.normal.js index fbe1a3dfa678..f0f551150256 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration2_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration2_es2015.1.normal.js @@ -4,8 +4,8 @@ // @lib: es6 // @declaration: true // @filename: some-mod.d.ts +module.exports = getItems; +export { }; // @filename: index.js const items = require("./some-mod")(); module.exports = items; -module.exports = getItems; -export { }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration2_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration2_es2015.2.minified.js index 5612c81b5d68..e526d1aeadce 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration2_es2015.2.minified.js @@ -1,3 +1,4 @@ -let items = require("./some-mod")(); -module.exports = items, module.exports = getItems; +module.exports = getItems; export { }; +const items = require("./some-mod")(); +module.exports = items; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration2_es5.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration2_es5.1.normal.js index 055bca1e3fab..7bbd816f56f4 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration2_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration2_es5.1.normal.js @@ -4,8 +4,8 @@ // @lib: es6 // @declaration: true // @filename: some-mod.d.ts +module.exports = getItems; +export { }; // @filename: index.js var items = require("./some-mod")(); module.exports = items; -module.exports = getItems; -export { }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration2_es5.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration2_es5.2.minified.js index b6938b11ee32..edc5cfa43092 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration2_es5.2.minified.js @@ -1,3 +1,4 @@ -var items = require("./some-mod")(); -module.exports = items, module.exports = getItems; +module.exports = getItems; export { }; +var items = require("./some-mod")(); +module.exports = items; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration_es2015.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration_es2015.1.normal.js index 9967e7a74f40..eb499b9bcc10 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration_es2015.1.normal.js @@ -4,8 +4,8 @@ // @lib: es6 // @declaration: true // @filename: /some-mod.d.ts +module.exports = items; +export { }; // @filename: index.js /** @type {typeof import("/some-mod")} */ const items = []; module.exports = items; -module.exports = items; -export { }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration_es2015.2.minified.js index c39611977e04..0570dcb038f1 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration_es2015.2.minified.js @@ -1,3 +1,3 @@ -let items = []; -module.exports = items, module.exports = items; +module.exports = items; export { }; +module.exports = []; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration_es5.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration_es5.1.normal.js index 5882a7dbaac6..6ef1fe373fcf 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration_es5.1.normal.js @@ -4,8 +4,8 @@ // @lib: es6 // @declaration: true // @filename: /some-mod.d.ts +module.exports = items; +export { }; // @filename: index.js /** @type {typeof import("/some-mod")} */ var items = []; module.exports = items; -module.exports = items; -export { }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration_es5.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration_es5.2.minified.js index cb0674968ab4..0570dcb038f1 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypeReassignmentFromDeclaration_es5.2.minified.js @@ -1,3 +1,3 @@ -var items = []; -module.exports = items, module.exports = items; +module.exports = items; export { }; +module.exports = []; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypeReferences2_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsTypeReferences2_es2015.2.minified.js index 124b2199080f..61af91173b14 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypeReferences2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypeReferences2_es2015.2.minified.js @@ -2,7 +2,7 @@ export const o = { a: 1, m: 1 }; -let { a , m } = require("./something").o; +const { a , m } = require("./something").o; module.exports = { thing: a + m }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndImportTypes_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndImportTypes_es2015.2.minified.js index f097b9787610..90a4fc02dce9 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndImportTypes_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndImportTypes_es2015.2.minified.js @@ -3,7 +3,8 @@ module.exports = class { constructor(){ this.item = 3; } -}, module.exports = { +}; +module.exports = { Wrap: class { constructor(c){ this.connItem = c.item, this.another = ""; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndImportTypes_es5.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndImportTypes_es5.1.normal.js index 5d0b4aab3aaa..301cedb495dd 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndImportTypes_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndImportTypes_es5.1.normal.js @@ -20,7 +20,8 @@ module.exports = Conn; // @filename: usage.js /** * @typedef {import("./conn")} Conn - */ var Wrap = function Wrap(c) { + */ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +var Wrap = function Wrap(c) { "use strict"; _class_call_check(this, Wrap); this.connItem = c.item; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndImportTypes_es5.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndImportTypes_es5.2.minified.js index 1d6c83fe7682..9b9b02b475b8 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndImportTypes_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypedefAndImportTypes_es5.2.minified.js @@ -7,6 +7,7 @@ var Conn = function() { return Conn.prototype.method = function() {}, Conn; }(); module.exports = Conn; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var Wrap = function(c) { "use strict"; _class_call_check(this, Wrap), this.connItem = c.item, this.another = ""; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypedefPropertyAndExportAssignment_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsTypedefPropertyAndExportAssignment_es2015.2.minified.js index 2c04b6e8c401..088c784ce465 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypedefPropertyAndExportAssignment_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypedefPropertyAndExportAssignment_es2015.2.minified.js @@ -1,16 +1,15 @@ -const taskGroups = { - parseHTML: { - id: 'parseHTML', - label: 'Parse HTML & CSS' - }, - styleLayout: { - id: 'styleLayout', - label: 'Style & Layout' - } -}, taskNameToGroup = {}; module.exports = { - taskGroups, - taskNameToGroup + taskGroups: { + parseHTML: { + id: 'parseHTML', + label: 'Parse HTML & CSS' + }, + styleLayout: { + id: 'styleLayout', + label: 'Style & Layout' + } + }, + taskNameToGroup: {} }; const { taskGroups , taskNameToGroup } = require('./module.js'); module.exports = class { diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypedefPropertyAndExportAssignment_es5.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsTypedefPropertyAndExportAssignment_es5.1.normal.js index 4f229e71ffe9..03f19ef98843 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypedefPropertyAndExportAssignment_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypedefPropertyAndExportAssignment_es5.1.normal.js @@ -11,8 +11,7 @@ * @property {string[]} traceEventNames */ /** * @type {{[P in TaskGroupIds]: {id: P, label: string}}} - */ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var taskGroups = { + */ var taskGroups = { parseHTML: { id: "parseHTML", label: "Parse HTML & CSS" @@ -28,6 +27,7 @@ module.exports = { taskNameToGroup: taskNameToGroup }; // @filename: index.js +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var ref = require("./module.js"), taskGroups = ref.taskGroups, taskNameToGroup = ref.taskNameToGroup; /** @typedef {import('./module.js').TaskGroup} TaskGroup */ /** * @typedef TaskNode diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypedefPropertyAndExportAssignment_es5.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsTypedefPropertyAndExportAssignment_es5.2.minified.js index c704c4330a3c..c08b02f19b38 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypedefPropertyAndExportAssignment_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypedefPropertyAndExportAssignment_es5.2.minified.js @@ -1,19 +1,20 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var taskGroups = { - parseHTML: { - id: "parseHTML", - label: "Parse HTML & CSS" - }, - styleLayout: { - id: "styleLayout", - label: "Style & Layout" - } -}, taskNameToGroup = {}; module.exports = { - taskGroups: taskGroups, - taskNameToGroup: taskNameToGroup + taskGroups: { + parseHTML: { + id: "parseHTML", + label: "Parse HTML & CSS" + }, + styleLayout: { + id: "styleLayout", + label: "Style & Layout" + } + }, + taskNameToGroup: {} }; -var ref = require("./module.js"), taskGroups = ref.taskGroups, taskNameToGroup = ref.taskNameToGroup, MainThreadTasks = function(x, y) { +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +var ref = require("./module.js"); +ref.taskGroups, ref.taskNameToGroup; +var MainThreadTasks = function(x, y) { "use strict"; _class_call_check(this, MainThreadTasks); }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsUniqueSymbolUsage_es2015.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsUniqueSymbolUsage_es2015.1.normal.js index 00f98d8856a3..b52b17c047bb 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsUniqueSymbolUsage_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsUniqueSymbolUsage_es2015.1.normal.js @@ -4,10 +4,10 @@ // @emitDeclarationOnly: true // @lib: es2017 // @filename: a.js -export const kSymbol = Symbol("my-symbol"); -/** +export const kSymbol = Symbol("my-symbol"); /** * @typedef {{[kSymbol]: true}} WithSymbol - */ // @filename: b.js + */ +// @filename: b.js /** * @returns {import('./a').WithSymbol} * @param {import('./a').WithSymbol} value diff --git a/crates/swc/tests/tsc-references/jsDeclarationsUniqueSymbolUsage_es5.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsUniqueSymbolUsage_es5.1.normal.js index daf5b4361d64..6e1b4fabae6d 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsUniqueSymbolUsage_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsUniqueSymbolUsage_es5.1.normal.js @@ -4,10 +4,10 @@ // @emitDeclarationOnly: true // @lib: es2017 // @filename: a.js -export var kSymbol = Symbol("my-symbol"); -/** +export var kSymbol = Symbol("my-symbol"); /** * @typedef {{[kSymbol]: true}} WithSymbol - */ // @filename: b.js + */ +// @filename: b.js /** * @returns {import('./a').WithSymbol} * @param {import('./a').WithSymbol} value diff --git a/crates/swc/tests/tsc-references/jsObjectsMarkedAsOpenEnded_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsObjectsMarkedAsOpenEnded_es2015.2.minified.js index 7823c58779dd..ccecfab35454 100644 --- a/crates/swc/tests/tsc-references/jsObjectsMarkedAsOpenEnded_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsObjectsMarkedAsOpenEnded_es2015.2.minified.js @@ -1,15 +1,2 @@ -var variable = {}; -variable.a = 0; -class C { - constructor(){ - this.initializedMember = {}, this.member = {}, this.member.a = 0; - } -} -var obj = { - property: {} -}; -obj.property.a = 0; -var arr = [ - {} -]; -variable.a = 1, new C().member.a = 1, new C().initializedMember.a = 1, obj.property.a = 1, arr[0].a = 1, ({}).a = 1; +({}).a = 0, ({}).a = 0; +variable.a = 1, new C().member.a = 1, new C().initializedMember.a = 1, obj.property.a = 1, arr[0].a = 1, getObj().a = 1; diff --git a/crates/swc/tests/tsc-references/jsObjectsMarkedAsOpenEnded_es5.2.minified.js b/crates/swc/tests/tsc-references/jsObjectsMarkedAsOpenEnded_es5.2.minified.js index 28b3ca263d39..220eafc89803 100644 --- a/crates/swc/tests/tsc-references/jsObjectsMarkedAsOpenEnded_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsObjectsMarkedAsOpenEnded_es5.2.minified.js @@ -1,14 +1,8 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var variable = {}; -variable.a = 0; +({}).a = 0; var C = function() { "use strict"; _class_call_check(this, C), this.initializedMember = {}, this.member = {}, this.member.a = 0; -}, obj = { - property: {} }; -obj.property.a = 0; -var arr = [ - {} -]; -variable.a = 1, new C().member.a = 1, new C().initializedMember.a = 1, obj.property.a = 1, arr[0].a = 1, ({}).a = 1; +({}).a = 0; +variable.a = 1, new C().member.a = 1, new C().initializedMember.a = 1, obj.property.a = 1, arr[0].a = 1, getObj().a = 1; diff --git a/crates/swc/tests/tsc-references/jsxCheckJsxNoTypeArgumentsAllowed_es2015.1.normal.js b/crates/swc/tests/tsc-references/jsxCheckJsxNoTypeArgumentsAllowed_es2015.1.normal.js index b2b76c490eaf..666d46a416c9 100644 --- a/crates/swc/tests/tsc-references/jsxCheckJsxNoTypeArgumentsAllowed_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/jsxCheckJsxNoTypeArgumentsAllowed_es2015.1.normal.js @@ -7,6 +7,8 @@ // @checkJs: true // @filename: component.d.ts import * as React from "react"; +// @filename: file.jsx +import { MyComp } from "./component"; import * as React from "react"; let x = /*#__PURE__*/ React.createElement(MyComp, { a: 10, diff --git a/crates/swc/tests/tsc-references/jsxCheckJsxNoTypeArgumentsAllowed_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsxCheckJsxNoTypeArgumentsAllowed_es2015.2.minified.js index 8fe5a150721a..0b6766011874 100644 --- a/crates/swc/tests/tsc-references/jsxCheckJsxNoTypeArgumentsAllowed_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxCheckJsxNoTypeArgumentsAllowed_es2015.2.minified.js @@ -1,2 +1,3 @@ import * as React from "react"; +import { MyComp } from "./component"; import * as React from "react"; diff --git a/crates/swc/tests/tsc-references/jsxCheckJsxNoTypeArgumentsAllowed_es5.1.normal.js b/crates/swc/tests/tsc-references/jsxCheckJsxNoTypeArgumentsAllowed_es5.1.normal.js index 9c76f439475c..757a41683b83 100644 --- a/crates/swc/tests/tsc-references/jsxCheckJsxNoTypeArgumentsAllowed_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/jsxCheckJsxNoTypeArgumentsAllowed_es5.1.normal.js @@ -7,6 +7,8 @@ // @checkJs: true // @filename: component.d.ts import * as React from "react"; +// @filename: file.jsx +import { MyComp } from "./component"; import * as React from "react"; var x = /*#__PURE__*/ React.createElement(MyComp, { a: 10, diff --git a/crates/swc/tests/tsc-references/jsxCheckJsxNoTypeArgumentsAllowed_es5.2.minified.js b/crates/swc/tests/tsc-references/jsxCheckJsxNoTypeArgumentsAllowed_es5.2.minified.js index 8fe5a150721a..0b6766011874 100644 --- a/crates/swc/tests/tsc-references/jsxCheckJsxNoTypeArgumentsAllowed_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxCheckJsxNoTypeArgumentsAllowed_es5.2.minified.js @@ -1,2 +1,3 @@ import * as React from "react"; +import { MyComp } from "./component"; import * as React from "react"; diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma_es2015.1.normal.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma_es2015.1.normal.js index 131fef1c84cc..b3b048265057 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma_es2015.1.normal.js @@ -13,9 +13,11 @@ const a = /*#__PURE__*/ _jsxs(_Fragment, { }) ] }); +export { }; // @filename: react.tsx /// -/* @jsxImportSource react */ import "./preact"; +/* @jsxImportSource react */ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime"; +import "./preact"; const a = /*#__PURE__*/ _jsxs(_Fragment, { children: [ /*#__PURE__*/ _jsx("p", {}), diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma_es2015.2.minified.js index 9b9967d9bd98..bcb96fb32377 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma_es2015.2.minified.js @@ -1,2 +1,3 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime"; +import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime"; import "./preact"; diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma_es5.1.normal.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma_es5.1.normal.js index 21b780b4c2c9..1784630e3f5d 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma_es5.1.normal.js @@ -13,9 +13,11 @@ var a = /*#__PURE__*/ _jsxs(_Fragment, { }) ] }); +export { }; // @filename: react.tsx /// -/* @jsxImportSource react */ import "./preact"; +/* @jsxImportSource react */ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime"; +import "./preact"; var a = /*#__PURE__*/ _jsxs(_Fragment, { children: [ /*#__PURE__*/ _jsx("p", {}), diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma_es5.2.minified.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma_es5.2.minified.js index 9b9967d9bd98..bcb96fb32377 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma_es5.2.minified.js @@ -1,2 +1,3 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime"; +import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime"; import "./preact"; diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma_es2015.1.normal.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma_es2015.1.normal.js index 5471c1e6e1d9..3011b1480a47 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma_es2015.1.normal.js @@ -16,9 +16,14 @@ const a = /*#__PURE__*/ _jsx("div", _object_spread_props(_object_spread({}, prop const b = /*#__PURE__*/ _createElement("div", _object_spread_props(_object_spread({}, props), { key: "bar" }), "text"); +export { }; // @filename: react.tsx /// -/* @jsxImportSource react */ import "./preact"; +/* @jsxImportSource react */ import _object_spread from "@swc/helpers/src/_object_spread.mjs"; +import _object_spread_props from "@swc/helpers/src/_object_spread_props.mjs"; +import { jsx as _jsx } from "react/jsx-runtime"; +import { createElement as _createElement } from "react"; +import "./preact"; const props2 = { answer: 42 }; diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma_es2015.2.minified.js index 215821126a7c..47caaad6c62b 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma_es2015.2.minified.js @@ -10,6 +10,10 @@ _object_spread_props(_object_spread({}, props), { }), _object_spread_props(_object_spread({}, props), { key: "bar" }); +import _object_spread from "@swc/helpers/src/_object_spread.mjs"; +import _object_spread_props from "@swc/helpers/src/_object_spread_props.mjs"; +import { jsx as _jsx } from "react/jsx-runtime"; +import { createElement as _createElement } from "react"; import "./preact"; let props2 = { answer: 42 diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma_es5.1.normal.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma_es5.1.normal.js index 2431cd2096ea..e2989b13d787 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma_es5.1.normal.js @@ -16,9 +16,14 @@ var a = /*#__PURE__*/ _jsx("div", _object_spread_props(_object_spread({}, props) var b = /*#__PURE__*/ _createElement("div", _object_spread_props(_object_spread({}, props), { key: "bar" }), "text"); +export { }; // @filename: react.tsx /// -/* @jsxImportSource react */ import "./preact"; +/* @jsxImportSource react */ import _object_spread from "@swc/helpers/src/_object_spread.mjs"; +import _object_spread_props from "@swc/helpers/src/_object_spread_props.mjs"; +import { jsx as _jsx } from "react/jsx-runtime"; +import { createElement as _createElement } from "react"; +import "./preact"; var props2 = { answer: 42 }; diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma_es5.2.minified.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma_es5.2.minified.js index 4596a637a6a7..032171634f77 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma_es5.2.minified.js @@ -10,6 +10,10 @@ _object_spread_props(_object_spread({}, props), { }), _object_spread_props(_object_spread({}, props), { key: "bar" }); +import _object_spread from "@swc/helpers/src/_object_spread.mjs"; +import _object_spread_props from "@swc/helpers/src/_object_spread_props.mjs"; +import { jsx as _jsx } from "react/jsx-runtime"; +import { createElement as _createElement } from "react"; import "./preact"; var props2 = { answer: 42 diff --git a/crates/swc/tests/tsc-references/letIdentifierInElementAccess01_es2015.1.normal.js b/crates/swc/tests/tsc-references/letIdentifierInElementAccess01_es2015.1.normal.js new file mode 100644 index 000000000000..12dea49a8efa --- /dev/null +++ b/crates/swc/tests/tsc-references/letIdentifierInElementAccess01_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 1 | var let: any = {}; +//! : ^^^ +//! `---- +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | (let[0] = 100); +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/letIdentifierInElementAccess01_es2015.2.minified.js b/crates/swc/tests/tsc-references/letIdentifierInElementAccess01_es2015.2.minified.js new file mode 100644 index 000000000000..12dea49a8efa --- /dev/null +++ b/crates/swc/tests/tsc-references/letIdentifierInElementAccess01_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 1 | var let: any = {}; +//! : ^^^ +//! `---- +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | (let[0] = 100); +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/letIdentifierInElementAccess01_es5.1.normal.js b/crates/swc/tests/tsc-references/letIdentifierInElementAccess01_es5.1.normal.js new file mode 100644 index 000000000000..12dea49a8efa --- /dev/null +++ b/crates/swc/tests/tsc-references/letIdentifierInElementAccess01_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 1 | var let: any = {}; +//! : ^^^ +//! `---- +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | (let[0] = 100); +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/letIdentifierInElementAccess01_es5.2.minified.js b/crates/swc/tests/tsc-references/letIdentifierInElementAccess01_es5.2.minified.js new file mode 100644 index 000000000000..12dea49a8efa --- /dev/null +++ b/crates/swc/tests/tsc-references/letIdentifierInElementAccess01_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 1 | var let: any = {}; +//! : ^^^ +//! `---- +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 2 | (let[0] = 100); +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/libReferenceDeclarationEmitBundle_es2015.1.normal.js b/crates/swc/tests/tsc-references/libReferenceDeclarationEmitBundle_es2015.1.normal.js index 0e84f4cdacd2..6473502f6b8f 100644 --- a/crates/swc/tests/tsc-references/libReferenceDeclarationEmitBundle_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/libReferenceDeclarationEmitBundle_es2015.1.normal.js @@ -6,3 +6,6 @@ // @filename: file1.ts /// export { }; +// @filename: file2.ts +/// +export { }; diff --git a/crates/swc/tests/tsc-references/libReferenceDeclarationEmitBundle_es2015.2.minified.js b/crates/swc/tests/tsc-references/libReferenceDeclarationEmitBundle_es2015.2.minified.js index 2234b9cae16d..98fdd3114198 100644 --- a/crates/swc/tests/tsc-references/libReferenceDeclarationEmitBundle_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/libReferenceDeclarationEmitBundle_es2015.2.minified.js @@ -1 +1,2 @@ export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/libReferenceDeclarationEmitBundle_es5.1.normal.js b/crates/swc/tests/tsc-references/libReferenceDeclarationEmitBundle_es5.1.normal.js index 0e84f4cdacd2..6473502f6b8f 100644 --- a/crates/swc/tests/tsc-references/libReferenceDeclarationEmitBundle_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/libReferenceDeclarationEmitBundle_es5.1.normal.js @@ -6,3 +6,6 @@ // @filename: file1.ts /// export { }; +// @filename: file2.ts +/// +export { }; diff --git a/crates/swc/tests/tsc-references/libReferenceDeclarationEmitBundle_es5.2.minified.js b/crates/swc/tests/tsc-references/libReferenceDeclarationEmitBundle_es5.2.minified.js index 2234b9cae16d..98fdd3114198 100644 --- a/crates/swc/tests/tsc-references/libReferenceDeclarationEmitBundle_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/libReferenceDeclarationEmitBundle_es5.2.minified.js @@ -1 +1,2 @@ export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/libReferenceDeclarationEmit_es2015.1.normal.js b/crates/swc/tests/tsc-references/libReferenceDeclarationEmit_es2015.1.normal.js index 6adbcf1f414c..b440e0fb34e0 100644 --- a/crates/swc/tests/tsc-references/libReferenceDeclarationEmit_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/libReferenceDeclarationEmit_es2015.1.normal.js @@ -5,3 +5,6 @@ // @filename: file1.ts /// export { }; +// @filename: file2.ts +/// +export { }; diff --git a/crates/swc/tests/tsc-references/libReferenceDeclarationEmit_es2015.2.minified.js b/crates/swc/tests/tsc-references/libReferenceDeclarationEmit_es2015.2.minified.js index 2234b9cae16d..98fdd3114198 100644 --- a/crates/swc/tests/tsc-references/libReferenceDeclarationEmit_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/libReferenceDeclarationEmit_es2015.2.minified.js @@ -1 +1,2 @@ export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/libReferenceDeclarationEmit_es5.1.normal.js b/crates/swc/tests/tsc-references/libReferenceDeclarationEmit_es5.1.normal.js index 6adbcf1f414c..b440e0fb34e0 100644 --- a/crates/swc/tests/tsc-references/libReferenceDeclarationEmit_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/libReferenceDeclarationEmit_es5.1.normal.js @@ -5,3 +5,6 @@ // @filename: file1.ts /// export { }; +// @filename: file2.ts +/// +export { }; diff --git a/crates/swc/tests/tsc-references/libReferenceDeclarationEmit_es5.2.minified.js b/crates/swc/tests/tsc-references/libReferenceDeclarationEmit_es5.2.minified.js index 2234b9cae16d..98fdd3114198 100644 --- a/crates/swc/tests/tsc-references/libReferenceDeclarationEmit_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/libReferenceDeclarationEmit_es5.2.minified.js @@ -1 +1,2 @@ export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/libReferenceNoLibBundle_es2015.1.normal.js b/crates/swc/tests/tsc-references/libReferenceNoLibBundle_es2015.1.normal.js index 664e2bbb285f..04330c8505e5 100644 --- a/crates/swc/tests/tsc-references/libReferenceNoLibBundle_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/libReferenceNoLibBundle_es2015.1.normal.js @@ -5,6 +5,8 @@ // @outFile: bundle.js // Test that passing noLib disables resolution. // @filename: fakelib.ts +// @filename: file1.ts +/// export const elem = { field: 'a' }; diff --git a/crates/swc/tests/tsc-references/libReferenceNoLibBundle_es5.1.normal.js b/crates/swc/tests/tsc-references/libReferenceNoLibBundle_es5.1.normal.js index 421248fb3bca..2e4debf5d29e 100644 --- a/crates/swc/tests/tsc-references/libReferenceNoLibBundle_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/libReferenceNoLibBundle_es5.1.normal.js @@ -5,6 +5,8 @@ // @outFile: bundle.js // Test that passing noLib disables resolution. // @filename: fakelib.ts +// @filename: file1.ts +/// export var elem = { field: "a" }; diff --git a/crates/swc/tests/tsc-references/libReferenceNoLib_es2015.1.normal.js b/crates/swc/tests/tsc-references/libReferenceNoLib_es2015.1.normal.js index e4002dbcdbdc..6c23ca5d1ad7 100644 --- a/crates/swc/tests/tsc-references/libReferenceNoLib_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/libReferenceNoLib_es2015.1.normal.js @@ -4,6 +4,8 @@ // @declaration: true // Test that passing noLib disables resolution. // @filename: fakelib.ts +// @filename: file1.ts +/// export const elem = { field: 'a' }; diff --git a/crates/swc/tests/tsc-references/libReferenceNoLib_es5.1.normal.js b/crates/swc/tests/tsc-references/libReferenceNoLib_es5.1.normal.js index 3839be3d52b8..be76a43e5372 100644 --- a/crates/swc/tests/tsc-references/libReferenceNoLib_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/libReferenceNoLib_es5.1.normal.js @@ -4,6 +4,8 @@ // @declaration: true // Test that passing noLib disables resolution. // @filename: fakelib.ts +// @filename: file1.ts +/// export var elem = { field: "a" }; diff --git a/crates/swc/tests/tsc-references/library-reference-15_es2015.1.normal.js b/crates/swc/tests/tsc-references/library-reference-15_es2015.1.normal.js index 48cdb34b1996..2334699bf95e 100644 --- a/crates/swc/tests/tsc-references/library-reference-15_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/library-reference-15_es2015.1.normal.js @@ -4,6 +4,7 @@ // @currentDirectory: /a // @typeRoots: types // @filename: /a/types/jquery/index.d.ts +// @filename: /a/types/jquery2/index.d.ts // @filename: /a/b/consumer.ts $.foo(); // should OK $2.foo(); // should error diff --git a/crates/swc/tests/tsc-references/library-reference-15_es5.1.normal.js b/crates/swc/tests/tsc-references/library-reference-15_es5.1.normal.js index 48cdb34b1996..2334699bf95e 100644 --- a/crates/swc/tests/tsc-references/library-reference-15_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/library-reference-15_es5.1.normal.js @@ -4,6 +4,7 @@ // @currentDirectory: /a // @typeRoots: types // @filename: /a/types/jquery/index.d.ts +// @filename: /a/types/jquery2/index.d.ts // @filename: /a/b/consumer.ts $.foo(); // should OK $2.foo(); // should error diff --git a/crates/swc/tests/tsc-references/library-reference-4_es2015.1.normal.js b/crates/swc/tests/tsc-references/library-reference-4_es2015.1.normal.js index 8ae40418cba2..cc64b5647570 100644 --- a/crates/swc/tests/tsc-references/library-reference-4_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/library-reference-4_es2015.1.normal.js @@ -5,6 +5,10 @@ // Secondary references may be duplicated if they agree in content // @filename: /node_modules/foo/index.d.ts /// - // @filename: /src/root.ts - /// - /// +// @filename: /node_modules/foo/node_modules/alpha/index.d.ts +// @filename: /node_modules/bar/index.d.ts +/// +// @filename: /node_modules/bar/node_modules/alpha/index.d.ts +// @filename: /src/root.ts +/// +/// diff --git a/crates/swc/tests/tsc-references/library-reference-4_es5.1.normal.js b/crates/swc/tests/tsc-references/library-reference-4_es5.1.normal.js index 8ae40418cba2..cc64b5647570 100644 --- a/crates/swc/tests/tsc-references/library-reference-4_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/library-reference-4_es5.1.normal.js @@ -5,6 +5,10 @@ // Secondary references may be duplicated if they agree in content // @filename: /node_modules/foo/index.d.ts /// - // @filename: /src/root.ts - /// - /// +// @filename: /node_modules/foo/node_modules/alpha/index.d.ts +// @filename: /node_modules/bar/index.d.ts +/// +// @filename: /node_modules/bar/node_modules/alpha/index.d.ts +// @filename: /src/root.ts +/// +/// diff --git a/crates/swc/tests/tsc-references/library-reference-5_es2015.1.normal.js b/crates/swc/tests/tsc-references/library-reference-5_es2015.1.normal.js index 08313b321d6b..7c0ada462568 100644 --- a/crates/swc/tests/tsc-references/library-reference-5_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/library-reference-5_es2015.1.normal.js @@ -5,6 +5,10 @@ // Secondary references may not be duplicated if they disagree in content // @filename: /node_modules/foo/index.d.ts /// - // @filename: /src/root.ts - /// - /// +// @filename: /node_modules/foo/node_modules/alpha/index.d.ts +// @filename: /node_modules/bar/index.d.ts +/// +// @filename: /node_modules/bar/node_modules/alpha/index.d.ts +// @filename: /src/root.ts +/// +/// diff --git a/crates/swc/tests/tsc-references/library-reference-5_es5.1.normal.js b/crates/swc/tests/tsc-references/library-reference-5_es5.1.normal.js index 08313b321d6b..7c0ada462568 100644 --- a/crates/swc/tests/tsc-references/library-reference-5_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/library-reference-5_es5.1.normal.js @@ -5,6 +5,10 @@ // Secondary references may not be duplicated if they disagree in content // @filename: /node_modules/foo/index.d.ts /// - // @filename: /src/root.ts - /// - /// +// @filename: /node_modules/foo/node_modules/alpha/index.d.ts +// @filename: /node_modules/bar/index.d.ts +/// +// @filename: /node_modules/bar/node_modules/alpha/index.d.ts +// @filename: /src/root.ts +/// +/// diff --git a/crates/swc/tests/tsc-references/library-reference-8_es2015.1.normal.js b/crates/swc/tests/tsc-references/library-reference-8_es2015.1.normal.js index 82f10ed5c12e..1069a32daccd 100644 --- a/crates/swc/tests/tsc-references/library-reference-8_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/library-reference-8_es2015.1.normal.js @@ -5,6 +5,8 @@ // Don't crash in circular library reference situations // @filename: /test/types/alpha/index.d.ts /// +// @filename: /test/types/beta/index.d.ts +/// // @filename: /test/foo.ts /// /// diff --git a/crates/swc/tests/tsc-references/library-reference-8_es5.1.normal.js b/crates/swc/tests/tsc-references/library-reference-8_es5.1.normal.js index 82f10ed5c12e..1069a32daccd 100644 --- a/crates/swc/tests/tsc-references/library-reference-8_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/library-reference-8_es5.1.normal.js @@ -5,6 +5,8 @@ // Don't crash in circular library reference situations // @filename: /test/types/alpha/index.d.ts /// +// @filename: /test/types/beta/index.d.ts +/// // @filename: /test/foo.ts /// /// diff --git a/crates/swc/tests/tsc-references/library-reference-scoped-packages_es2015.1.normal.js b/crates/swc/tests/tsc-references/library-reference-scoped-packages_es2015.1.normal.js index e12a650116e2..3d49fe336dc1 100644 --- a/crates/swc/tests/tsc-references/library-reference-scoped-packages_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/library-reference-scoped-packages_es2015.1.normal.js @@ -2,5 +2,6 @@ // @traceResolution: true // @typeRoots: types // @filename: /node_modules/@types/beep__boop/index.d.ts -export const y = 0; // @filename: /a.ts - /// +export const y = 0; +// @filename: /a.ts +/// diff --git a/crates/swc/tests/tsc-references/library-reference-scoped-packages_es5.1.normal.js b/crates/swc/tests/tsc-references/library-reference-scoped-packages_es5.1.normal.js index ae66f1ac55c0..2cb578fcb4e8 100644 --- a/crates/swc/tests/tsc-references/library-reference-scoped-packages_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/library-reference-scoped-packages_es5.1.normal.js @@ -2,5 +2,6 @@ // @traceResolution: true // @typeRoots: types // @filename: /node_modules/@types/beep__boop/index.d.ts -export var y = 0; // @filename: /a.ts - /// +export var y = 0; +// @filename: /a.ts +/// diff --git a/crates/swc/tests/tsc-references/mergedClassInterface_es2015.1.normal.js b/crates/swc/tests/tsc-references/mergedClassInterface_es2015.1.normal.js index 4ff486aeb222..9ca0c875769c 100644 --- a/crates/swc/tests/tsc-references/mergedClassInterface_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/mergedClassInterface_es2015.1.normal.js @@ -10,3 +10,5 @@ c5.x1; c5.x2; c5.x3; c5.x4; +// @Filename: file2.ts +// @Filename: file3.ts diff --git a/crates/swc/tests/tsc-references/mergedClassInterface_es5.1.normal.js b/crates/swc/tests/tsc-references/mergedClassInterface_es5.1.normal.js index 7857a749b60b..478d7be3348e 100644 --- a/crates/swc/tests/tsc-references/mergedClassInterface_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/mergedClassInterface_es5.1.normal.js @@ -15,3 +15,5 @@ c5.x1; c5.x2; c5.x3; c5.x4; +// @Filename: file2.ts +// @Filename: file3.ts diff --git a/crates/swc/tests/tsc-references/moduleExportAlias2_es2015.2.minified.js b/crates/swc/tests/tsc-references/moduleExportAlias2_es2015.2.minified.js index 889bd5115b5a..3f34f741904c 100644 --- a/crates/swc/tests/tsc-references/moduleExportAlias2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/moduleExportAlias2_es2015.2.minified.js @@ -1,6 +1,5 @@ -function C() { +(exports = module.exports = function() { this.p = 1; -} -(exports = module.exports = C).f = (n)=>n + 1; +}).f = (n)=>n + 1; const C = require("./semver"); C.f(1), new C; diff --git a/crates/swc/tests/tsc-references/moduleExportAlias2_es5.2.minified.js b/crates/swc/tests/tsc-references/moduleExportAlias2_es5.2.minified.js index 5ffddd937ecd..1143daee87c7 100644 --- a/crates/swc/tests/tsc-references/moduleExportAlias2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/moduleExportAlias2_es5.2.minified.js @@ -1,7 +1,6 @@ -function C() { +(exports = module.exports = function() { this.p = 1; -} -(exports = module.exports = C).f = function(n) { +}).f = function(n) { return n + 1; }; var C = require("./semver"); diff --git a/crates/swc/tests/tsc-references/moduleExportAliasImported_es2015.2.minified.js b/crates/swc/tests/tsc-references/moduleExportAliasImported_es2015.2.minified.js index 1af71eca3623..d66d5e40dd5d 100644 --- a/crates/swc/tests/tsc-references/moduleExportAliasImported_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/moduleExportAliasImported_es2015.2.minified.js @@ -1 +1,2 @@ -exports.version = 1, module.exports = function() {}, import('./bug28014'); +exports.version = 1, module.exports = function() {}; +import('./bug28014'); diff --git a/crates/swc/tests/tsc-references/moduleExportAliasImported_es5.2.minified.js b/crates/swc/tests/tsc-references/moduleExportAliasImported_es5.2.minified.js index a55e7012189b..2cb3183d0a48 100644 --- a/crates/swc/tests/tsc-references/moduleExportAliasImported_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/moduleExportAliasImported_es5.2.minified.js @@ -1 +1,2 @@ -exports.version = 1, module.exports = function() {}, import("./bug28014"); +exports.version = 1, module.exports = function() {}; +import("./bug28014"); diff --git a/crates/swc/tests/tsc-references/moduleExportAlias_es2015.1.normal.js b/crates/swc/tests/tsc-references/moduleExportAlias_es2015.1.normal.js index 3bbb36705d46..82c9e75e1f10 100644 --- a/crates/swc/tests/tsc-references/moduleExportAlias_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/moduleExportAlias_es2015.1.normal.js @@ -22,6 +22,7 @@ b.func17; b.func18; b.func19; b.func20; +export { }; // @filename: b.js var exportsAlias = exports; exportsAlias.func1 = function() {}; @@ -60,4 +61,3 @@ module.exports.func18 = function() {}; module.exports = {}; exports.func19 = function() {}; module.exports.func20 = function() {}; -export { }; diff --git a/crates/swc/tests/tsc-references/moduleExportAlias_es2015.2.minified.js b/crates/swc/tests/tsc-references/moduleExportAlias_es2015.2.minified.js index fbc09ac6cf85..dde5beb3141e 100644 --- a/crates/swc/tests/tsc-references/moduleExportAlias_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/moduleExportAlias_es2015.2.minified.js @@ -1,3 +1,4 @@ let b = require("./b.js"); -b.func1, b.func2, b.func3, b.func4, b.func5, b.func6, b.func7, b.func8, b.func9, b.func10, b.func11, b.func12, b.func13, b.func14, b.func15, b.func16, b.func17, b.func18, b.func19, b.func20, exports.func1 = function() {}, exports.func2 = function() {}, module.exports.func3 = function() {}, module.exports.func4 = function() {}, (exports = module.exports).func5 = function() {}, (module.exports = exports).func6 = function() {}, exports.func7 = function() {}, module.exports.func8 = function() {}, (module.exports = exports = {}).func9 = function() {}, (exports = module.exports = {}).func10 = function() {}, (exports = module.exports = {}).func11 = function() {}, module.exports.func12 = function() {}, (exports = module.exports = {}).func11 = function() {}, module.exports.func12 = function() {}, (exports = module.exports = {}).func13 = function() {}, module.exports.func14 = function() {}, (exports = module.exports = {}).func15 = function() {}, module.exports.func16 = function() {}, module.exports = exports = {}, exports.func17 = function() {}, module.exports.func18 = function() {}, module.exports = {}, exports.func19 = function() {}, module.exports.func20 = function() {}; +b.func1, b.func2, b.func3, b.func4, b.func5, b.func6, b.func7, b.func8, b.func9, b.func10, b.func11, b.func12, b.func13, b.func14, b.func15, b.func16, b.func17, b.func18, b.func19, b.func20; export { }; +exports.func1 = function() {}, exports.func2 = function() {}, module.exports.func3 = function() {}, module.exports.func4 = function() {}, (exports = module.exports).func5 = function() {}, (module.exports = exports).func6 = function() {}, exports.func7 = function() {}, module.exports.func8 = function() {}, (module.exports = exports = {}).func9 = function() {}, (exports = module.exports = {}).func10 = function() {}, (exports = module.exports = {}).func11 = function() {}, module.exports.func12 = function() {}, (exports = module.exports = {}).func11 = function() {}, module.exports.func12 = function() {}, (exports = module.exports = {}).func13 = function() {}, module.exports.func14 = function() {}, (exports = module.exports = {}).func15 = function() {}, module.exports.func16 = function() {}, module.exports = exports = {}, exports.func17 = function() {}, module.exports.func18 = function() {}, module.exports = {}, exports.func19 = function() {}, module.exports.func20 = function() {}; diff --git a/crates/swc/tests/tsc-references/moduleExportAlias_es5.1.normal.js b/crates/swc/tests/tsc-references/moduleExportAlias_es5.1.normal.js index 848dbd467fce..e97dd28e02dd 100644 --- a/crates/swc/tests/tsc-references/moduleExportAlias_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/moduleExportAlias_es5.1.normal.js @@ -22,6 +22,7 @@ b.func17; b.func18; b.func19; b.func20; +export { }; // @filename: b.js var exportsAlias = exports; exportsAlias.func1 = function() {}; @@ -60,4 +61,3 @@ module.exports.func18 = function() {}; module.exports = {}; exports.func19 = function() {}; module.exports.func20 = function() {}; -export { }; diff --git a/crates/swc/tests/tsc-references/moduleExportAlias_es5.2.minified.js b/crates/swc/tests/tsc-references/moduleExportAlias_es5.2.minified.js index 254e938cbcf9..5eeaf9682130 100644 --- a/crates/swc/tests/tsc-references/moduleExportAlias_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/moduleExportAlias_es5.2.minified.js @@ -1,3 +1,4 @@ var b = require("./b.js"); -b.func1, b.func2, b.func3, b.func4, b.func5, b.func6, b.func7, b.func8, b.func9, b.func10, b.func11, b.func12, b.func13, b.func14, b.func15, b.func16, b.func17, b.func18, b.func19, b.func20, exports.func1 = function() {}, exports.func2 = function() {}, module.exports.func3 = function() {}, module.exports.func4 = function() {}, (exports = module.exports).func5 = function() {}, (module.exports = exports).func6 = function() {}, exports.func7 = function() {}, module.exports.func8 = function() {}, (module.exports = exports = {}).func9 = function() {}, (exports = module.exports = {}).func10 = function() {}, (exports = module.exports = {}).func11 = function() {}, module.exports.func12 = function() {}, (exports = module.exports = {}).func11 = function() {}, module.exports.func12 = function() {}, (exports = module.exports = {}).func13 = function() {}, module.exports.func14 = function() {}, (exports = module.exports = {}).func15 = function() {}, module.exports.func16 = function() {}, module.exports = exports = {}, exports.func17 = function() {}, module.exports.func18 = function() {}, module.exports = {}, exports.func19 = function() {}, module.exports.func20 = function() {}; +b.func1, b.func2, b.func3, b.func4, b.func5, b.func6, b.func7, b.func8, b.func9, b.func10, b.func11, b.func12, b.func13, b.func14, b.func15, b.func16, b.func17, b.func18, b.func19, b.func20; export { }; +exports.func1 = function() {}, exports.func2 = function() {}, module.exports.func3 = function() {}, module.exports.func4 = function() {}, (exports = module.exports).func5 = function() {}, (module.exports = exports).func6 = function() {}, exports.func7 = function() {}, module.exports.func8 = function() {}, (module.exports = exports = {}).func9 = function() {}, (exports = module.exports = {}).func10 = function() {}, (exports = module.exports = {}).func11 = function() {}, module.exports.func12 = function() {}, (exports = module.exports = {}).func11 = function() {}, module.exports.func12 = function() {}, (exports = module.exports = {}).func13 = function() {}, module.exports.func14 = function() {}, (exports = module.exports = {}).func15 = function() {}, module.exports.func16 = function() {}, module.exports = exports = {}, exports.func17 = function() {}, module.exports.func18 = function() {}, module.exports = {}, exports.func19 = function() {}, module.exports.func20 = function() {}; diff --git a/crates/swc/tests/tsc-references/moduleExportAssignment3_es2015.2.minified.js b/crates/swc/tests/tsc-references/moduleExportAssignment3_es2015.2.minified.js index 687a13c229f9..02aa69fb0490 100644 --- a/crates/swc/tests/tsc-references/moduleExportAssignment3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/moduleExportAssignment3_es2015.2.minified.js @@ -1 +1,2 @@ -module.exports = function() {}, module.exports(), require('./mod')(); +module.exports = function() {}, module.exports(); +require('./mod')(); diff --git a/crates/swc/tests/tsc-references/moduleExportAssignment3_es5.2.minified.js b/crates/swc/tests/tsc-references/moduleExportAssignment3_es5.2.minified.js index 96662cdee420..d59bcc6c7b67 100644 --- a/crates/swc/tests/tsc-references/moduleExportAssignment3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/moduleExportAssignment3_es5.2.minified.js @@ -1 +1,2 @@ -module.exports = function() {}, module.exports(), require("./mod")(); +module.exports = function() {}, module.exports(); +require("./mod")(); diff --git a/crates/swc/tests/tsc-references/moduleExportDuplicateAlias2_es5.2.minified.js b/crates/swc/tests/tsc-references/moduleExportDuplicateAlias2_es5.2.minified.js index bbff9a2a2410..7441ec47a46a 100644 --- a/crates/swc/tests/tsc-references/moduleExportDuplicateAlias2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/moduleExportDuplicateAlias2_es5.2.minified.js @@ -1,2 +1,3 @@ function a() {} -module.exports.apply = void 0, module.exports.apply = a, module.exports.apply = a, module.exports.apply(), (0, require("./moduleExportAliasDuplicateAlias").apply)(); +module.exports.apply = void 0, module.exports.apply = a, module.exports.apply = a, module.exports.apply(); +(0, require("./moduleExportAliasDuplicateAlias").apply)(); diff --git a/crates/swc/tests/tsc-references/moduleExportDuplicateAlias3_es5.2.minified.js b/crates/swc/tests/tsc-references/moduleExportDuplicateAlias3_es5.2.minified.js index def8c2050491..4f26d6fe73ba 100644 --- a/crates/swc/tests/tsc-references/moduleExportDuplicateAlias3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/moduleExportDuplicateAlias3_es5.2.minified.js @@ -1 +1,2 @@ -exports.apply = void 0, exports.apply = void 0, exports.apply = function() {}, exports.apply(), exports.apply = "ok", exports.apply.toUpperCase(), exports.apply = 1, require("./moduleExportAliasDuplicateAlias").apply.toFixed(); +exports.apply = void 0, exports.apply = void 0, exports.apply = function() {}, exports.apply(), exports.apply = "ok", exports.apply.toUpperCase(), exports.apply = 1; +require("./moduleExportAliasDuplicateAlias").apply.toFixed(); diff --git a/crates/swc/tests/tsc-references/moduleExportDuplicateAlias_es5.2.minified.js b/crates/swc/tests/tsc-references/moduleExportDuplicateAlias_es5.2.minified.js index c4ea00dce213..739eacf6d37b 100644 --- a/crates/swc/tests/tsc-references/moduleExportDuplicateAlias_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/moduleExportDuplicateAlias_es5.2.minified.js @@ -1 +1,2 @@ -exports.apply = void 0, exports.apply(), exports.apply = function() {}, exports.apply(), (0, require("./moduleExportAliasDuplicateAlias").apply)(); +exports.apply = void 0, exports.apply(), exports.apply = function() {}, exports.apply(); +(0, require("./moduleExportAliasDuplicateAlias").apply)(); diff --git a/crates/swc/tests/tsc-references/moduleExportsElementAccessAssignment2_es2015.2.minified.js b/crates/swc/tests/tsc-references/moduleExportsElementAccessAssignment2_es2015.2.minified.js new file mode 100644 index 000000000000..acb77b0d868d --- /dev/null +++ b/crates/swc/tests/tsc-references/moduleExportsElementAccessAssignment2_es2015.2.minified.js @@ -0,0 +1 @@ +GlobalThing.x; diff --git a/crates/swc/tests/tsc-references/moduleExportsElementAccessAssignment2_es5.2.minified.js b/crates/swc/tests/tsc-references/moduleExportsElementAccessAssignment2_es5.2.minified.js new file mode 100644 index 000000000000..acb77b0d868d --- /dev/null +++ b/crates/swc/tests/tsc-references/moduleExportsElementAccessAssignment2_es5.2.minified.js @@ -0,0 +1 @@ +GlobalThing.x; diff --git a/crates/swc/tests/tsc-references/moduleResolutionWithExtensions_es2015.1.normal.js b/crates/swc/tests/tsc-references/moduleResolutionWithExtensions_es2015.1.normal.js index 2b938970e375..5b486d582e00 100644 --- a/crates/swc/tests/tsc-references/moduleResolutionWithExtensions_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/moduleResolutionWithExtensions_es2015.1.normal.js @@ -1,4 +1,13 @@ // @traceResolution: true // @Filename: /src/a.ts -export default 0; -export default x; +export default 0; // No extension: '.ts' added +// @Filename: /src/b.ts +export { }; // '.js' extension: stripped and replaced with '.ts' +// @Filename: /src/d.ts +export { }; +// @Filename: /src/jquery.d.ts +export default x; // No extension: '.d.ts' added +// @Filename: /src/jquery_user_1.ts +export { }; // '.js' extension: stripped and replaced with '.d.ts' +// @Filename: /src/jquery_user_1.ts +export { }; diff --git a/crates/swc/tests/tsc-references/moduleResolutionWithExtensions_es2015.2.minified.js b/crates/swc/tests/tsc-references/moduleResolutionWithExtensions_es2015.2.minified.js index 34f8fa27f50d..a809f9a03f58 100644 --- a/crates/swc/tests/tsc-references/moduleResolutionWithExtensions_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/moduleResolutionWithExtensions_es2015.2.minified.js @@ -1,2 +1,6 @@ export default 0; +export { }; +export { }; export default x; +export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/moduleResolutionWithExtensions_es5.1.normal.js b/crates/swc/tests/tsc-references/moduleResolutionWithExtensions_es5.1.normal.js index 2b938970e375..5b486d582e00 100644 --- a/crates/swc/tests/tsc-references/moduleResolutionWithExtensions_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/moduleResolutionWithExtensions_es5.1.normal.js @@ -1,4 +1,13 @@ // @traceResolution: true // @Filename: /src/a.ts -export default 0; -export default x; +export default 0; // No extension: '.ts' added +// @Filename: /src/b.ts +export { }; // '.js' extension: stripped and replaced with '.ts' +// @Filename: /src/d.ts +export { }; +// @Filename: /src/jquery.d.ts +export default x; // No extension: '.d.ts' added +// @Filename: /src/jquery_user_1.ts +export { }; // '.js' extension: stripped and replaced with '.d.ts' +// @Filename: /src/jquery_user_1.ts +export { }; diff --git a/crates/swc/tests/tsc-references/moduleResolutionWithExtensions_es5.2.minified.js b/crates/swc/tests/tsc-references/moduleResolutionWithExtensions_es5.2.minified.js index 34f8fa27f50d..a809f9a03f58 100644 --- a/crates/swc/tests/tsc-references/moduleResolutionWithExtensions_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/moduleResolutionWithExtensions_es5.2.minified.js @@ -1,2 +1,6 @@ export default 0; +export { }; +export { }; export default x; +export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension1_es2015.1.normal.js b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension1_es2015.1.normal.js index eb162ed3bd68..e00db44c4e13 100644 --- a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension1_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension1_es2015.1.normal.js @@ -4,4 +4,6 @@ export function foo() { return ""; } - // should error, ask for extension, no extension suggestion +// @filename: /src/bar.mts +// Extensionless relative path ES import in an ES module +export { }; // should error, ask for extension, no extension suggestion diff --git a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension1_es2015.2.minified.js b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension1_es2015.2.minified.js index 0d096c0f72fe..cf1e0c923c55 100644 --- a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension1_es2015.2.minified.js @@ -1,3 +1,4 @@ export function foo() { return ""; } +export { }; diff --git a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension1_es5.1.normal.js b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension1_es5.1.normal.js index eb162ed3bd68..e00db44c4e13 100644 --- a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension1_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension1_es5.1.normal.js @@ -4,4 +4,6 @@ export function foo() { return ""; } - // should error, ask for extension, no extension suggestion +// @filename: /src/bar.mts +// Extensionless relative path ES import in an ES module +export { }; // should error, ask for extension, no extension suggestion diff --git a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension1_es5.2.minified.js b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension1_es5.2.minified.js index 0d096c0f72fe..cf1e0c923c55 100644 --- a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension1_es5.2.minified.js @@ -1,3 +1,4 @@ export function foo() { return ""; } +export { }; diff --git a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension3_es2015.1.normal.js b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension3_es2015.1.normal.js index d92acd6006b1..4a4cfa69bfde 100644 --- a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension3_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension3_es2015.1.normal.js @@ -5,4 +5,6 @@ export function foo() { return ""; } - // should error, suggest adding ".jsx" +// @filename: /src/bar.mts +// Extensionless relative path ES import in an ES module +export { }; // should error, suggest adding ".jsx" diff --git a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension3_es2015.2.minified.js b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension3_es2015.2.minified.js index 0d096c0f72fe..cf1e0c923c55 100644 --- a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension3_es2015.2.minified.js @@ -1,3 +1,4 @@ export function foo() { return ""; } +export { }; diff --git a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension3_es5.1.normal.js b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension3_es5.1.normal.js index d92acd6006b1..4a4cfa69bfde 100644 --- a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension3_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension3_es5.1.normal.js @@ -5,4 +5,6 @@ export function foo() { return ""; } - // should error, suggest adding ".jsx" +// @filename: /src/bar.mts +// Extensionless relative path ES import in an ES module +export { }; // should error, suggest adding ".jsx" diff --git a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension3_es5.2.minified.js b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension3_es5.2.minified.js index 0d096c0f72fe..cf1e0c923c55 100644 --- a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension3_es5.2.minified.js @@ -1,3 +1,4 @@ export function foo() { return ""; } +export { }; diff --git a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension4_es2015.1.normal.js b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension4_es2015.1.normal.js index 404a4d72ec03..e096de7d970d 100644 --- a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension4_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension4_es2015.1.normal.js @@ -5,4 +5,6 @@ export function foo() { return ""; } - // should error, suggest adding ".js" +// @filename: /src/bar.mts +// Extensionless relative path ES import in an ES module +export { }; // should error, suggest adding ".js" diff --git a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension4_es2015.2.minified.js b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension4_es2015.2.minified.js index 0d096c0f72fe..cf1e0c923c55 100644 --- a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension4_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension4_es2015.2.minified.js @@ -1,3 +1,4 @@ export function foo() { return ""; } +export { }; diff --git a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension4_es5.1.normal.js b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension4_es5.1.normal.js index 404a4d72ec03..e096de7d970d 100644 --- a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension4_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension4_es5.1.normal.js @@ -5,4 +5,6 @@ export function foo() { return ""; } - // should error, suggest adding ".js" +// @filename: /src/bar.mts +// Extensionless relative path ES import in an ES module +export { }; // should error, suggest adding ".js" diff --git a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension4_es5.2.minified.js b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension4_es5.2.minified.js index 0d096c0f72fe..cf1e0c923c55 100644 --- a/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension4_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/moduleResolutionWithoutExtension4_es5.2.minified.js @@ -1,3 +1,4 @@ export function foo() { return ""; } +export { }; diff --git a/crates/swc/tests/tsc-references/moduleScoping_es2015.1.normal.js b/crates/swc/tests/tsc-references/moduleScoping_es2015.1.normal.js index aae5d679621a..383271ff35f0 100644 --- a/crates/swc/tests/tsc-references/moduleScoping_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/moduleScoping_es2015.1.normal.js @@ -19,5 +19,6 @@ var v4 = { a: true, b: NaN }; // Should shadow global v2 in this module +export { }; // @Filename: file5.ts var x = v2; // Should be global v2 of type number again diff --git a/crates/swc/tests/tsc-references/moduleScoping_es2015.2.minified.js b/crates/swc/tests/tsc-references/moduleScoping_es2015.2.minified.js index 85e9581f49ef..8ffdb778a24a 100644 --- a/crates/swc/tests/tsc-references/moduleScoping_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/moduleScoping_es2015.2.minified.js @@ -1,3 +1,5 @@ export var v3 = !0; let file3 = require('./file3'); -file3.v3; +v1, v2, file3.v3; +export { }; +v2; diff --git a/crates/swc/tests/tsc-references/moduleScoping_es5.1.normal.js b/crates/swc/tests/tsc-references/moduleScoping_es5.1.normal.js index f1868e82b2f0..c565d099fb17 100644 --- a/crates/swc/tests/tsc-references/moduleScoping_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/moduleScoping_es5.1.normal.js @@ -21,5 +21,6 @@ var v4 = { a: true, b: NaN }; // Should shadow global v2 in this module +export { }; // @Filename: file5.ts var x = v2; // Should be global v2 of type number again diff --git a/crates/swc/tests/tsc-references/moduleScoping_es5.2.minified.js b/crates/swc/tests/tsc-references/moduleScoping_es5.2.minified.js index ef63cfcd403c..bff9a677da18 100644 --- a/crates/swc/tests/tsc-references/moduleScoping_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/moduleScoping_es5.2.minified.js @@ -1,2 +1,4 @@ export var v3 = !0; -require("./file3").v3; +v1, v2, require("./file3").v3; +export { }; +v2; diff --git a/crates/swc/tests/tsc-references/multipleDefaultExports01_es2015.1.normal.js b/crates/swc/tests/tsc-references/multipleDefaultExports01_es2015.1.normal.js index 79bfe444197b..814552f1f22f 100644 --- a/crates/swc/tests/tsc-references/multipleDefaultExports01_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleDefaultExports01_es2015.1.normal.js @@ -1,11 +1,38 @@ // @module: commonjs // @target: ES5 // @filename: m1.ts -export default class foo { -}; -export default function bar() {}; -var x = 10; -export default x; +//! +//! x the name `default` is exported multiple times +//! ,-[2:1] +//! 2 | ,-> export default class foo { +//! 3 | | +//! 4 | |-> } +//! : `---- previous exported here +//! 5 | +//! 6 | ,-> export default function bar() { +//! 7 | | +//! 8 | |-> } +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique +//! +//! x the name `default` is exported multiple times +//! ,-[6:1] +//! 6 | ,-> export default function bar() { +//! 7 | | +//! 8 | |-> } +//! : `---- previous exported here +//! 9 | +//! 10 | var x = 10; +//! 11 | ,-> export default x; +//! : | ^^^^^^^^|^^^^^^^^ +//! : | `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique // @filename: m2.ts import Entity from "./m1"; Entity(); diff --git a/crates/swc/tests/tsc-references/multipleDefaultExports01_es2015.2.minified.js b/crates/swc/tests/tsc-references/multipleDefaultExports01_es2015.2.minified.js index b11a12f9ca41..e3189a8bfa23 100644 --- a/crates/swc/tests/tsc-references/multipleDefaultExports01_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/multipleDefaultExports01_es2015.2.minified.js @@ -1,6 +1,35 @@ -export default class foo { -}; -export default function bar() {}; -export default 10; +// @filename: m1.ts +//! +//! x the name `default` is exported multiple times +//! ,-[2:1] +//! 2 | ,-> export default class foo { +//! 3 | | +//! 4 | |-> } +//! : `---- previous exported here +//! 5 | +//! 6 | ,-> export default function bar() { +//! 7 | | +//! 8 | |-> } +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique +//! +//! x the name `default` is exported multiple times +//! ,-[6:1] +//! 6 | ,-> export default function bar() { +//! 7 | | +//! 8 | |-> } +//! : `---- previous exported here +//! 9 | +//! 10 | var x = 10; +//! 11 | ,-> export default x; +//! : | ^^^^^^^^|^^^^^^^^ +//! : | `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique import Entity from "./m1"; Entity(); diff --git a/crates/swc/tests/tsc-references/multipleDefaultExports01_es5.1.normal.js b/crates/swc/tests/tsc-references/multipleDefaultExports01_es5.1.normal.js index 76cb2f7f6ef2..814552f1f22f 100644 --- a/crates/swc/tests/tsc-references/multipleDefaultExports01_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleDefaultExports01_es5.1.normal.js @@ -1,15 +1,38 @@ // @module: commonjs // @target: ES5 // @filename: m1.ts -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var foo = function foo() { - "use strict"; - _class_call_check(this, foo); -}; -export { foo as default }; -export default function bar() {}; -var x = 10; -export default x; +//! +//! x the name `default` is exported multiple times +//! ,-[2:1] +//! 2 | ,-> export default class foo { +//! 3 | | +//! 4 | |-> } +//! : `---- previous exported here +//! 5 | +//! 6 | ,-> export default function bar() { +//! 7 | | +//! 8 | |-> } +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique +//! +//! x the name `default` is exported multiple times +//! ,-[6:1] +//! 6 | ,-> export default function bar() { +//! 7 | | +//! 8 | |-> } +//! : `---- previous exported here +//! 9 | +//! 10 | var x = 10; +//! 11 | ,-> export default x; +//! : | ^^^^^^^^|^^^^^^^^ +//! : | `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique // @filename: m2.ts import Entity from "./m1"; Entity(); diff --git a/crates/swc/tests/tsc-references/multipleDefaultExports01_es5.2.minified.js b/crates/swc/tests/tsc-references/multipleDefaultExports01_es5.2.minified.js index 13c4af51414d..e3189a8bfa23 100644 --- a/crates/swc/tests/tsc-references/multipleDefaultExports01_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/multipleDefaultExports01_es5.2.minified.js @@ -1,10 +1,35 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var foo = function() { - "use strict"; - _class_call_check(this, foo); -}; -export default function bar() {}; -export default 10; +// @filename: m1.ts +//! +//! x the name `default` is exported multiple times +//! ,-[2:1] +//! 2 | ,-> export default class foo { +//! 3 | | +//! 4 | |-> } +//! : `---- previous exported here +//! 5 | +//! 6 | ,-> export default function bar() { +//! 7 | | +//! 8 | |-> } +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique +//! +//! x the name `default` is exported multiple times +//! ,-[6:1] +//! 6 | ,-> export default function bar() { +//! 7 | | +//! 8 | |-> } +//! : `---- previous exported here +//! 9 | +//! 10 | var x = 10; +//! 11 | ,-> export default x; +//! : | ^^^^^^^^|^^^^^^^^ +//! : | `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique import Entity from "./m1"; Entity(); -export { foo as default }; diff --git a/crates/swc/tests/tsc-references/multipleDefaultExports02_es2015.1.normal.js b/crates/swc/tests/tsc-references/multipleDefaultExports02_es2015.1.normal.js index e8f6a39a701f..20f57c98e1c2 100644 --- a/crates/swc/tests/tsc-references/multipleDefaultExports02_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleDefaultExports02_es2015.1.normal.js @@ -1,8 +1,22 @@ // @module: commonjs // @target: ES5 // @filename: m1.ts -export default function foo() {}; -export default function bar() {}; +//! +//! x the name `default` is exported multiple times +//! ,-[2:1] +//! 2 | ,-> export default function foo() { +//! 3 | | +//! 4 | |-> } +//! : `---- previous exported here +//! 5 | +//! 6 | ,-> export default function bar() { +//! 7 | | +//! 8 | |-> } +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique // @filename: m2.ts import Entity from "./m1"; Entity(); diff --git a/crates/swc/tests/tsc-references/multipleDefaultExports02_es2015.2.minified.js b/crates/swc/tests/tsc-references/multipleDefaultExports02_es2015.2.minified.js index a08c26e33585..3cf84d5e088e 100644 --- a/crates/swc/tests/tsc-references/multipleDefaultExports02_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/multipleDefaultExports02_es2015.2.minified.js @@ -1,4 +1,19 @@ -export default function foo() {}; -export default function bar() {}; +// @filename: m1.ts +//! +//! x the name `default` is exported multiple times +//! ,-[2:1] +//! 2 | ,-> export default function foo() { +//! 3 | | +//! 4 | |-> } +//! : `---- previous exported here +//! 5 | +//! 6 | ,-> export default function bar() { +//! 7 | | +//! 8 | |-> } +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique import Entity from "./m1"; Entity(); diff --git a/crates/swc/tests/tsc-references/multipleDefaultExports02_es5.1.normal.js b/crates/swc/tests/tsc-references/multipleDefaultExports02_es5.1.normal.js index e8f6a39a701f..20f57c98e1c2 100644 --- a/crates/swc/tests/tsc-references/multipleDefaultExports02_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleDefaultExports02_es5.1.normal.js @@ -1,8 +1,22 @@ // @module: commonjs // @target: ES5 // @filename: m1.ts -export default function foo() {}; -export default function bar() {}; +//! +//! x the name `default` is exported multiple times +//! ,-[2:1] +//! 2 | ,-> export default function foo() { +//! 3 | | +//! 4 | |-> } +//! : `---- previous exported here +//! 5 | +//! 6 | ,-> export default function bar() { +//! 7 | | +//! 8 | |-> } +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique // @filename: m2.ts import Entity from "./m1"; Entity(); diff --git a/crates/swc/tests/tsc-references/multipleDefaultExports02_es5.2.minified.js b/crates/swc/tests/tsc-references/multipleDefaultExports02_es5.2.minified.js index a08c26e33585..3cf84d5e088e 100644 --- a/crates/swc/tests/tsc-references/multipleDefaultExports02_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/multipleDefaultExports02_es5.2.minified.js @@ -1,4 +1,19 @@ -export default function foo() {}; -export default function bar() {}; +// @filename: m1.ts +//! +//! x the name `default` is exported multiple times +//! ,-[2:1] +//! 2 | ,-> export default function foo() { +//! 3 | | +//! 4 | |-> } +//! : `---- previous exported here +//! 5 | +//! 6 | ,-> export default function bar() { +//! 7 | | +//! 8 | |-> } +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique import Entity from "./m1"; Entity(); diff --git a/crates/swc/tests/tsc-references/multipleDefaultExports03_es2015.1.normal.js b/crates/swc/tests/tsc-references/multipleDefaultExports03_es2015.1.normal.js index 618c485e6dff..05dea9f32f62 100644 --- a/crates/swc/tests/tsc-references/multipleDefaultExports03_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleDefaultExports03_es2015.1.normal.js @@ -1,6 +1,14 @@ -// @module: commonjs -// @target: ES5 -export default class C { -}; -export default class C { -}; +//! +//! x the name `default` is exported multiple times +//! ,-[4:1] +//! 4 | ,-> export default class C { +//! 5 | |-> } +//! : `---- previous exported here +//! 6 | +//! 7 | ,-> export default class C { +//! 8 | |-> } +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleDefaultExports03_es2015.2.minified.js b/crates/swc/tests/tsc-references/multipleDefaultExports03_es2015.2.minified.js index 9ebc72efc8f3..05dea9f32f62 100644 --- a/crates/swc/tests/tsc-references/multipleDefaultExports03_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/multipleDefaultExports03_es2015.2.minified.js @@ -1,4 +1,14 @@ -export default class C { -}; -export default class C { -}; +//! +//! x the name `default` is exported multiple times +//! ,-[4:1] +//! 4 | ,-> export default class C { +//! 5 | |-> } +//! : `---- previous exported here +//! 6 | +//! 7 | ,-> export default class C { +//! 8 | |-> } +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleDefaultExports03_es5.1.normal.js b/crates/swc/tests/tsc-references/multipleDefaultExports03_es5.1.normal.js index 88da4eab97c7..05dea9f32f62 100644 --- a/crates/swc/tests/tsc-references/multipleDefaultExports03_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleDefaultExports03_es5.1.normal.js @@ -1,13 +1,14 @@ -// @module: commonjs -// @target: ES5 -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var C = function C() { - "use strict"; - _class_call_check(this, C); -}; -export { C as default }; -var C = function C() { - "use strict"; - _class_call_check(this, C); -}; -export { C as default }; +//! +//! x the name `default` is exported multiple times +//! ,-[4:1] +//! 4 | ,-> export default class C { +//! 5 | |-> } +//! : `---- previous exported here +//! 6 | +//! 7 | ,-> export default class C { +//! 8 | |-> } +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleDefaultExports03_es5.2.minified.js b/crates/swc/tests/tsc-references/multipleDefaultExports03_es5.2.minified.js index 0d191c5f339f..05dea9f32f62 100644 --- a/crates/swc/tests/tsc-references/multipleDefaultExports03_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/multipleDefaultExports03_es5.2.minified.js @@ -1,10 +1,14 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var C = function() { - "use strict"; - _class_call_check(this, C); -}; -var C = function() { - "use strict"; - _class_call_check(this, C); -}; -export { C as default, C as default }; +//! +//! x the name `default` is exported multiple times +//! ,-[4:1] +//! 4 | ,-> export default class C { +//! 5 | |-> } +//! : `---- previous exported here +//! 6 | +//! 7 | ,-> export default class C { +//! 8 | |-> } +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleDefaultExports04_es2015.1.normal.js b/crates/swc/tests/tsc-references/multipleDefaultExports04_es2015.1.normal.js index 1f0c7f71846b..e7e6800ede68 100644 --- a/crates/swc/tests/tsc-references/multipleDefaultExports04_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleDefaultExports04_es2015.1.normal.js @@ -1,4 +1,26 @@ -// @module: commonjs -// @target: ES5 -export default function f() {}; -export default function f() {}; +//! +//! x the name `f` is defined multiple times +//! ,-[4:1] +//! 4 | export default function f() { +//! : | +//! : `-- previous definition of `f` here +//! 5 | } +//! 6 | +//! 7 | export default function f() { +//! : | +//! : `-- `f` redefined here +//! `---- +//! +//! x the name `default` is exported multiple times +//! ,-[4:1] +//! 4 | ,-> export default function f() { +//! 5 | |-> } +//! : `---- previous exported here +//! 6 | +//! 7 | ,-> export default function f() { +//! 8 | |-> } +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleDefaultExports04_es2015.2.minified.js b/crates/swc/tests/tsc-references/multipleDefaultExports04_es2015.2.minified.js index 9ec4772c02ae..e7e6800ede68 100644 --- a/crates/swc/tests/tsc-references/multipleDefaultExports04_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/multipleDefaultExports04_es2015.2.minified.js @@ -1,2 +1,26 @@ -export default function f() {}; -export default function f() {}; +//! +//! x the name `f` is defined multiple times +//! ,-[4:1] +//! 4 | export default function f() { +//! : | +//! : `-- previous definition of `f` here +//! 5 | } +//! 6 | +//! 7 | export default function f() { +//! : | +//! : `-- `f` redefined here +//! `---- +//! +//! x the name `default` is exported multiple times +//! ,-[4:1] +//! 4 | ,-> export default function f() { +//! 5 | |-> } +//! : `---- previous exported here +//! 6 | +//! 7 | ,-> export default function f() { +//! 8 | |-> } +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleDefaultExports04_es5.1.normal.js b/crates/swc/tests/tsc-references/multipleDefaultExports04_es5.1.normal.js index 1f0c7f71846b..e7e6800ede68 100644 --- a/crates/swc/tests/tsc-references/multipleDefaultExports04_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleDefaultExports04_es5.1.normal.js @@ -1,4 +1,26 @@ -// @module: commonjs -// @target: ES5 -export default function f() {}; -export default function f() {}; +//! +//! x the name `f` is defined multiple times +//! ,-[4:1] +//! 4 | export default function f() { +//! : | +//! : `-- previous definition of `f` here +//! 5 | } +//! 6 | +//! 7 | export default function f() { +//! : | +//! : `-- `f` redefined here +//! `---- +//! +//! x the name `default` is exported multiple times +//! ,-[4:1] +//! 4 | ,-> export default function f() { +//! 5 | |-> } +//! : `---- previous exported here +//! 6 | +//! 7 | ,-> export default function f() { +//! 8 | |-> } +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleDefaultExports04_es5.2.minified.js b/crates/swc/tests/tsc-references/multipleDefaultExports04_es5.2.minified.js index 9ec4772c02ae..e7e6800ede68 100644 --- a/crates/swc/tests/tsc-references/multipleDefaultExports04_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/multipleDefaultExports04_es5.2.minified.js @@ -1,2 +1,26 @@ -export default function f() {}; -export default function f() {}; +//! +//! x the name `f` is defined multiple times +//! ,-[4:1] +//! 4 | export default function f() { +//! : | +//! : `-- previous definition of `f` here +//! 5 | } +//! 6 | +//! 7 | export default function f() { +//! : | +//! : `-- `f` redefined here +//! `---- +//! +//! x the name `default` is exported multiple times +//! ,-[4:1] +//! 4 | ,-> export default function f() { +//! 5 | |-> } +//! : `---- previous exported here +//! 6 | +//! 7 | ,-> export default function f() { +//! 8 | |-> } +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleDefaultExports05_es2015.1.normal.js b/crates/swc/tests/tsc-references/multipleDefaultExports05_es2015.1.normal.js index 3202eba2fb79..c8d2de205883 100644 --- a/crates/swc/tests/tsc-references/multipleDefaultExports05_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleDefaultExports05_es2015.1.normal.js @@ -1,8 +1,28 @@ -// @module: commonjs -// @target: ES5 -export default class AA1 { -}; -export default class BB1 { -}; -export default class CC1 { -}; +//! +//! x the name `default` is exported multiple times +//! ,-[4:1] +//! 4 | export default class AA1 {} +//! : ^^^^^^^^^^^^^|^^^^^^^^^^^^^ +//! : `-- previous exported here +//! 5 | +//! 6 | export default class BB1 {} +//! : ^^^^^^^^^^^^^|^^^^^^^^^^^^^ +//! : `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique +//! +//! x the name `default` is exported multiple times +//! ,-[6:1] +//! 6 | export default class BB1 {} +//! : ^^^^^^^^^^^^^|^^^^^^^^^^^^^ +//! : `-- previous exported here +//! 7 | +//! 8 | export default class CC1 {} +//! : ^^^^^^^^^^^^^|^^^^^^^^^^^^^ +//! : `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleDefaultExports05_es2015.2.minified.js b/crates/swc/tests/tsc-references/multipleDefaultExports05_es2015.2.minified.js index 47840ba12789..c8d2de205883 100644 --- a/crates/swc/tests/tsc-references/multipleDefaultExports05_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/multipleDefaultExports05_es2015.2.minified.js @@ -1,6 +1,28 @@ -export default class AA1 { -}; -export default class BB1 { -}; -export default class CC1 { -}; +//! +//! x the name `default` is exported multiple times +//! ,-[4:1] +//! 4 | export default class AA1 {} +//! : ^^^^^^^^^^^^^|^^^^^^^^^^^^^ +//! : `-- previous exported here +//! 5 | +//! 6 | export default class BB1 {} +//! : ^^^^^^^^^^^^^|^^^^^^^^^^^^^ +//! : `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique +//! +//! x the name `default` is exported multiple times +//! ,-[6:1] +//! 6 | export default class BB1 {} +//! : ^^^^^^^^^^^^^|^^^^^^^^^^^^^ +//! : `-- previous exported here +//! 7 | +//! 8 | export default class CC1 {} +//! : ^^^^^^^^^^^^^|^^^^^^^^^^^^^ +//! : `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleDefaultExports05_es5.1.normal.js b/crates/swc/tests/tsc-references/multipleDefaultExports05_es5.1.normal.js index 0a77f5be0aad..c8d2de205883 100644 --- a/crates/swc/tests/tsc-references/multipleDefaultExports05_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleDefaultExports05_es5.1.normal.js @@ -1,18 +1,28 @@ -// @module: commonjs -// @target: ES5 -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var AA1 = function AA1() { - "use strict"; - _class_call_check(this, AA1); -}; -export { AA1 as default }; -var BB1 = function BB1() { - "use strict"; - _class_call_check(this, BB1); -}; -export { BB1 as default }; -var CC1 = function CC1() { - "use strict"; - _class_call_check(this, CC1); -}; -export { CC1 as default }; +//! +//! x the name `default` is exported multiple times +//! ,-[4:1] +//! 4 | export default class AA1 {} +//! : ^^^^^^^^^^^^^|^^^^^^^^^^^^^ +//! : `-- previous exported here +//! 5 | +//! 6 | export default class BB1 {} +//! : ^^^^^^^^^^^^^|^^^^^^^^^^^^^ +//! : `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique +//! +//! x the name `default` is exported multiple times +//! ,-[6:1] +//! 6 | export default class BB1 {} +//! : ^^^^^^^^^^^^^|^^^^^^^^^^^^^ +//! : `-- previous exported here +//! 7 | +//! 8 | export default class CC1 {} +//! : ^^^^^^^^^^^^^|^^^^^^^^^^^^^ +//! : `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleDefaultExports05_es5.2.minified.js b/crates/swc/tests/tsc-references/multipleDefaultExports05_es5.2.minified.js index 1bed29a41a9d..c8d2de205883 100644 --- a/crates/swc/tests/tsc-references/multipleDefaultExports05_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/multipleDefaultExports05_es5.2.minified.js @@ -1,14 +1,28 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var AA1 = function() { - "use strict"; - _class_call_check(this, AA1); -}; -var BB1 = function() { - "use strict"; - _class_call_check(this, BB1); -}; -var CC1 = function() { - "use strict"; - _class_call_check(this, CC1); -}; -export { AA1 as default, BB1 as default, CC1 as default }; +//! +//! x the name `default` is exported multiple times +//! ,-[4:1] +//! 4 | export default class AA1 {} +//! : ^^^^^^^^^^^^^|^^^^^^^^^^^^^ +//! : `-- previous exported here +//! 5 | +//! 6 | export default class BB1 {} +//! : ^^^^^^^^^^^^^|^^^^^^^^^^^^^ +//! : `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique +//! +//! x the name `default` is exported multiple times +//! ,-[6:1] +//! 6 | export default class BB1 {} +//! : ^^^^^^^^^^^^^|^^^^^^^^^^^^^ +//! : `-- previous exported here +//! 7 | +//! 8 | export default class CC1 {} +//! : ^^^^^^^^^^^^^|^^^^^^^^^^^^^ +//! : `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleExportDefault1_es2015.1.normal.js b/crates/swc/tests/tsc-references/multipleExportDefault1_es2015.1.normal.js index ed59f54944ca..7de6cb6ae661 100644 --- a/crates/swc/tests/tsc-references/multipleExportDefault1_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleExportDefault1_es2015.1.normal.js @@ -1,4 +1,16 @@ -export default function Foo() {}; -export default { - uhoh: "another default" -}; +//! +//! x the name `default` is exported multiple times +//! ,-[1:1] +//! 1 | ,-> export default function Foo (){ +//! 2 | | +//! 3 | |-> } +//! : `---- previous exported here +//! 4 | +//! 5 | ,-> export default { +//! 6 | | uhoh: "another default", +//! 7 | |-> }; +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleExportDefault1_es2015.2.minified.js b/crates/swc/tests/tsc-references/multipleExportDefault1_es2015.2.minified.js index ed59f54944ca..7de6cb6ae661 100644 --- a/crates/swc/tests/tsc-references/multipleExportDefault1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/multipleExportDefault1_es2015.2.minified.js @@ -1,4 +1,16 @@ -export default function Foo() {}; -export default { - uhoh: "another default" -}; +//! +//! x the name `default` is exported multiple times +//! ,-[1:1] +//! 1 | ,-> export default function Foo (){ +//! 2 | | +//! 3 | |-> } +//! : `---- previous exported here +//! 4 | +//! 5 | ,-> export default { +//! 6 | | uhoh: "another default", +//! 7 | |-> }; +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleExportDefault1_es5.1.normal.js b/crates/swc/tests/tsc-references/multipleExportDefault1_es5.1.normal.js index ed59f54944ca..7de6cb6ae661 100644 --- a/crates/swc/tests/tsc-references/multipleExportDefault1_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleExportDefault1_es5.1.normal.js @@ -1,4 +1,16 @@ -export default function Foo() {}; -export default { - uhoh: "another default" -}; +//! +//! x the name `default` is exported multiple times +//! ,-[1:1] +//! 1 | ,-> export default function Foo (){ +//! 2 | | +//! 3 | |-> } +//! : `---- previous exported here +//! 4 | +//! 5 | ,-> export default { +//! 6 | | uhoh: "another default", +//! 7 | |-> }; +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleExportDefault1_es5.2.minified.js b/crates/swc/tests/tsc-references/multipleExportDefault1_es5.2.minified.js index ed59f54944ca..7de6cb6ae661 100644 --- a/crates/swc/tests/tsc-references/multipleExportDefault1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/multipleExportDefault1_es5.2.minified.js @@ -1,4 +1,16 @@ -export default function Foo() {}; -export default { - uhoh: "another default" -}; +//! +//! x the name `default` is exported multiple times +//! ,-[1:1] +//! 1 | ,-> export default function Foo (){ +//! 2 | | +//! 3 | |-> } +//! : `---- previous exported here +//! 4 | +//! 5 | ,-> export default { +//! 6 | | uhoh: "another default", +//! 7 | |-> }; +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleExportDefault2_es2015.1.normal.js b/crates/swc/tests/tsc-references/multipleExportDefault2_es2015.1.normal.js index 4233c2c30b12..df0da87a5ee4 100644 --- a/crates/swc/tests/tsc-references/multipleExportDefault2_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleExportDefault2_es2015.1.normal.js @@ -1,4 +1,15 @@ -export default { - uhoh: "another default" -}; -export default function Foo() {}; +//! +//! x the name `default` is exported multiple times +//! ,-[1:1] +//! 1 | ,-> export default { +//! 2 | | uhoh: "another default", +//! 3 | |-> }; +//! : `---- previous exported here +//! 4 | +//! 5 | ,-> export default function Foo() { } +//! : | ^^^^^^^^^^^^^^^^|^^^^^^^^^^^^^^^^ +//! : | `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleExportDefault2_es2015.2.minified.js b/crates/swc/tests/tsc-references/multipleExportDefault2_es2015.2.minified.js index 4233c2c30b12..df0da87a5ee4 100644 --- a/crates/swc/tests/tsc-references/multipleExportDefault2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/multipleExportDefault2_es2015.2.minified.js @@ -1,4 +1,15 @@ -export default { - uhoh: "another default" -}; -export default function Foo() {}; +//! +//! x the name `default` is exported multiple times +//! ,-[1:1] +//! 1 | ,-> export default { +//! 2 | | uhoh: "another default", +//! 3 | |-> }; +//! : `---- previous exported here +//! 4 | +//! 5 | ,-> export default function Foo() { } +//! : | ^^^^^^^^^^^^^^^^|^^^^^^^^^^^^^^^^ +//! : | `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleExportDefault2_es5.1.normal.js b/crates/swc/tests/tsc-references/multipleExportDefault2_es5.1.normal.js index 4233c2c30b12..df0da87a5ee4 100644 --- a/crates/swc/tests/tsc-references/multipleExportDefault2_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleExportDefault2_es5.1.normal.js @@ -1,4 +1,15 @@ -export default { - uhoh: "another default" -}; -export default function Foo() {}; +//! +//! x the name `default` is exported multiple times +//! ,-[1:1] +//! 1 | ,-> export default { +//! 2 | | uhoh: "another default", +//! 3 | |-> }; +//! : `---- previous exported here +//! 4 | +//! 5 | ,-> export default function Foo() { } +//! : | ^^^^^^^^^^^^^^^^|^^^^^^^^^^^^^^^^ +//! : | `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleExportDefault2_es5.2.minified.js b/crates/swc/tests/tsc-references/multipleExportDefault2_es5.2.minified.js index 4233c2c30b12..df0da87a5ee4 100644 --- a/crates/swc/tests/tsc-references/multipleExportDefault2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/multipleExportDefault2_es5.2.minified.js @@ -1,4 +1,15 @@ -export default { - uhoh: "another default" -}; -export default function Foo() {}; +//! +//! x the name `default` is exported multiple times +//! ,-[1:1] +//! 1 | ,-> export default { +//! 2 | | uhoh: "another default", +//! 3 | |-> }; +//! : `---- previous exported here +//! 4 | +//! 5 | ,-> export default function Foo() { } +//! : | ^^^^^^^^^^^^^^^^|^^^^^^^^^^^^^^^^ +//! : | `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleExportDefault3_es2015.1.normal.js b/crates/swc/tests/tsc-references/multipleExportDefault3_es2015.1.normal.js index e854b44be4ea..fac35712318f 100644 --- a/crates/swc/tests/tsc-references/multipleExportDefault3_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleExportDefault3_es2015.1.normal.js @@ -1,5 +1,15 @@ -export default { - uhoh: "another default" -}; -export default class C { -}; +//! +//! x the name `default` is exported multiple times +//! ,-[1:1] +//! 1 | ,-> export default { +//! 2 | | uhoh: "another default", +//! 3 | |-> }; +//! : `---- previous exported here +//! 4 | +//! 5 | ,-> export default class C { } +//! : | ^^^^^^^^^^^^^|^^^^^^^^^^^^ +//! : | `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleExportDefault3_es2015.2.minified.js b/crates/swc/tests/tsc-references/multipleExportDefault3_es2015.2.minified.js index e854b44be4ea..fac35712318f 100644 --- a/crates/swc/tests/tsc-references/multipleExportDefault3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/multipleExportDefault3_es2015.2.minified.js @@ -1,5 +1,15 @@ -export default { - uhoh: "another default" -}; -export default class C { -}; +//! +//! x the name `default` is exported multiple times +//! ,-[1:1] +//! 1 | ,-> export default { +//! 2 | | uhoh: "another default", +//! 3 | |-> }; +//! : `---- previous exported here +//! 4 | +//! 5 | ,-> export default class C { } +//! : | ^^^^^^^^^^^^^|^^^^^^^^^^^^ +//! : | `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleExportDefault3_es5.1.normal.js b/crates/swc/tests/tsc-references/multipleExportDefault3_es5.1.normal.js index 12c21e7adb3c..fac35712318f 100644 --- a/crates/swc/tests/tsc-references/multipleExportDefault3_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleExportDefault3_es5.1.normal.js @@ -1,9 +1,15 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -export default { - uhoh: "another default" -}; -var C = function C() { - "use strict"; - _class_call_check(this, C); -}; -export { C as default }; +//! +//! x the name `default` is exported multiple times +//! ,-[1:1] +//! 1 | ,-> export default { +//! 2 | | uhoh: "another default", +//! 3 | |-> }; +//! : `---- previous exported here +//! 4 | +//! 5 | ,-> export default class C { } +//! : | ^^^^^^^^^^^^^|^^^^^^^^^^^^ +//! : | `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleExportDefault3_es5.2.minified.js b/crates/swc/tests/tsc-references/multipleExportDefault3_es5.2.minified.js index a7bf7315b2f9..fac35712318f 100644 --- a/crates/swc/tests/tsc-references/multipleExportDefault3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/multipleExportDefault3_es5.2.minified.js @@ -1,9 +1,15 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -export default { - uhoh: "another default" -}; -var C = function() { - "use strict"; - _class_call_check(this, C); -}; -export { C as default }; +//! +//! x the name `default` is exported multiple times +//! ,-[1:1] +//! 1 | ,-> export default { +//! 2 | | uhoh: "another default", +//! 3 | |-> }; +//! : `---- previous exported here +//! 4 | +//! 5 | ,-> export default class C { } +//! : | ^^^^^^^^^^^^^|^^^^^^^^^^^^ +//! : | `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleExportDefault4_es2015.1.normal.js b/crates/swc/tests/tsc-references/multipleExportDefault4_es2015.1.normal.js index 1f0c8731ca31..96807eb6a628 100644 --- a/crates/swc/tests/tsc-references/multipleExportDefault4_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleExportDefault4_es2015.1.normal.js @@ -1,5 +1,15 @@ -export default class C { -}; -export default { - uhoh: "another default" -}; +//! +//! x the name `default` is exported multiple times +//! ,-[1:1] +//! 1 | ,-> export default class C { } +//! : | ^^^^^^^^^^^^^|^^^^^^^^^^^^ +//! : | `-- previous exported here +//! 2 | +//! 3 | ,-> export default { +//! 4 | | uhoh: "another default", +//! 5 | |-> }; +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleExportDefault4_es2015.2.minified.js b/crates/swc/tests/tsc-references/multipleExportDefault4_es2015.2.minified.js index 1f0c8731ca31..96807eb6a628 100644 --- a/crates/swc/tests/tsc-references/multipleExportDefault4_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/multipleExportDefault4_es2015.2.minified.js @@ -1,5 +1,15 @@ -export default class C { -}; -export default { - uhoh: "another default" -}; +//! +//! x the name `default` is exported multiple times +//! ,-[1:1] +//! 1 | ,-> export default class C { } +//! : | ^^^^^^^^^^^^^|^^^^^^^^^^^^ +//! : | `-- previous exported here +//! 2 | +//! 3 | ,-> export default { +//! 4 | | uhoh: "another default", +//! 5 | |-> }; +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleExportDefault4_es5.1.normal.js b/crates/swc/tests/tsc-references/multipleExportDefault4_es5.1.normal.js index 9d055b83670b..96807eb6a628 100644 --- a/crates/swc/tests/tsc-references/multipleExportDefault4_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleExportDefault4_es5.1.normal.js @@ -1,9 +1,15 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var C = function C() { - "use strict"; - _class_call_check(this, C); -}; -export { C as default }; -export default { - uhoh: "another default" -}; +//! +//! x the name `default` is exported multiple times +//! ,-[1:1] +//! 1 | ,-> export default class C { } +//! : | ^^^^^^^^^^^^^|^^^^^^^^^^^^ +//! : | `-- previous exported here +//! 2 | +//! 3 | ,-> export default { +//! 4 | | uhoh: "another default", +//! 5 | |-> }; +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleExportDefault4_es5.2.minified.js b/crates/swc/tests/tsc-references/multipleExportDefault4_es5.2.minified.js index adf041c02d8f..96807eb6a628 100644 --- a/crates/swc/tests/tsc-references/multipleExportDefault4_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/multipleExportDefault4_es5.2.minified.js @@ -1,9 +1,15 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var C = function() { - "use strict"; - _class_call_check(this, C); -}; -export default { - uhoh: "another default" -}; -export { C as default }; +//! +//! x the name `default` is exported multiple times +//! ,-[1:1] +//! 1 | ,-> export default class C { } +//! : | ^^^^^^^^^^^^^|^^^^^^^^^^^^ +//! : | `-- previous exported here +//! 2 | +//! 3 | ,-> export default { +//! 4 | | uhoh: "another default", +//! 5 | |-> }; +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleExportDefault5_es2015.1.normal.js b/crates/swc/tests/tsc-references/multipleExportDefault5_es2015.1.normal.js index 0e7967e58ca3..ff36bfdb86d8 100644 --- a/crates/swc/tests/tsc-references/multipleExportDefault5_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleExportDefault5_es2015.1.normal.js @@ -1,3 +1,13 @@ -export default function bar() {}; -export default class C { -}; +//! +//! x the name `default` is exported multiple times +//! ,-[1:1] +//! 1 | export default function bar() { } +//! : ^^^^^^^^^^^^^^^^|^^^^^^^^^^^^^^^^ +//! : `-- previous exported here +//! 2 | export default class C {} +//! : ^^^^^^^^^^^^|^^^^^^^^^^^^ +//! : `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleExportDefault5_es2015.2.minified.js b/crates/swc/tests/tsc-references/multipleExportDefault5_es2015.2.minified.js index 0e7967e58ca3..ff36bfdb86d8 100644 --- a/crates/swc/tests/tsc-references/multipleExportDefault5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/multipleExportDefault5_es2015.2.minified.js @@ -1,3 +1,13 @@ -export default function bar() {}; -export default class C { -}; +//! +//! x the name `default` is exported multiple times +//! ,-[1:1] +//! 1 | export default function bar() { } +//! : ^^^^^^^^^^^^^^^^|^^^^^^^^^^^^^^^^ +//! : `-- previous exported here +//! 2 | export default class C {} +//! : ^^^^^^^^^^^^|^^^^^^^^^^^^ +//! : `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleExportDefault5_es5.1.normal.js b/crates/swc/tests/tsc-references/multipleExportDefault5_es5.1.normal.js index dac80b434125..ff36bfdb86d8 100644 --- a/crates/swc/tests/tsc-references/multipleExportDefault5_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleExportDefault5_es5.1.normal.js @@ -1,7 +1,13 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -export default function bar() {}; -var C = function C() { - "use strict"; - _class_call_check(this, C); -}; -export { C as default }; +//! +//! x the name `default` is exported multiple times +//! ,-[1:1] +//! 1 | export default function bar() { } +//! : ^^^^^^^^^^^^^^^^|^^^^^^^^^^^^^^^^ +//! : `-- previous exported here +//! 2 | export default class C {} +//! : ^^^^^^^^^^^^|^^^^^^^^^^^^ +//! : `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleExportDefault5_es5.2.minified.js b/crates/swc/tests/tsc-references/multipleExportDefault5_es5.2.minified.js index 9e6af4072766..ff36bfdb86d8 100644 --- a/crates/swc/tests/tsc-references/multipleExportDefault5_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/multipleExportDefault5_es5.2.minified.js @@ -1,7 +1,13 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -export default function bar() {}; -var C = function() { - "use strict"; - _class_call_check(this, C); -}; -export { C as default }; +//! +//! x the name `default` is exported multiple times +//! ,-[1:1] +//! 1 | export default function bar() { } +//! : ^^^^^^^^^^^^^^^^|^^^^^^^^^^^^^^^^ +//! : `-- previous exported here +//! 2 | export default class C {} +//! : ^^^^^^^^^^^^|^^^^^^^^^^^^ +//! : `-- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleExportDefault6_es2015.1.normal.js b/crates/swc/tests/tsc-references/multipleExportDefault6_es2015.1.normal.js index 6c3f7191059d..85d28bffb6ff 100644 --- a/crates/swc/tests/tsc-references/multipleExportDefault6_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleExportDefault6_es2015.1.normal.js @@ -1,6 +1,16 @@ -export default { - lol: 1 -}; -export default { - lol: 2 -}; +//! +//! x the name `default` is exported multiple times +//! ,-[1:1] +//! 1 | ,-> export default { +//! 2 | | lol: 1 +//! 3 | |-> } +//! : `---- previous exported here +//! 4 | +//! 5 | ,-> export default { +//! 6 | | lol: 2 +//! 7 | |-> } +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleExportDefault6_es2015.2.minified.js b/crates/swc/tests/tsc-references/multipleExportDefault6_es2015.2.minified.js index 6c3f7191059d..85d28bffb6ff 100644 --- a/crates/swc/tests/tsc-references/multipleExportDefault6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/multipleExportDefault6_es2015.2.minified.js @@ -1,6 +1,16 @@ -export default { - lol: 1 -}; -export default { - lol: 2 -}; +//! +//! x the name `default` is exported multiple times +//! ,-[1:1] +//! 1 | ,-> export default { +//! 2 | | lol: 1 +//! 3 | |-> } +//! : `---- previous exported here +//! 4 | +//! 5 | ,-> export default { +//! 6 | | lol: 2 +//! 7 | |-> } +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleExportDefault6_es5.1.normal.js b/crates/swc/tests/tsc-references/multipleExportDefault6_es5.1.normal.js index 6c3f7191059d..85d28bffb6ff 100644 --- a/crates/swc/tests/tsc-references/multipleExportDefault6_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/multipleExportDefault6_es5.1.normal.js @@ -1,6 +1,16 @@ -export default { - lol: 1 -}; -export default { - lol: 2 -}; +//! +//! x the name `default` is exported multiple times +//! ,-[1:1] +//! 1 | ,-> export default { +//! 2 | | lol: 1 +//! 3 | |-> } +//! : `---- previous exported here +//! 4 | +//! 5 | ,-> export default { +//! 6 | | lol: 2 +//! 7 | |-> } +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/multipleExportDefault6_es5.2.minified.js b/crates/swc/tests/tsc-references/multipleExportDefault6_es5.2.minified.js index 6c3f7191059d..85d28bffb6ff 100644 --- a/crates/swc/tests/tsc-references/multipleExportDefault6_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/multipleExportDefault6_es5.2.minified.js @@ -1,6 +1,16 @@ -export default { - lol: 1 -}; -export default { - lol: 2 -}; +//! +//! x the name `default` is exported multiple times +//! ,-[1:1] +//! 1 | ,-> export default { +//! 2 | | lol: 1 +//! 3 | |-> } +//! : `---- previous exported here +//! 4 | +//! 5 | ,-> export default { +//! 6 | | lol: 2 +//! 7 | |-> } +//! : `---- exported more than once +//! `---- +//! +//!Error: +//! > Exported identifiers must be unique diff --git a/crates/swc/tests/tsc-references/nameDelimitedBySlashes_es2015.1.normal.js b/crates/swc/tests/tsc-references/nameDelimitedBySlashes_es2015.1.normal.js index c5f4f223ca3c..c22094c5bb17 100644 --- a/crates/swc/tests/tsc-references/nameDelimitedBySlashes_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/nameDelimitedBySlashes_es2015.1.normal.js @@ -4,3 +4,4 @@ export var foo = 42; // @Filename: foo_1.ts const foo = require('./test/foo_0'); var x = foo.foo + 42; +export { }; diff --git a/crates/swc/tests/tsc-references/nameDelimitedBySlashes_es2015.2.minified.js b/crates/swc/tests/tsc-references/nameDelimitedBySlashes_es2015.2.minified.js index a81adc6bceb2..dab83210df09 100644 --- a/crates/swc/tests/tsc-references/nameDelimitedBySlashes_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/nameDelimitedBySlashes_es2015.2.minified.js @@ -1,3 +1,4 @@ export var foo = 42; let foo = require('./test/foo_0'); foo.foo; +export { }; diff --git a/crates/swc/tests/tsc-references/nameDelimitedBySlashes_es5.1.normal.js b/crates/swc/tests/tsc-references/nameDelimitedBySlashes_es5.1.normal.js index 45cf41c95d93..ba2c016cd150 100644 --- a/crates/swc/tests/tsc-references/nameDelimitedBySlashes_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/nameDelimitedBySlashes_es5.1.normal.js @@ -4,3 +4,4 @@ export var foo = 42; // @Filename: foo_1.ts var foo = require("./test/foo_0"); var x = foo.foo + 42; +export { }; diff --git a/crates/swc/tests/tsc-references/nameDelimitedBySlashes_es5.2.minified.js b/crates/swc/tests/tsc-references/nameDelimitedBySlashes_es5.2.minified.js index 8d2ae86f83bf..7fa208f47abc 100644 --- a/crates/swc/tests/tsc-references/nameDelimitedBySlashes_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/nameDelimitedBySlashes_es5.2.minified.js @@ -1,3 +1,3 @@ export var foo = 42; -var foo = require("./test/foo_0"); -foo.foo; +require("./test/foo_0").foo; +export { }; diff --git a/crates/swc/tests/tsc-references/nameWithFileExtension_es2015.1.normal.js b/crates/swc/tests/tsc-references/nameWithFileExtension_es2015.1.normal.js index 2f3ee283b731..1ffc0495a05a 100644 --- a/crates/swc/tests/tsc-references/nameWithFileExtension_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/nameWithFileExtension_es2015.1.normal.js @@ -4,3 +4,4 @@ export var foo = 42; // @Filename: foo_1.ts const foo = require('./foo_0.js'); var x = foo.foo + 42; +export { }; diff --git a/crates/swc/tests/tsc-references/nameWithFileExtension_es2015.2.minified.js b/crates/swc/tests/tsc-references/nameWithFileExtension_es2015.2.minified.js index 5ec3acf63389..116965fe1818 100644 --- a/crates/swc/tests/tsc-references/nameWithFileExtension_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/nameWithFileExtension_es2015.2.minified.js @@ -1,3 +1,4 @@ export var foo = 42; let foo = require('./foo_0.js'); foo.foo; +export { }; diff --git a/crates/swc/tests/tsc-references/nameWithFileExtension_es5.1.normal.js b/crates/swc/tests/tsc-references/nameWithFileExtension_es5.1.normal.js index 02fa7b5aec60..008594162d69 100644 --- a/crates/swc/tests/tsc-references/nameWithFileExtension_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/nameWithFileExtension_es5.1.normal.js @@ -4,3 +4,4 @@ export var foo = 42; // @Filename: foo_1.ts var foo = require("./foo_0.js"); var x = foo.foo + 42; +export { }; diff --git a/crates/swc/tests/tsc-references/nameWithFileExtension_es5.2.minified.js b/crates/swc/tests/tsc-references/nameWithFileExtension_es5.2.minified.js index 21c0b55b46b2..17ce25d74b3e 100644 --- a/crates/swc/tests/tsc-references/nameWithFileExtension_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/nameWithFileExtension_es5.2.minified.js @@ -1,3 +1,3 @@ export var foo = 42; -var foo = require("./foo_0.js"); -foo.foo; +require("./foo_0.js").foo; +export { }; diff --git a/crates/swc/tests/tsc-references/nameWithRelativePaths_es2015.1.normal.js b/crates/swc/tests/tsc-references/nameWithRelativePaths_es2015.1.normal.js index ea7e54d6cdb8..60a98d3f2803 100644 --- a/crates/swc/tests/tsc-references/nameWithRelativePaths_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/nameWithRelativePaths_es2015.1.normal.js @@ -17,3 +17,4 @@ const foo2 = require('./.././test/foo_2'); if (foo2.M2.x) { var x = foo0.foo + foo1.f(); } +export { }; diff --git a/crates/swc/tests/tsc-references/nameWithRelativePaths_es2015.2.minified.js b/crates/swc/tests/tsc-references/nameWithRelativePaths_es2015.2.minified.js index afe431539b8f..0051f9645a8b 100644 --- a/crates/swc/tests/tsc-references/nameWithRelativePaths_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/nameWithRelativePaths_es2015.2.minified.js @@ -6,3 +6,4 @@ export var M2; (M2 || (M2 = {})).x = !0; let foo0 = require('../foo_0'), foo1 = require('./test/foo_1'), foo2 = require('./.././test/foo_2'); foo2.M2.x && (foo0.foo, foo1.f()); +export { }; diff --git a/crates/swc/tests/tsc-references/nameWithRelativePaths_es5.1.normal.js b/crates/swc/tests/tsc-references/nameWithRelativePaths_es5.1.normal.js index 1f30ae621377..8f7b0b49899b 100644 --- a/crates/swc/tests/tsc-references/nameWithRelativePaths_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/nameWithRelativePaths_es5.1.normal.js @@ -17,3 +17,4 @@ var foo2 = require("./.././test/foo_2"); if (foo2.M2.x) { var x = foo0.foo + foo1.f(); } +export { }; diff --git a/crates/swc/tests/tsc-references/nameWithRelativePaths_es5.2.minified.js b/crates/swc/tests/tsc-references/nameWithRelativePaths_es5.2.minified.js index e0fe688e9fe5..33827bd4fc94 100644 --- a/crates/swc/tests/tsc-references/nameWithRelativePaths_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/nameWithRelativePaths_es5.2.minified.js @@ -6,3 +6,4 @@ export var M2; (M2 || (M2 = {})).x = !0; var foo0 = require("../foo_0"), foo1 = require("./test/foo_1"), foo2 = require("./.././test/foo_2"); foo2.M2.x && (foo0.foo, foo1.f()); +export { }; diff --git a/crates/swc/tests/tsc-references/namedTupleMembersErrors_es2015.1.normal.js b/crates/swc/tests/tsc-references/namedTupleMembersErrors_es2015.1.normal.js new file mode 100644 index 000000000000..245cf251a430 --- /dev/null +++ b/crates/swc/tests/tsc-references/namedTupleMembersErrors_es2015.1.normal.js @@ -0,0 +1,17 @@ +//! +//! x Only named exports may use 'export type'. +//! ,---- +//! 16 | export type OptTrailing = [first: string, rest: ...string[]?]; // dots+question on element disallowed +//! : ^^^^^^^^^^^ +//! `---- +//! +//! x Expected '{', got 'OptTrailing' +//! ,---- +//! 16 | export type OptTrailing = [first: string, rest: ...string[]?]; // dots+question on element disallowed +//! : ^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/namedTupleMembersErrors_es2015.2.minified.js b/crates/swc/tests/tsc-references/namedTupleMembersErrors_es2015.2.minified.js new file mode 100644 index 000000000000..245cf251a430 --- /dev/null +++ b/crates/swc/tests/tsc-references/namedTupleMembersErrors_es2015.2.minified.js @@ -0,0 +1,17 @@ +//! +//! x Only named exports may use 'export type'. +//! ,---- +//! 16 | export type OptTrailing = [first: string, rest: ...string[]?]; // dots+question on element disallowed +//! : ^^^^^^^^^^^ +//! `---- +//! +//! x Expected '{', got 'OptTrailing' +//! ,---- +//! 16 | export type OptTrailing = [first: string, rest: ...string[]?]; // dots+question on element disallowed +//! : ^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/namedTupleMembersErrors_es5.1.normal.js b/crates/swc/tests/tsc-references/namedTupleMembersErrors_es5.1.normal.js new file mode 100644 index 000000000000..245cf251a430 --- /dev/null +++ b/crates/swc/tests/tsc-references/namedTupleMembersErrors_es5.1.normal.js @@ -0,0 +1,17 @@ +//! +//! x Only named exports may use 'export type'. +//! ,---- +//! 16 | export type OptTrailing = [first: string, rest: ...string[]?]; // dots+question on element disallowed +//! : ^^^^^^^^^^^ +//! `---- +//! +//! x Expected '{', got 'OptTrailing' +//! ,---- +//! 16 | export type OptTrailing = [first: string, rest: ...string[]?]; // dots+question on element disallowed +//! : ^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/namedTupleMembersErrors_es5.2.minified.js b/crates/swc/tests/tsc-references/namedTupleMembersErrors_es5.2.minified.js new file mode 100644 index 000000000000..245cf251a430 --- /dev/null +++ b/crates/swc/tests/tsc-references/namedTupleMembersErrors_es5.2.minified.js @@ -0,0 +1,17 @@ +//! +//! x Only named exports may use 'export type'. +//! ,---- +//! 16 | export type OptTrailing = [first: string, rest: ...string[]?]; // dots+question on element disallowed +//! : ^^^^^^^^^^^ +//! `---- +//! +//! x Expected '{', got 'OptTrailing' +//! ,---- +//! 16 | export type OptTrailing = [first: string, rest: ...string[]?]; // dots+question on element disallowed +//! : ^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/namespaceImportTypeQuery_es2015.1.normal.js b/crates/swc/tests/tsc-references/namespaceImportTypeQuery_es2015.1.normal.js index 188f17388241..a4e71dede5fe 100644 --- a/crates/swc/tests/tsc-references/namespaceImportTypeQuery_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/namespaceImportTypeQuery_es2015.1.normal.js @@ -3,5 +3,7 @@ class A { } export class B { } +// @Filename: /b.ts let A; let B; +export { }; diff --git a/crates/swc/tests/tsc-references/namespaceImportTypeQuery_es2015.2.minified.js b/crates/swc/tests/tsc-references/namespaceImportTypeQuery_es2015.2.minified.js index 94fa3c9c47a3..7706e5964d47 100644 --- a/crates/swc/tests/tsc-references/namespaceImportTypeQuery_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/namespaceImportTypeQuery_es2015.2.minified.js @@ -1,2 +1,3 @@ export class B { } +export { }; diff --git a/crates/swc/tests/tsc-references/namespaceImportTypeQuery_es5.1.normal.js b/crates/swc/tests/tsc-references/namespaceImportTypeQuery_es5.1.normal.js index 1395be8a02f7..50b5998965ba 100644 --- a/crates/swc/tests/tsc-references/namespaceImportTypeQuery_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/namespaceImportTypeQuery_es5.1.normal.js @@ -8,5 +8,7 @@ export var B = function B() { "use strict"; _class_call_check(this, B); }; +// @Filename: /b.ts var A; var B; +export { }; diff --git a/crates/swc/tests/tsc-references/namespaceImportTypeQuery_es5.2.minified.js b/crates/swc/tests/tsc-references/namespaceImportTypeQuery_es5.2.minified.js index 4b246476ca02..99cbffe59865 100644 --- a/crates/swc/tests/tsc-references/namespaceImportTypeQuery_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/namespaceImportTypeQuery_es5.2.minified.js @@ -1,5 +1,5 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var A, B, A = function() { +var A = function() { "use strict"; _class_call_check(this, A); }; @@ -7,3 +7,4 @@ export var B = function() { "use strict"; _class_call_check(this, B); }; +export { }; diff --git a/crates/swc/tests/tsc-references/namespaceMemberAccess_es2015.1.normal.js b/crates/swc/tests/tsc-references/namespaceMemberAccess_es2015.1.normal.js index 20c8c83d554c..3520f15f002e 100644 --- a/crates/swc/tests/tsc-references/namespaceMemberAccess_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/namespaceMemberAccess_es2015.1.normal.js @@ -1,6 +1,7 @@ // @Filename: /a.ts class A { } +export { }; // @Filename: /b.ts import * as types from './a'; types.A; diff --git a/crates/swc/tests/tsc-references/namespaceMemberAccess_es2015.2.minified.js b/crates/swc/tests/tsc-references/namespaceMemberAccess_es2015.2.minified.js index 6174230a39f9..fd8aa71ddb41 100644 --- a/crates/swc/tests/tsc-references/namespaceMemberAccess_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/namespaceMemberAccess_es2015.2.minified.js @@ -1,3 +1,4 @@ +export { }; import * as types from './a'; types.A; let { A } = types; diff --git a/crates/swc/tests/tsc-references/namespaceMemberAccess_es5.1.normal.js b/crates/swc/tests/tsc-references/namespaceMemberAccess_es5.1.normal.js index ba6e4c429163..3bb1fedbd642 100644 --- a/crates/swc/tests/tsc-references/namespaceMemberAccess_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/namespaceMemberAccess_es5.1.normal.js @@ -4,6 +4,7 @@ var A = function A() { "use strict"; _class_call_check(this, A); }; +export { }; // @Filename: /b.ts import * as types from "./a"; types.A; diff --git a/crates/swc/tests/tsc-references/namespaceMemberAccess_es5.2.minified.js b/crates/swc/tests/tsc-references/namespaceMemberAccess_es5.2.minified.js index 3995b1bb5869..7cd5574ffc73 100644 --- a/crates/swc/tests/tsc-references/namespaceMemberAccess_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/namespaceMemberAccess_es5.2.minified.js @@ -4,5 +4,4 @@ var A = function() { _class_call_check(this, A); }; import * as types from "./a"; -types.A; -var A = types.A; +types.A, types.A; diff --git a/crates/swc/tests/tsc-references/nestedDestructuringOfRequire_es2015.2.minified.js b/crates/swc/tests/tsc-references/nestedDestructuringOfRequire_es2015.2.minified.js index 951566ef22c1..3a2c95e66365 100644 --- a/crates/swc/tests/tsc-references/nestedDestructuringOfRequire_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/nestedDestructuringOfRequire_es2015.2.minified.js @@ -2,3 +2,4 @@ module.exports.chalk = { grey: {} }; const { chalk: { grey } } = require('./mod1'); +chalk; diff --git a/crates/swc/tests/tsc-references/nestedDestructuringOfRequire_es5.2.minified.js b/crates/swc/tests/tsc-references/nestedDestructuringOfRequire_es5.2.minified.js index 5292e4905a0b..16f8e972a7c5 100644 --- a/crates/swc/tests/tsc-references/nestedDestructuringOfRequire_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/nestedDestructuringOfRequire_es5.2.minified.js @@ -1,3 +1,4 @@ module.exports.chalk = { grey: {} -}, require("./mod1").chalk.grey; +}; +require("./mod1").chalk.grey, chalk; diff --git a/crates/swc/tests/tsc-references/nestedNamespace_es2015.1.normal.js b/crates/swc/tests/tsc-references/nestedNamespace_es2015.1.normal.js index e38b1e563218..b2999a72c851 100644 --- a/crates/swc/tests/tsc-references/nestedNamespace_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/nestedNamespace_es2015.1.normal.js @@ -5,3 +5,5 @@ export var types; } types.A = A; })(types || (types = {})); +// @Filename: b.ts +export { }; diff --git a/crates/swc/tests/tsc-references/nestedNamespace_es2015.2.minified.js b/crates/swc/tests/tsc-references/nestedNamespace_es2015.2.minified.js index f62073269b35..c0940f942dda 100644 --- a/crates/swc/tests/tsc-references/nestedNamespace_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/nestedNamespace_es2015.2.minified.js @@ -1,3 +1,4 @@ export var types; (types || (types = {})).A = class { }; +export { }; diff --git a/crates/swc/tests/tsc-references/nestedNamespace_es5.1.normal.js b/crates/swc/tests/tsc-references/nestedNamespace_es5.1.normal.js index 7877cdcd1d97..84e17ac2479c 100644 --- a/crates/swc/tests/tsc-references/nestedNamespace_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/nestedNamespace_es5.1.normal.js @@ -8,3 +8,5 @@ export var types; }; types.A = A; })(types || (types = {})); +// @Filename: b.ts +export { }; diff --git a/crates/swc/tests/tsc-references/nestedNamespace_es5.2.minified.js b/crates/swc/tests/tsc-references/nestedNamespace_es5.2.minified.js index 7b431b1d7e40..c7a3ae8c8f77 100644 --- a/crates/swc/tests/tsc-references/nestedNamespace_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/nestedNamespace_es5.2.minified.js @@ -7,3 +7,4 @@ export var types; }; types.A = A; }(types || (types = {})); +export { }; diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperator5_es2015.1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperator5_es2015.1.normal.js new file mode 100644 index 000000000000..8e48fba31b47 --- /dev/null +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperator5_es2015.1.normal.js @@ -0,0 +1,30 @@ +//! +//! x Nullish coalescing operator(??) requires parens when mixing with logical operators +//! ,---- +//! 8 | a ?? b || c; +//! : ^^^^^^^^^^^ +//! `---- +//! +//! x Nullish coalescing operator(??) requires parens when mixing with logical operators +//! ,---- +//! 11 | a || b ?? c; +//! : ^^^^^^ +//! `---- +//! +//! x Nullish coalescing operator(??) requires parens when mixing with logical operators +//! ,---- +//! 14 | a ?? b && c; +//! : ^^^^^^ +//! `---- +//! +//! x Nullish coalescing operator(??) requires parens when mixing with logical operators +//! ,---- +//! 17 | a && b ?? c; +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperator5_es2015.2.minified.js b/crates/swc/tests/tsc-references/nullishCoalescingOperator5_es2015.2.minified.js new file mode 100644 index 000000000000..8e48fba31b47 --- /dev/null +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperator5_es2015.2.minified.js @@ -0,0 +1,30 @@ +//! +//! x Nullish coalescing operator(??) requires parens when mixing with logical operators +//! ,---- +//! 8 | a ?? b || c; +//! : ^^^^^^^^^^^ +//! `---- +//! +//! x Nullish coalescing operator(??) requires parens when mixing with logical operators +//! ,---- +//! 11 | a || b ?? c; +//! : ^^^^^^ +//! `---- +//! +//! x Nullish coalescing operator(??) requires parens when mixing with logical operators +//! ,---- +//! 14 | a ?? b && c; +//! : ^^^^^^ +//! `---- +//! +//! x Nullish coalescing operator(??) requires parens when mixing with logical operators +//! ,---- +//! 17 | a && b ?? c; +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperator5_es5.1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperator5_es5.1.normal.js new file mode 100644 index 000000000000..8e48fba31b47 --- /dev/null +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperator5_es5.1.normal.js @@ -0,0 +1,30 @@ +//! +//! x Nullish coalescing operator(??) requires parens when mixing with logical operators +//! ,---- +//! 8 | a ?? b || c; +//! : ^^^^^^^^^^^ +//! `---- +//! +//! x Nullish coalescing operator(??) requires parens when mixing with logical operators +//! ,---- +//! 11 | a || b ?? c; +//! : ^^^^^^ +//! `---- +//! +//! x Nullish coalescing operator(??) requires parens when mixing with logical operators +//! ,---- +//! 14 | a ?? b && c; +//! : ^^^^^^ +//! `---- +//! +//! x Nullish coalescing operator(??) requires parens when mixing with logical operators +//! ,---- +//! 17 | a && b ?? c; +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperator5_es5.2.minified.js b/crates/swc/tests/tsc-references/nullishCoalescingOperator5_es5.2.minified.js new file mode 100644 index 000000000000..8e48fba31b47 --- /dev/null +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperator5_es5.2.minified.js @@ -0,0 +1,30 @@ +//! +//! x Nullish coalescing operator(??) requires parens when mixing with logical operators +//! ,---- +//! 8 | a ?? b || c; +//! : ^^^^^^^^^^^ +//! `---- +//! +//! x Nullish coalescing operator(??) requires parens when mixing with logical operators +//! ,---- +//! 11 | a || b ?? c; +//! : ^^^^^^ +//! `---- +//! +//! x Nullish coalescing operator(??) requires parens when mixing with logical operators +//! ,---- +//! 14 | a ?? b && c; +//! : ^^^^^^ +//! `---- +//! +//! x Nullish coalescing operator(??) requires parens when mixing with logical operators +//! ,---- +//! 17 | a && b ?? c; +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/objectTypesWithPredefinedTypesAsName_es2015.1.normal.js b/crates/swc/tests/tsc-references/objectTypesWithPredefinedTypesAsName_es2015.1.normal.js new file mode 100644 index 000000000000..84167276ed2f --- /dev/null +++ b/crates/swc/tests/tsc-references/objectTypesWithPredefinedTypesAsName_es2015.1.normal.js @@ -0,0 +1,30 @@ +//! +//! x Invalid class name +//! ,---- +//! 3 | class any { } +//! : ^^^ +//! `---- +//! +//! x Invalid class name +//! ,---- +//! 5 | class number { } +//! : ^^^^^^ +//! `---- +//! +//! x Invalid class name +//! ,---- +//! 7 | class boolean { } +//! : ^^^^^^^ +//! `---- +//! +//! x Invalid class name +//! ,---- +//! 10 | class string { } +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/objectTypesWithPredefinedTypesAsName_es2015.2.minified.js b/crates/swc/tests/tsc-references/objectTypesWithPredefinedTypesAsName_es2015.2.minified.js new file mode 100644 index 000000000000..84167276ed2f --- /dev/null +++ b/crates/swc/tests/tsc-references/objectTypesWithPredefinedTypesAsName_es2015.2.minified.js @@ -0,0 +1,30 @@ +//! +//! x Invalid class name +//! ,---- +//! 3 | class any { } +//! : ^^^ +//! `---- +//! +//! x Invalid class name +//! ,---- +//! 5 | class number { } +//! : ^^^^^^ +//! `---- +//! +//! x Invalid class name +//! ,---- +//! 7 | class boolean { } +//! : ^^^^^^^ +//! `---- +//! +//! x Invalid class name +//! ,---- +//! 10 | class string { } +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/objectTypesWithPredefinedTypesAsName_es5.1.normal.js b/crates/swc/tests/tsc-references/objectTypesWithPredefinedTypesAsName_es5.1.normal.js new file mode 100644 index 000000000000..84167276ed2f --- /dev/null +++ b/crates/swc/tests/tsc-references/objectTypesWithPredefinedTypesAsName_es5.1.normal.js @@ -0,0 +1,30 @@ +//! +//! x Invalid class name +//! ,---- +//! 3 | class any { } +//! : ^^^ +//! `---- +//! +//! x Invalid class name +//! ,---- +//! 5 | class number { } +//! : ^^^^^^ +//! `---- +//! +//! x Invalid class name +//! ,---- +//! 7 | class boolean { } +//! : ^^^^^^^ +//! `---- +//! +//! x Invalid class name +//! ,---- +//! 10 | class string { } +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/objectTypesWithPredefinedTypesAsName_es5.2.minified.js b/crates/swc/tests/tsc-references/objectTypesWithPredefinedTypesAsName_es5.2.minified.js new file mode 100644 index 000000000000..84167276ed2f --- /dev/null +++ b/crates/swc/tests/tsc-references/objectTypesWithPredefinedTypesAsName_es5.2.minified.js @@ -0,0 +1,30 @@ +//! +//! x Invalid class name +//! ,---- +//! 3 | class any { } +//! : ^^^ +//! `---- +//! +//! x Invalid class name +//! ,---- +//! 5 | class number { } +//! : ^^^^^^ +//! `---- +//! +//! x Invalid class name +//! ,---- +//! 7 | class boolean { } +//! : ^^^^^^^ +//! `---- +//! +//! x Invalid class name +//! ,---- +//! 10 | class string { } +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/outFilerootDirModuleNamesAmd_es5.2.minified.js b/crates/swc/tests/tsc-references/outFilerootDirModuleNamesAmd_es5.2.minified.js index fc493f1384e1..4b82ddf37457 100644 --- a/crates/swc/tests/tsc-references/outFilerootDirModuleNamesAmd_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/outFilerootDirModuleNamesAmd_es5.2.minified.js @@ -5,9 +5,9 @@ var Foo = function() { _class_call_check(this, Foo); }; foo(); +export { Foo as default }; import Foo from "./a"; export default function foo() { new Foo(); }; import("./a"); -export { Foo as default }; diff --git a/crates/swc/tests/tsc-references/outFilerootDirModuleNamesSystem_es5.2.minified.js b/crates/swc/tests/tsc-references/outFilerootDirModuleNamesSystem_es5.2.minified.js index fc493f1384e1..4b82ddf37457 100644 --- a/crates/swc/tests/tsc-references/outFilerootDirModuleNamesSystem_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/outFilerootDirModuleNamesSystem_es5.2.minified.js @@ -5,9 +5,9 @@ var Foo = function() { _class_call_check(this, Foo); }; foo(); +export { Foo as default }; import Foo from "./a"; export default function foo() { new Foo(); }; import("./a"); -export { Foo as default }; diff --git a/crates/swc/tests/tsc-references/override1_es2015.1.normal.js b/crates/swc/tests/tsc-references/override1_es2015.1.normal.js new file mode 100644 index 000000000000..22676c85ca57 --- /dev/null +++ b/crates/swc/tests/tsc-references/override1_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x This member cannot have an 'override' modifier because its containing class does not extend another class. +//! ,---- +//! 17 | override foo(v: string) {} +//! : ^^^^^^^^ +//! `---- +//! +//! x This member cannot have an 'override' modifier because its containing class does not extend another class. +//! ,---- +//! 44 | override foo () {} +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/override1_es2015.2.minified.js b/crates/swc/tests/tsc-references/override1_es2015.2.minified.js new file mode 100644 index 000000000000..22676c85ca57 --- /dev/null +++ b/crates/swc/tests/tsc-references/override1_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x This member cannot have an 'override' modifier because its containing class does not extend another class. +//! ,---- +//! 17 | override foo(v: string) {} +//! : ^^^^^^^^ +//! `---- +//! +//! x This member cannot have an 'override' modifier because its containing class does not extend another class. +//! ,---- +//! 44 | override foo () {} +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/override1_es5.1.normal.js b/crates/swc/tests/tsc-references/override1_es5.1.normal.js new file mode 100644 index 000000000000..22676c85ca57 --- /dev/null +++ b/crates/swc/tests/tsc-references/override1_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x This member cannot have an 'override' modifier because its containing class does not extend another class. +//! ,---- +//! 17 | override foo(v: string) {} +//! : ^^^^^^^^ +//! `---- +//! +//! x This member cannot have an 'override' modifier because its containing class does not extend another class. +//! ,---- +//! 44 | override foo () {} +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/override1_es5.2.minified.js b/crates/swc/tests/tsc-references/override1_es5.2.minified.js new file mode 100644 index 000000000000..22676c85ca57 --- /dev/null +++ b/crates/swc/tests/tsc-references/override1_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x This member cannot have an 'override' modifier because its containing class does not extend another class. +//! ,---- +//! 17 | override foo(v: string) {} +//! : ^^^^^^^^ +//! `---- +//! +//! x This member cannot have an 'override' modifier because its containing class does not extend another class. +//! ,---- +//! 44 | override foo () {} +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/overrideWithoutNoImplicitOverride1_es2015.1.normal.js b/crates/swc/tests/tsc-references/overrideWithoutNoImplicitOverride1_es2015.1.normal.js new file mode 100644 index 000000000000..4e02f346a781 --- /dev/null +++ b/crates/swc/tests/tsc-references/overrideWithoutNoImplicitOverride1_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x This member cannot have an 'override' modifier because its containing class does not extend another class. +//! ,---- +//! 4 | override yadda(): void; +//! : ^^^^^^^^ +//! `---- +//! +//! x This member cannot have an 'override' modifier because its containing class does not extend another class. +//! ,---- +//! 8 | override yadda(): void {} +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/overrideWithoutNoImplicitOverride1_es2015.2.minified.js b/crates/swc/tests/tsc-references/overrideWithoutNoImplicitOverride1_es2015.2.minified.js new file mode 100644 index 000000000000..4e02f346a781 --- /dev/null +++ b/crates/swc/tests/tsc-references/overrideWithoutNoImplicitOverride1_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x This member cannot have an 'override' modifier because its containing class does not extend another class. +//! ,---- +//! 4 | override yadda(): void; +//! : ^^^^^^^^ +//! `---- +//! +//! x This member cannot have an 'override' modifier because its containing class does not extend another class. +//! ,---- +//! 8 | override yadda(): void {} +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/overrideWithoutNoImplicitOverride1_es5.1.normal.js b/crates/swc/tests/tsc-references/overrideWithoutNoImplicitOverride1_es5.1.normal.js new file mode 100644 index 000000000000..4e02f346a781 --- /dev/null +++ b/crates/swc/tests/tsc-references/overrideWithoutNoImplicitOverride1_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x This member cannot have an 'override' modifier because its containing class does not extend another class. +//! ,---- +//! 4 | override yadda(): void; +//! : ^^^^^^^^ +//! `---- +//! +//! x This member cannot have an 'override' modifier because its containing class does not extend another class. +//! ,---- +//! 8 | override yadda(): void {} +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/overrideWithoutNoImplicitOverride1_es5.2.minified.js b/crates/swc/tests/tsc-references/overrideWithoutNoImplicitOverride1_es5.2.minified.js new file mode 100644 index 000000000000..4e02f346a781 --- /dev/null +++ b/crates/swc/tests/tsc-references/overrideWithoutNoImplicitOverride1_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x This member cannot have an 'override' modifier because its containing class does not extend another class. +//! ,---- +//! 4 | override yadda(): void; +//! : ^^^^^^^^ +//! `---- +//! +//! x This member cannot have an 'override' modifier because its containing class does not extend another class. +//! ,---- +//! 8 | override yadda(): void {} +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/paramTagTypeResolution_es2015.2.minified.js b/crates/swc/tests/tsc-references/paramTagTypeResolution_es2015.2.minified.js index 47b0a12e29bc..b46ab39aff06 100644 --- a/crates/swc/tests/tsc-references/paramTagTypeResolution_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/paramTagTypeResolution_es2015.2.minified.js @@ -1,3 +1,4 @@ module.exports = function(x, k) { return k(x); -}, require('./first')(1, (n)=>{}); +}; +require('./first')(1, (n)=>{}); diff --git a/crates/swc/tests/tsc-references/paramTagTypeResolution_es5.2.minified.js b/crates/swc/tests/tsc-references/paramTagTypeResolution_es5.2.minified.js index c1053e3d4a60..f808b16dc731 100644 --- a/crates/swc/tests/tsc-references/paramTagTypeResolution_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/paramTagTypeResolution_es5.2.minified.js @@ -1,3 +1,4 @@ module.exports = function(x, k) { return k(x); -}, require("./first")(1, function(n) {}); +}; +require("./first")(1, function(n) {}); diff --git a/crates/swc/tests/tsc-references/parserArrowFunctionExpression1_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserArrowFunctionExpression1_es2015.1.normal.js new file mode 100644 index 000000000000..6ae734ac2cc0 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserArrowFunctionExpression1_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 1 | var v = (public x: string) => { }; +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserArrowFunctionExpression1_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserArrowFunctionExpression1_es2015.2.minified.js new file mode 100644 index 000000000000..6ae734ac2cc0 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserArrowFunctionExpression1_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 1 | var v = (public x: string) => { }; +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserArrowFunctionExpression1_es5.1.normal.js b/crates/swc/tests/tsc-references/parserArrowFunctionExpression1_es5.1.normal.js new file mode 100644 index 000000000000..6ae734ac2cc0 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserArrowFunctionExpression1_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 1 | var v = (public x: string) => { }; +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserArrowFunctionExpression1_es5.2.minified.js b/crates/swc/tests/tsc-references/parserArrowFunctionExpression1_es5.2.minified.js new file mode 100644 index 000000000000..6ae734ac2cc0 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserArrowFunctionExpression1_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 1 | var v = (public x: string) => { }; +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserAssignmentExpression1_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserAssignmentExpression1_es2015.1.normal.js new file mode 100644 index 000000000000..34da6634ef04 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserAssignmentExpression1_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | (foo()) = bar; +//! : ^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserAssignmentExpression1_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserAssignmentExpression1_es2015.2.minified.js new file mode 100644 index 000000000000..34da6634ef04 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserAssignmentExpression1_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | (foo()) = bar; +//! : ^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserAssignmentExpression1_es5.1.normal.js b/crates/swc/tests/tsc-references/parserAssignmentExpression1_es5.1.normal.js new file mode 100644 index 000000000000..34da6634ef04 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserAssignmentExpression1_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | (foo()) = bar; +//! : ^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserAssignmentExpression1_es5.2.minified.js b/crates/swc/tests/tsc-references/parserAssignmentExpression1_es5.2.minified.js new file mode 100644 index 000000000000..34da6634ef04 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserAssignmentExpression1_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | (foo()) = bar; +//! : ^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserClassDeclaration24_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserClassDeclaration24_es2015.1.normal.js new file mode 100644 index 000000000000..9e6a7f9ecc9c --- /dev/null +++ b/crates/swc/tests/tsc-references/parserClassDeclaration24_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x Invalid class name +//! ,---- +//! 1 | class any { +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserClassDeclaration24_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserClassDeclaration24_es2015.2.minified.js new file mode 100644 index 000000000000..9e6a7f9ecc9c --- /dev/null +++ b/crates/swc/tests/tsc-references/parserClassDeclaration24_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x Invalid class name +//! ,---- +//! 1 | class any { +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserClassDeclaration24_es5.1.normal.js b/crates/swc/tests/tsc-references/parserClassDeclaration24_es5.1.normal.js new file mode 100644 index 000000000000..9e6a7f9ecc9c --- /dev/null +++ b/crates/swc/tests/tsc-references/parserClassDeclaration24_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x Invalid class name +//! ,---- +//! 1 | class any { +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserClassDeclaration24_es5.2.minified.js b/crates/swc/tests/tsc-references/parserClassDeclaration24_es5.2.minified.js new file mode 100644 index 000000000000..9e6a7f9ecc9c --- /dev/null +++ b/crates/swc/tests/tsc-references/parserClassDeclaration24_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x Invalid class name +//! ,---- +//! 1 | class any { +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserComputedPropertyName37_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserComputedPropertyName37_es2015.1.normal.js new file mode 100644 index 000000000000..42f73115cd3f --- /dev/null +++ b/crates/swc/tests/tsc-references/parserComputedPropertyName37_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x Unexpected token `public`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, +//! | ` for template literal, (, or an identifier +//! ,---- +//! 3 | [public]: 0 +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserComputedPropertyName37_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserComputedPropertyName37_es2015.2.minified.js new file mode 100644 index 000000000000..42f73115cd3f --- /dev/null +++ b/crates/swc/tests/tsc-references/parserComputedPropertyName37_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x Unexpected token `public`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, +//! | ` for template literal, (, or an identifier +//! ,---- +//! 3 | [public]: 0 +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserComputedPropertyName37_es5.1.normal.js b/crates/swc/tests/tsc-references/parserComputedPropertyName37_es5.1.normal.js new file mode 100644 index 000000000000..42f73115cd3f --- /dev/null +++ b/crates/swc/tests/tsc-references/parserComputedPropertyName37_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x Unexpected token `public`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, +//! | ` for template literal, (, or an identifier +//! ,---- +//! 3 | [public]: 0 +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserComputedPropertyName37_es5.2.minified.js b/crates/swc/tests/tsc-references/parserComputedPropertyName37_es5.2.minified.js new file mode 100644 index 000000000000..42f73115cd3f --- /dev/null +++ b/crates/swc/tests/tsc-references/parserComputedPropertyName37_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x Unexpected token `public`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, +//! | ` for template literal, (, or an identifier +//! ,---- +//! 3 | [public]: 0 +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserES5ForOfStatement5_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserES5ForOfStatement5_es2015.1.normal.js new file mode 100644 index 000000000000..aa3e38d44eb7 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserES5ForOfStatement5_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...of' statement cannot use a type annotation +//! ,---- +//! 2 | for (var a: number of X) { +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserES5ForOfStatement5_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserES5ForOfStatement5_es2015.2.minified.js new file mode 100644 index 000000000000..aa3e38d44eb7 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserES5ForOfStatement5_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...of' statement cannot use a type annotation +//! ,---- +//! 2 | for (var a: number of X) { +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserES5ForOfStatement5_es5.1.normal.js b/crates/swc/tests/tsc-references/parserES5ForOfStatement5_es5.1.normal.js new file mode 100644 index 000000000000..aa3e38d44eb7 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserES5ForOfStatement5_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...of' statement cannot use a type annotation +//! ,---- +//! 2 | for (var a: number of X) { +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserES5ForOfStatement5_es5.2.minified.js b/crates/swc/tests/tsc-references/parserES5ForOfStatement5_es5.2.minified.js new file mode 100644 index 000000000000..aa3e38d44eb7 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserES5ForOfStatement5_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...of' statement cannot use a type annotation +//! ,---- +//! 2 | for (var a: number of X) { +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserEnum7_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserEnum7_es2015.1.normal.js new file mode 100644 index 000000000000..8e790aafcbb3 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserEnum7_es2015.1.normal.js @@ -0,0 +1,24 @@ +//! +//! x An enum member cannot have a numeric name +//! ,---- +//! 2 | 1, 2, 3 +//! : ^ +//! `---- +//! +//! x An enum member cannot have a numeric name +//! ,---- +//! 2 | 1, 2, 3 +//! : ^ +//! `---- +//! +//! x An enum member cannot have a numeric name +//! ,---- +//! 2 | 1, 2, 3 +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserEnum7_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserEnum7_es2015.2.minified.js new file mode 100644 index 000000000000..8e790aafcbb3 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserEnum7_es2015.2.minified.js @@ -0,0 +1,24 @@ +//! +//! x An enum member cannot have a numeric name +//! ,---- +//! 2 | 1, 2, 3 +//! : ^ +//! `---- +//! +//! x An enum member cannot have a numeric name +//! ,---- +//! 2 | 1, 2, 3 +//! : ^ +//! `---- +//! +//! x An enum member cannot have a numeric name +//! ,---- +//! 2 | 1, 2, 3 +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserEnum7_es5.1.normal.js b/crates/swc/tests/tsc-references/parserEnum7_es5.1.normal.js new file mode 100644 index 000000000000..8e790aafcbb3 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserEnum7_es5.1.normal.js @@ -0,0 +1,24 @@ +//! +//! x An enum member cannot have a numeric name +//! ,---- +//! 2 | 1, 2, 3 +//! : ^ +//! `---- +//! +//! x An enum member cannot have a numeric name +//! ,---- +//! 2 | 1, 2, 3 +//! : ^ +//! `---- +//! +//! x An enum member cannot have a numeric name +//! ,---- +//! 2 | 1, 2, 3 +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserEnum7_es5.2.minified.js b/crates/swc/tests/tsc-references/parserEnum7_es5.2.minified.js new file mode 100644 index 000000000000..8e790aafcbb3 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserEnum7_es5.2.minified.js @@ -0,0 +1,24 @@ +//! +//! x An enum member cannot have a numeric name +//! ,---- +//! 2 | 1, 2, 3 +//! : ^ +//! `---- +//! +//! x An enum member cannot have a numeric name +//! ,---- +//! 2 | 1, 2, 3 +//! : ^ +//! `---- +//! +//! x An enum member cannot have a numeric name +//! ,---- +//! 2 | 1, 2, 3 +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForInStatement5_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserForInStatement5_es2015.1.normal.js new file mode 100644 index 000000000000..1341d953b745 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForInStatement5_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...of' statement cannot use a type annotation +//! ,---- +//! 1 | for (var a: number in X) { +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForInStatement5_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserForInStatement5_es2015.2.minified.js new file mode 100644 index 000000000000..1341d953b745 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForInStatement5_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...of' statement cannot use a type annotation +//! ,---- +//! 1 | for (var a: number in X) { +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForInStatement5_es5.1.normal.js b/crates/swc/tests/tsc-references/parserForInStatement5_es5.1.normal.js new file mode 100644 index 000000000000..1341d953b745 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForInStatement5_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...of' statement cannot use a type annotation +//! ,---- +//! 1 | for (var a: number in X) { +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForInStatement5_es5.2.minified.js b/crates/swc/tests/tsc-references/parserForInStatement5_es5.2.minified.js new file mode 100644 index 000000000000..1341d953b745 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForInStatement5_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...of' statement cannot use a type annotation +//! ,---- +//! 1 | for (var a: number in X) { +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForOfStatement23_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserForOfStatement23_es2015.1.normal.js new file mode 100644 index 000000000000..27e4c5c34668 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForOfStatement23_es2015.1.normal.js @@ -0,0 +1,11 @@ +//! +//! x Expected '=>', got 'x' +//! ,---- +//! 5 | for await (async of x) {} +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForOfStatement23_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserForOfStatement23_es2015.2.minified.js new file mode 100644 index 000000000000..27e4c5c34668 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForOfStatement23_es2015.2.minified.js @@ -0,0 +1,11 @@ +//! +//! x Expected '=>', got 'x' +//! ,---- +//! 5 | for await (async of x) {} +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForOfStatement23_es5.1.normal.js b/crates/swc/tests/tsc-references/parserForOfStatement23_es5.1.normal.js new file mode 100644 index 000000000000..27e4c5c34668 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForOfStatement23_es5.1.normal.js @@ -0,0 +1,11 @@ +//! +//! x Expected '=>', got 'x' +//! ,---- +//! 5 | for await (async of x) {} +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForOfStatement23_es5.2.minified.js b/crates/swc/tests/tsc-references/parserForOfStatement23_es5.2.minified.js new file mode 100644 index 000000000000..27e4c5c34668 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForOfStatement23_es5.2.minified.js @@ -0,0 +1,11 @@ +//! +//! x Expected '=>', got 'x' +//! ,---- +//! 5 | for await (async of x) {} +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForOfStatement5_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserForOfStatement5_es2015.1.normal.js new file mode 100644 index 000000000000..aa3e38d44eb7 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForOfStatement5_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...of' statement cannot use a type annotation +//! ,---- +//! 2 | for (var a: number of X) { +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForOfStatement5_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserForOfStatement5_es2015.2.minified.js new file mode 100644 index 000000000000..aa3e38d44eb7 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForOfStatement5_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...of' statement cannot use a type annotation +//! ,---- +//! 2 | for (var a: number of X) { +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForOfStatement5_es5.1.normal.js b/crates/swc/tests/tsc-references/parserForOfStatement5_es5.1.normal.js new file mode 100644 index 000000000000..aa3e38d44eb7 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForOfStatement5_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...of' statement cannot use a type annotation +//! ,---- +//! 2 | for (var a: number of X) { +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForOfStatement5_es5.2.minified.js b/crates/swc/tests/tsc-references/parserForOfStatement5_es5.2.minified.js new file mode 100644 index 000000000000..aa3e38d44eb7 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForOfStatement5_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...of' statement cannot use a type annotation +//! ,---- +//! 2 | for (var a: number of X) { +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForStatement4_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserForStatement4_es2015.1.normal.js new file mode 100644 index 000000000000..df0909a781cc --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForStatement4_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | for (a = 1 in b) { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForStatement4_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserForStatement4_es2015.2.minified.js new file mode 100644 index 000000000000..df0909a781cc --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForStatement4_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | for (a = 1 in b) { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForStatement4_es5.1.normal.js b/crates/swc/tests/tsc-references/parserForStatement4_es5.1.normal.js new file mode 100644 index 000000000000..df0909a781cc --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForStatement4_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | for (a = 1 in b) { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForStatement4_es5.2.minified.js b/crates/swc/tests/tsc-references/parserForStatement4_es5.2.minified.js new file mode 100644 index 000000000000..df0909a781cc --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForStatement4_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | for (a = 1 in b) { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForStatement5_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserForStatement5_es2015.1.normal.js new file mode 100644 index 000000000000..c3b6dd05258e --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForStatement5_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...in' statement cannot be a destructuring pattern +//! ,---- +//! 1 | for ({} in b) { +//! : ^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForStatement5_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserForStatement5_es2015.2.minified.js new file mode 100644 index 000000000000..c3b6dd05258e --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForStatement5_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...in' statement cannot be a destructuring pattern +//! ,---- +//! 1 | for ({} in b) { +//! : ^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForStatement5_es5.1.normal.js b/crates/swc/tests/tsc-references/parserForStatement5_es5.1.normal.js new file mode 100644 index 000000000000..c3b6dd05258e --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForStatement5_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...in' statement cannot be a destructuring pattern +//! ,---- +//! 1 | for ({} in b) { +//! : ^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForStatement5_es5.2.minified.js b/crates/swc/tests/tsc-references/parserForStatement5_es5.2.minified.js new file mode 100644 index 000000000000..c3b6dd05258e --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForStatement5_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of a 'for...in' statement cannot be a destructuring pattern +//! ,---- +//! 1 | for ({} in b) { +//! : ^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForStatement6_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserForStatement6_es2015.1.normal.js new file mode 100644 index 000000000000..ec34285f1817 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForStatement6_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | for (foo() in b) { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForStatement6_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserForStatement6_es2015.2.minified.js new file mode 100644 index 000000000000..ec34285f1817 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForStatement6_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | for (foo() in b) { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForStatement6_es5.1.normal.js b/crates/swc/tests/tsc-references/parserForStatement6_es5.1.normal.js new file mode 100644 index 000000000000..ec34285f1817 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForStatement6_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | for (foo() in b) { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForStatement6_es5.2.minified.js b/crates/swc/tests/tsc-references/parserForStatement6_es5.2.minified.js new file mode 100644 index 000000000000..ec34285f1817 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForStatement6_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | for (foo() in b) { +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForStatement7_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserForStatement7_es2015.1.normal.js new file mode 100644 index 000000000000..0f7046841102 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForStatement7_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | for (new foo() in b) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForStatement7_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserForStatement7_es2015.2.minified.js new file mode 100644 index 000000000000..0f7046841102 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForStatement7_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | for (new foo() in b) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForStatement7_es5.1.normal.js b/crates/swc/tests/tsc-references/parserForStatement7_es5.1.normal.js new file mode 100644 index 000000000000..0f7046841102 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForStatement7_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | for (new foo() in b) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForStatement7_es5.2.minified.js b/crates/swc/tests/tsc-references/parserForStatement7_es5.2.minified.js new file mode 100644 index 000000000000..0f7046841102 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForStatement7_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | for (new foo() in b) { +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForStatement8_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserForStatement8_es2015.1.normal.js new file mode 100644 index 000000000000..876d51f2e2c0 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForStatement8_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | for (this in b) { +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForStatement8_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserForStatement8_es2015.2.minified.js new file mode 100644 index 000000000000..876d51f2e2c0 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForStatement8_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | for (this in b) { +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForStatement8_es5.1.normal.js b/crates/swc/tests/tsc-references/parserForStatement8_es5.1.normal.js new file mode 100644 index 000000000000..876d51f2e2c0 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForStatement8_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | for (this in b) { +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserForStatement8_es5.2.minified.js b/crates/swc/tests/tsc-references/parserForStatement8_es5.2.minified.js new file mode 100644 index 000000000000..876d51f2e2c0 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserForStatement8_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | for (this in b) { +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserInterfaceDeclaration8_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserInterfaceDeclaration8_es2015.1.normal.js new file mode 100644 index 000000000000..a75152f7e8d3 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserInterfaceDeclaration8_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x interface name is invalid +//! ,---- +//! 1 | interface string { +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserInterfaceDeclaration8_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserInterfaceDeclaration8_es2015.2.minified.js new file mode 100644 index 000000000000..a75152f7e8d3 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserInterfaceDeclaration8_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x interface name is invalid +//! ,---- +//! 1 | interface string { +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserInterfaceDeclaration8_es5.1.normal.js b/crates/swc/tests/tsc-references/parserInterfaceDeclaration8_es5.1.normal.js new file mode 100644 index 000000000000..a75152f7e8d3 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserInterfaceDeclaration8_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x interface name is invalid +//! ,---- +//! 1 | interface string { +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserInterfaceDeclaration8_es5.2.minified.js b/crates/swc/tests/tsc-references/parserInterfaceDeclaration8_es5.2.minified.js new file mode 100644 index 000000000000..a75152f7e8d3 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserInterfaceDeclaration8_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x interface name is invalid +//! ,---- +//! 1 | interface string { +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserMemberAccessorDeclaration15_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserMemberAccessorDeclaration15_es2015.1.normal.js new file mode 100644 index 000000000000..9bad4b7db658 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserMemberAccessorDeclaration15_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 3 | set Foo(public a: number) { } +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserMemberAccessorDeclaration15_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserMemberAccessorDeclaration15_es2015.2.minified.js new file mode 100644 index 000000000000..9bad4b7db658 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserMemberAccessorDeclaration15_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 3 | set Foo(public a: number) { } +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserMemberAccessorDeclaration15_es5.1.normal.js b/crates/swc/tests/tsc-references/parserMemberAccessorDeclaration15_es5.1.normal.js new file mode 100644 index 000000000000..9bad4b7db658 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserMemberAccessorDeclaration15_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 3 | set Foo(public a: number) { } +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserMemberAccessorDeclaration15_es5.2.minified.js b/crates/swc/tests/tsc-references/parserMemberAccessorDeclaration15_es5.2.minified.js new file mode 100644 index 000000000000..9bad4b7db658 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserMemberAccessorDeclaration15_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 3 | set Foo(public a: number) { } +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList13_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserParameterList13_es2015.1.normal.js new file mode 100644 index 000000000000..1b611715ec64 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList13_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 2 | new (public x); +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList13_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserParameterList13_es2015.2.minified.js new file mode 100644 index 000000000000..1b611715ec64 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList13_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 2 | new (public x); +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList13_es5.1.normal.js b/crates/swc/tests/tsc-references/parserParameterList13_es5.1.normal.js new file mode 100644 index 000000000000..1b611715ec64 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList13_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 2 | new (public x); +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList13_es5.2.minified.js b/crates/swc/tests/tsc-references/parserParameterList13_es5.2.minified.js new file mode 100644 index 000000000000..1b611715ec64 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList13_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 2 | new (public x); +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList14_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserParameterList14_es2015.1.normal.js new file mode 100644 index 000000000000..cd2413bc5d23 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList14_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 2 | foo(a = 1): void; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList14_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserParameterList14_es2015.2.minified.js new file mode 100644 index 000000000000..cd2413bc5d23 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList14_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 2 | foo(a = 1): void; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList14_es5.1.normal.js b/crates/swc/tests/tsc-references/parserParameterList14_es5.1.normal.js new file mode 100644 index 000000000000..cd2413bc5d23 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList14_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 2 | foo(a = 1): void; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList14_es5.2.minified.js b/crates/swc/tests/tsc-references/parserParameterList14_es5.2.minified.js new file mode 100644 index 000000000000..cd2413bc5d23 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList14_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 2 | foo(a = 1): void; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList15_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserParameterList15_es2015.1.normal.js new file mode 100644 index 000000000000..42723d881773 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList15_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 1 | function foo(a = 4); +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList15_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserParameterList15_es2015.2.minified.js new file mode 100644 index 000000000000..42723d881773 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList15_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 1 | function foo(a = 4); +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList15_es5.1.normal.js b/crates/swc/tests/tsc-references/parserParameterList15_es5.1.normal.js new file mode 100644 index 000000000000..42723d881773 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList15_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 1 | function foo(a = 4); +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList15_es5.2.minified.js b/crates/swc/tests/tsc-references/parserParameterList15_es5.2.minified.js new file mode 100644 index 000000000000..42723d881773 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList15_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 1 | function foo(a = 4); +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList16_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserParameterList16_es2015.1.normal.js new file mode 100644 index 000000000000..8eac4b2a2fe1 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList16_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 2 | foo(a = 4); +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList16_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserParameterList16_es2015.2.minified.js new file mode 100644 index 000000000000..8eac4b2a2fe1 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList16_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 2 | foo(a = 4); +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList16_es5.1.normal.js b/crates/swc/tests/tsc-references/parserParameterList16_es5.1.normal.js new file mode 100644 index 000000000000..8eac4b2a2fe1 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList16_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 2 | foo(a = 4); +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList16_es5.2.minified.js b/crates/swc/tests/tsc-references/parserParameterList16_es5.2.minified.js new file mode 100644 index 000000000000..8eac4b2a2fe1 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList16_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 2 | foo(a = 4); +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList17_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserParameterList17_es2015.1.normal.js new file mode 100644 index 000000000000..2ddd4b02dedb --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList17_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 2 | constructor(a = 4); +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList17_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserParameterList17_es2015.2.minified.js new file mode 100644 index 000000000000..2ddd4b02dedb --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList17_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 2 | constructor(a = 4); +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList17_es5.1.normal.js b/crates/swc/tests/tsc-references/parserParameterList17_es5.1.normal.js new file mode 100644 index 000000000000..2ddd4b02dedb --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList17_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 2 | constructor(a = 4); +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList17_es5.2.minified.js b/crates/swc/tests/tsc-references/parserParameterList17_es5.2.minified.js new file mode 100644 index 000000000000..2ddd4b02dedb --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList17_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x A parameter initializer is only allowed in a function or constructor implementation +//! ,---- +//! 2 | constructor(a = 4); +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList4_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserParameterList4_es2015.1.normal.js new file mode 100644 index 000000000000..2eebf91e4958 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList4_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 1 | function F(public A) { +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList4_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserParameterList4_es2015.2.minified.js new file mode 100644 index 000000000000..2eebf91e4958 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList4_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 1 | function F(public A) { +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList4_es5.1.normal.js b/crates/swc/tests/tsc-references/parserParameterList4_es5.1.normal.js new file mode 100644 index 000000000000..2eebf91e4958 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList4_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 1 | function F(public A) { +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList4_es5.2.minified.js b/crates/swc/tests/tsc-references/parserParameterList4_es5.2.minified.js new file mode 100644 index 000000000000..2eebf91e4958 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList4_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 1 | function F(public A) { +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList5_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserParameterList5_es2015.1.normal.js new file mode 100644 index 000000000000..94b43b342f7f --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList5_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 1 | function A(): (public B) => C { +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList5_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserParameterList5_es2015.2.minified.js new file mode 100644 index 000000000000..94b43b342f7f --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList5_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 1 | function A(): (public B) => C { +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList5_es5.1.normal.js b/crates/swc/tests/tsc-references/parserParameterList5_es5.1.normal.js new file mode 100644 index 000000000000..94b43b342f7f --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList5_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 1 | function A(): (public B) => C { +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList5_es5.2.minified.js b/crates/swc/tests/tsc-references/parserParameterList5_es5.2.minified.js new file mode 100644 index 000000000000..94b43b342f7f --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList5_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 1 | function A(): (public B) => C { +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList6_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserParameterList6_es2015.1.normal.js new file mode 100644 index 000000000000..3d258bf194f0 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList6_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 2 | constructor(C: (public A) => any) { +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList6_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserParameterList6_es2015.2.minified.js new file mode 100644 index 000000000000..3d258bf194f0 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList6_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 2 | constructor(C: (public A) => any) { +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList6_es5.1.normal.js b/crates/swc/tests/tsc-references/parserParameterList6_es5.1.normal.js new file mode 100644 index 000000000000..3d258bf194f0 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList6_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 2 | constructor(C: (public A) => any) { +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList6_es5.2.minified.js b/crates/swc/tests/tsc-references/parserParameterList6_es5.2.minified.js new file mode 100644 index 000000000000..3d258bf194f0 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList6_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 2 | constructor(C: (public A) => any) { +//! : ^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList7_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserParameterList7_es2015.1.normal.js index 2ca2de960ead..0fdd642bface 100644 --- a/crates/swc/tests/tsc-references/parserParameterList7_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/parserParameterList7_es2015.1.normal.js @@ -1,5 +1,18 @@ -class C1 { - constructor(p3){ - this.p3 = p3; - } -} +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 2 | constructor(public p1:string); // ERROR +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 3 | constructor(private p2:number); // ERROR +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList7_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserParameterList7_es2015.2.minified.js new file mode 100644 index 000000000000..0fdd642bface --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList7_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 2 | constructor(public p1:string); // ERROR +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 3 | constructor(private p2:number); // ERROR +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList7_es5.1.normal.js b/crates/swc/tests/tsc-references/parserParameterList7_es5.1.normal.js index 8c0848aa0d7e..0fdd642bface 100644 --- a/crates/swc/tests/tsc-references/parserParameterList7_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/parserParameterList7_es5.1.normal.js @@ -1,6 +1,18 @@ -import * as swcHelpers from "@swc/helpers"; -var C1 = function C1(p3) { - "use strict"; - swcHelpers.classCallCheck(this, C1); - this.p3 = p3; -}; +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 2 | constructor(public p1:string); // ERROR +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 3 | constructor(private p2:number); // ERROR +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList7_es5.2.minified.js b/crates/swc/tests/tsc-references/parserParameterList7_es5.2.minified.js index fecabe0610a9..0fdd642bface 100644 --- a/crates/swc/tests/tsc-references/parserParameterList7_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/parserParameterList7_es5.2.minified.js @@ -1,5 +1,18 @@ -import * as swcHelpers from "@swc/helpers"; -var C1 = function(p3) { - "use strict"; - swcHelpers.classCallCheck(this, C1), this.p3 = p3; -}; +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 2 | constructor(public p1:string); // ERROR +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 3 | constructor(private p2:number); // ERROR +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList8_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserParameterList8_es2015.1.normal.js new file mode 100644 index 000000000000..c0d2b96e7413 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList8_es2015.1.normal.js @@ -0,0 +1,24 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 2 | constructor(public p1:string); // ERROR +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 3 | constructor(private p2:number); // ERROR +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 4 | constructor(public p3:any); // ERROR +//! : ^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList8_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserParameterList8_es2015.2.minified.js new file mode 100644 index 000000000000..c0d2b96e7413 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList8_es2015.2.minified.js @@ -0,0 +1,24 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 2 | constructor(public p1:string); // ERROR +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 3 | constructor(private p2:number); // ERROR +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 4 | constructor(public p3:any); // ERROR +//! : ^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList8_es5.1.normal.js b/crates/swc/tests/tsc-references/parserParameterList8_es5.1.normal.js new file mode 100644 index 000000000000..c0d2b96e7413 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList8_es5.1.normal.js @@ -0,0 +1,24 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 2 | constructor(public p1:string); // ERROR +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 3 | constructor(private p2:number); // ERROR +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 4 | constructor(public p3:any); // ERROR +//! : ^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserParameterList8_es5.2.minified.js b/crates/swc/tests/tsc-references/parserParameterList8_es5.2.minified.js new file mode 100644 index 000000000000..c0d2b96e7413 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserParameterList8_es5.2.minified.js @@ -0,0 +1,24 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 2 | constructor(public p1:string); // ERROR +//! : ^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 3 | constructor(private p2:number); // ERROR +//! : ^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 4 | constructor(public p3:any); // ERROR +//! : ^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity3_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity3_es2015.1.normal.js index ae718d5ab6b1..10e02f3d93e0 100644 --- a/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity3_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity3_es2015.1.normal.js @@ -1 +1,12 @@ -if (1) /regexp/a.foo(); +//! +//! x Unknown regular expression flags. +//! ,---- +//! 1 | if (1) /regexp/a.foo(); +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity3_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity3_es2015.2.minified.js index 264af008dbb6..10e02f3d93e0 100644 --- a/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity3_es2015.2.minified.js @@ -1 +1,12 @@ -/regexp/a.foo(); +//! +//! x Unknown regular expression flags. +//! ,---- +//! 1 | if (1) /regexp/a.foo(); +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity3_es5.1.normal.js b/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity3_es5.1.normal.js index ae718d5ab6b1..10e02f3d93e0 100644 --- a/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity3_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity3_es5.1.normal.js @@ -1 +1,12 @@ -if (1) /regexp/a.foo(); +//! +//! x Unknown regular expression flags. +//! ,---- +//! 1 | if (1) /regexp/a.foo(); +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity3_es5.2.minified.js b/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity3_es5.2.minified.js index 264af008dbb6..10e02f3d93e0 100644 --- a/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity3_es5.2.minified.js @@ -1 +1,12 @@ -/regexp/a.foo(); +//! +//! x Unknown regular expression flags. +//! ,---- +//! 1 | if (1) /regexp/a.foo(); +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserStrictMode16_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserStrictMode16_es2015.1.normal.js new file mode 100644 index 000000000000..e45c3697f962 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserStrictMode16_es2015.1.normal.js @@ -0,0 +1,30 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 2 | delete this; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 3 | delete 1; +//! : ^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 4 | delete null; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 5 | delete "a"; +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserStrictMode16_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserStrictMode16_es2015.2.minified.js new file mode 100644 index 000000000000..e45c3697f962 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserStrictMode16_es2015.2.minified.js @@ -0,0 +1,30 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 2 | delete this; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 3 | delete 1; +//! : ^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 4 | delete null; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 5 | delete "a"; +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserStrictMode16_es5.1.normal.js b/crates/swc/tests/tsc-references/parserStrictMode16_es5.1.normal.js new file mode 100644 index 000000000000..e45c3697f962 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserStrictMode16_es5.1.normal.js @@ -0,0 +1,30 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 2 | delete this; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 3 | delete 1; +//! : ^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 4 | delete null; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 5 | delete "a"; +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserStrictMode16_es5.2.minified.js b/crates/swc/tests/tsc-references/parserStrictMode16_es5.2.minified.js new file mode 100644 index 000000000000..e45c3697f962 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserStrictMode16_es5.2.minified.js @@ -0,0 +1,30 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 2 | delete this; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 3 | delete 1; +//! : ^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 4 | delete null; +//! : ^^^^ +//! `---- +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 5 | delete "a"; +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserStrictMode1_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserStrictMode1_es2015.1.normal.js new file mode 100644 index 000000000000..26268a36e3fb --- /dev/null +++ b/crates/swc/tests/tsc-references/parserStrictMode1_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 4 | static(); +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserStrictMode1_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserStrictMode1_es2015.2.minified.js new file mode 100644 index 000000000000..26268a36e3fb --- /dev/null +++ b/crates/swc/tests/tsc-references/parserStrictMode1_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 4 | static(); +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserStrictMode1_es5.1.normal.js b/crates/swc/tests/tsc-references/parserStrictMode1_es5.1.normal.js new file mode 100644 index 000000000000..26268a36e3fb --- /dev/null +++ b/crates/swc/tests/tsc-references/parserStrictMode1_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 4 | static(); +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserStrictMode1_es5.2.minified.js b/crates/swc/tests/tsc-references/parserStrictMode1_es5.2.minified.js new file mode 100644 index 000000000000..26268a36e3fb --- /dev/null +++ b/crates/swc/tests/tsc-references/parserStrictMode1_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', or 'yield' cannot be used as an identifier in strict mode +//! ,---- +//! 4 | static(); +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserStrictMode3-negative_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserStrictMode3-negative_es2015.1.normal.js new file mode 100644 index 000000000000..675ea99f0609 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserStrictMode3-negative_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | eval = 1; +//! : ^^^^ +//! `---- +//! +//! x Invalid use of 'arguments' in strict mode +//! ,---- +//! 1 | eval = 1; +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserStrictMode3-negative_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserStrictMode3-negative_es2015.2.minified.js new file mode 100644 index 000000000000..675ea99f0609 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserStrictMode3-negative_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | eval = 1; +//! : ^^^^ +//! `---- +//! +//! x Invalid use of 'arguments' in strict mode +//! ,---- +//! 1 | eval = 1; +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserStrictMode3-negative_es5.1.normal.js b/crates/swc/tests/tsc-references/parserStrictMode3-negative_es5.1.normal.js new file mode 100644 index 000000000000..675ea99f0609 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserStrictMode3-negative_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | eval = 1; +//! : ^^^^ +//! `---- +//! +//! x Invalid use of 'arguments' in strict mode +//! ,---- +//! 1 | eval = 1; +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserStrictMode3-negative_es5.2.minified.js b/crates/swc/tests/tsc-references/parserStrictMode3-negative_es5.2.minified.js new file mode 100644 index 000000000000..675ea99f0609 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserStrictMode3-negative_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | eval = 1; +//! : ^^^^ +//! `---- +//! +//! x Invalid use of 'arguments' in strict mode +//! ,---- +//! 1 | eval = 1; +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserStrictMode6-negative_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserStrictMode6-negative_es2015.1.normal.js new file mode 100644 index 000000000000..d02aa67f19b2 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserStrictMode6-negative_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | eval++; +//! : ^^^^ +//! `---- +//! +//! x Invalid use of 'arguments' in strict mode +//! ,---- +//! 1 | eval++; +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserStrictMode6-negative_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserStrictMode6-negative_es2015.2.minified.js new file mode 100644 index 000000000000..d02aa67f19b2 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserStrictMode6-negative_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | eval++; +//! : ^^^^ +//! `---- +//! +//! x Invalid use of 'arguments' in strict mode +//! ,---- +//! 1 | eval++; +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserStrictMode6-negative_es5.1.normal.js b/crates/swc/tests/tsc-references/parserStrictMode6-negative_es5.1.normal.js new file mode 100644 index 000000000000..d02aa67f19b2 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserStrictMode6-negative_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | eval++; +//! : ^^^^ +//! `---- +//! +//! x Invalid use of 'arguments' in strict mode +//! ,---- +//! 1 | eval++; +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserStrictMode6-negative_es5.2.minified.js b/crates/swc/tests/tsc-references/parserStrictMode6-negative_es5.2.minified.js new file mode 100644 index 000000000000..d02aa67f19b2 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserStrictMode6-negative_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | eval++; +//! : ^^^^ +//! `---- +//! +//! x Invalid use of 'arguments' in strict mode +//! ,---- +//! 1 | eval++; +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserSuperExpression2_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserSuperExpression2_es2015.1.normal.js new file mode 100644 index 000000000000..5d81b5c74f07 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserSuperExpression2_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x Expression expected +//! ,---- +//! 3 | super(0); +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserSuperExpression2_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserSuperExpression2_es2015.2.minified.js new file mode 100644 index 000000000000..5d81b5c74f07 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserSuperExpression2_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x Expression expected +//! ,---- +//! 3 | super(0); +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserSuperExpression2_es5.1.normal.js b/crates/swc/tests/tsc-references/parserSuperExpression2_es5.1.normal.js new file mode 100644 index 000000000000..5d81b5c74f07 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserSuperExpression2_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x Expression expected +//! ,---- +//! 3 | super(0); +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserSuperExpression2_es5.2.minified.js b/crates/swc/tests/tsc-references/parserSuperExpression2_es5.2.minified.js new file mode 100644 index 000000000000..5d81b5c74f07 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserSuperExpression2_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x Expression expected +//! ,---- +//! 3 | super(0); +//! : ^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserUnaryExpression1_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserUnaryExpression1_es2015.1.normal.js new file mode 100644 index 000000000000..7b9a69f1386c --- /dev/null +++ b/crates/swc/tests/tsc-references/parserUnaryExpression1_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | ++this; +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserUnaryExpression1_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserUnaryExpression1_es2015.2.minified.js new file mode 100644 index 000000000000..7b9a69f1386c --- /dev/null +++ b/crates/swc/tests/tsc-references/parserUnaryExpression1_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | ++this; +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserUnaryExpression1_es5.1.normal.js b/crates/swc/tests/tsc-references/parserUnaryExpression1_es5.1.normal.js new file mode 100644 index 000000000000..7b9a69f1386c --- /dev/null +++ b/crates/swc/tests/tsc-references/parserUnaryExpression1_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | ++this; +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserUnaryExpression1_es5.2.minified.js b/crates/swc/tests/tsc-references/parserUnaryExpression1_es5.2.minified.js new file mode 100644 index 000000000000..7b9a69f1386c --- /dev/null +++ b/crates/swc/tests/tsc-references/parserUnaryExpression1_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | ++this; +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserUnaryExpression2_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserUnaryExpression2_es2015.1.normal.js new file mode 100644 index 000000000000..21b06af2315e --- /dev/null +++ b/crates/swc/tests/tsc-references/parserUnaryExpression2_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | ++function(e) { } +//! : ^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserUnaryExpression2_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserUnaryExpression2_es2015.2.minified.js new file mode 100644 index 000000000000..21b06af2315e --- /dev/null +++ b/crates/swc/tests/tsc-references/parserUnaryExpression2_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | ++function(e) { } +//! : ^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserUnaryExpression2_es5.1.normal.js b/crates/swc/tests/tsc-references/parserUnaryExpression2_es5.1.normal.js new file mode 100644 index 000000000000..21b06af2315e --- /dev/null +++ b/crates/swc/tests/tsc-references/parserUnaryExpression2_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | ++function(e) { } +//! : ^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserUnaryExpression2_es5.2.minified.js b/crates/swc/tests/tsc-references/parserUnaryExpression2_es5.2.minified.js new file mode 100644 index 000000000000..21b06af2315e --- /dev/null +++ b/crates/swc/tests/tsc-references/parserUnaryExpression2_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | ++function(e) { } +//! : ^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserUnaryExpression3_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserUnaryExpression3_es2015.1.normal.js new file mode 100644 index 000000000000..ca475bdf3277 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserUnaryExpression3_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | ++[0]; +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserUnaryExpression3_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserUnaryExpression3_es2015.2.minified.js new file mode 100644 index 000000000000..ca475bdf3277 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserUnaryExpression3_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | ++[0]; +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserUnaryExpression3_es5.1.normal.js b/crates/swc/tests/tsc-references/parserUnaryExpression3_es5.1.normal.js new file mode 100644 index 000000000000..ca475bdf3277 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserUnaryExpression3_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | ++[0]; +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserUnaryExpression3_es5.2.minified.js b/crates/swc/tests/tsc-references/parserUnaryExpression3_es5.2.minified.js new file mode 100644 index 000000000000..ca475bdf3277 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserUnaryExpression3_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | ++[0]; +//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserUnaryExpression4_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserUnaryExpression4_es2015.1.normal.js new file mode 100644 index 000000000000..34ce0f4aa7e1 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserUnaryExpression4_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | ++{}; +//! : ^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserUnaryExpression4_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserUnaryExpression4_es2015.2.minified.js new file mode 100644 index 000000000000..34ce0f4aa7e1 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserUnaryExpression4_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | ++{}; +//! : ^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserUnaryExpression4_es5.1.normal.js b/crates/swc/tests/tsc-references/parserUnaryExpression4_es5.1.normal.js new file mode 100644 index 000000000000..34ce0f4aa7e1 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserUnaryExpression4_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | ++{}; +//! : ^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserUnaryExpression4_es5.2.minified.js b/crates/swc/tests/tsc-references/parserUnaryExpression4_es5.2.minified.js new file mode 100644 index 000000000000..34ce0f4aa7e1 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserUnaryExpression4_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | ++{}; +//! : ^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserUnaryExpression7_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserUnaryExpression7_es2015.1.normal.js new file mode 100644 index 000000000000..b1a75c70ab95 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserUnaryExpression7_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | ++ new Foo(); +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserUnaryExpression7_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserUnaryExpression7_es2015.2.minified.js new file mode 100644 index 000000000000..b1a75c70ab95 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserUnaryExpression7_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | ++ new Foo(); +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserUnaryExpression7_es5.1.normal.js b/crates/swc/tests/tsc-references/parserUnaryExpression7_es5.1.normal.js new file mode 100644 index 000000000000..b1a75c70ab95 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserUnaryExpression7_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | ++ new Foo(); +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserUnaryExpression7_es5.2.minified.js b/crates/swc/tests/tsc-references/parserUnaryExpression7_es5.2.minified.js new file mode 100644 index 000000000000..b1a75c70ab95 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserUnaryExpression7_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The left-hand side of an assignment expression must be a variable or a property access. +//! ,---- +//! 1 | ++ new Foo(); +//! : ^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserWithStatement2_es2015.1.normal.js b/crates/swc/tests/tsc-references/parserWithStatement2_es2015.1.normal.js new file mode 100644 index 000000000000..f5dac3135a55 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserWithStatement2_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. +//! ,---- +//! 1 | with (1) +//! : ^^^^ +//! `---- +//! +//! x With statement are not allowed in strict mode +//! ,---- +//! 1 | with (1) +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserWithStatement2_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserWithStatement2_es2015.2.minified.js new file mode 100644 index 000000000000..f5dac3135a55 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserWithStatement2_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. +//! ,---- +//! 1 | with (1) +//! : ^^^^ +//! `---- +//! +//! x With statement are not allowed in strict mode +//! ,---- +//! 1 | with (1) +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserWithStatement2_es5.1.normal.js b/crates/swc/tests/tsc-references/parserWithStatement2_es5.1.normal.js new file mode 100644 index 000000000000..f5dac3135a55 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserWithStatement2_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. +//! ,---- +//! 1 | with (1) +//! : ^^^^ +//! `---- +//! +//! x With statement are not allowed in strict mode +//! ,---- +//! 1 | with (1) +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/parserWithStatement2_es5.2.minified.js b/crates/swc/tests/tsc-references/parserWithStatement2_es5.2.minified.js new file mode 100644 index 000000000000..f5dac3135a55 --- /dev/null +++ b/crates/swc/tests/tsc-references/parserWithStatement2_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. +//! ,---- +//! 1 | with (1) +//! : ^^^^ +//! `---- +//! +//! x With statement are not allowed in strict mode +//! ,---- +//! 1 | with (1) +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/plainJSRedeclare2_es2015.1.normal.js b/crates/swc/tests/tsc-references/plainJSRedeclare2_es2015.1.normal.js index 1d50d10cbd3d..dc43cf99662e 100644 --- a/crates/swc/tests/tsc-references/plainJSRedeclare2_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/plainJSRedeclare2_es2015.1.normal.js @@ -2,6 +2,13 @@ // @allowJS: true // @checkJS: true // @filename: plainJSRedeclare.js -const orbitol = 1; -var orbitol = 1 + false; -orbitol.toExponential(); +//! +//! x the name `orbitol` is defined multiple times +//! ,-[2:1] +//! 2 | const orbitol = 1 +//! : ^^^|^^^ +//! : `-- previous definition of `orbitol` here +//! 3 | var orbitol = 1 + false +//! : ^^^|^^^ +//! : `-- `orbitol` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/plainJSRedeclare2_es2015.2.minified.js b/crates/swc/tests/tsc-references/plainJSRedeclare2_es2015.2.minified.js index a024fec1c929..491b6ced8dad 100644 --- a/crates/swc/tests/tsc-references/plainJSRedeclare2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/plainJSRedeclare2_es2015.2.minified.js @@ -1,3 +1,11 @@ -const orbitol = 1; -var orbitol = 1; -orbitol.toExponential(); +// @filename: plainJSRedeclare.js +//! +//! x the name `orbitol` is defined multiple times +//! ,-[2:1] +//! 2 | const orbitol = 1 +//! : ^^^|^^^ +//! : `-- previous definition of `orbitol` here +//! 3 | var orbitol = 1 + false +//! : ^^^|^^^ +//! : `-- `orbitol` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/plainJSRedeclare2_es5.1.normal.js b/crates/swc/tests/tsc-references/plainJSRedeclare2_es5.1.normal.js index 9429f89011d0..dc43cf99662e 100644 --- a/crates/swc/tests/tsc-references/plainJSRedeclare2_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/plainJSRedeclare2_es5.1.normal.js @@ -2,6 +2,13 @@ // @allowJS: true // @checkJS: true // @filename: plainJSRedeclare.js -var orbitol = 1; -var orbitol = 1 + false; -orbitol.toExponential(); +//! +//! x the name `orbitol` is defined multiple times +//! ,-[2:1] +//! 2 | const orbitol = 1 +//! : ^^^|^^^ +//! : `-- previous definition of `orbitol` here +//! 3 | var orbitol = 1 + false +//! : ^^^|^^^ +//! : `-- `orbitol` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/plainJSRedeclare2_es5.2.minified.js b/crates/swc/tests/tsc-references/plainJSRedeclare2_es5.2.minified.js index c1d01a3a320e..491b6ced8dad 100644 --- a/crates/swc/tests/tsc-references/plainJSRedeclare2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/plainJSRedeclare2_es5.2.minified.js @@ -1 +1,11 @@ -1..toExponential(); +// @filename: plainJSRedeclare.js +//! +//! x the name `orbitol` is defined multiple times +//! ,-[2:1] +//! 2 | const orbitol = 1 +//! : ^^^|^^^ +//! : `-- previous definition of `orbitol` here +//! 3 | var orbitol = 1 + false +//! : ^^^|^^^ +//! : `-- `orbitol` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/plainJSRedeclare3_es2015.1.normal.js b/crates/swc/tests/tsc-references/plainJSRedeclare3_es2015.1.normal.js index 33de95f69815..1fcb4a34efeb 100644 --- a/crates/swc/tests/tsc-references/plainJSRedeclare3_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/plainJSRedeclare3_es2015.1.normal.js @@ -2,6 +2,13 @@ // @allowJS: true // @checkJS: false // @filename: plainJSRedeclare.js -const orbitol = 1; -var orbitol = 1 + false; -orbitol.toExponential(); +//! +//! x the name `orbitol` is defined multiple times +//! ,-[2:1] +//! 2 | const orbitol = 1 +//! : ^^^|^^^ +//! : `-- previous definition of `orbitol` here +//! 3 | var orbitol = 1 + false +//! : ^^^|^^^ +//! : `-- `orbitol` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/plainJSRedeclare3_es2015.2.minified.js b/crates/swc/tests/tsc-references/plainJSRedeclare3_es2015.2.minified.js index a024fec1c929..491b6ced8dad 100644 --- a/crates/swc/tests/tsc-references/plainJSRedeclare3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/plainJSRedeclare3_es2015.2.minified.js @@ -1,3 +1,11 @@ -const orbitol = 1; -var orbitol = 1; -orbitol.toExponential(); +// @filename: plainJSRedeclare.js +//! +//! x the name `orbitol` is defined multiple times +//! ,-[2:1] +//! 2 | const orbitol = 1 +//! : ^^^|^^^ +//! : `-- previous definition of `orbitol` here +//! 3 | var orbitol = 1 + false +//! : ^^^|^^^ +//! : `-- `orbitol` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/plainJSRedeclare3_es5.1.normal.js b/crates/swc/tests/tsc-references/plainJSRedeclare3_es5.1.normal.js index 182c5d306bbe..1fcb4a34efeb 100644 --- a/crates/swc/tests/tsc-references/plainJSRedeclare3_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/plainJSRedeclare3_es5.1.normal.js @@ -2,6 +2,13 @@ // @allowJS: true // @checkJS: false // @filename: plainJSRedeclare.js -var orbitol = 1; -var orbitol = 1 + false; -orbitol.toExponential(); +//! +//! x the name `orbitol` is defined multiple times +//! ,-[2:1] +//! 2 | const orbitol = 1 +//! : ^^^|^^^ +//! : `-- previous definition of `orbitol` here +//! 3 | var orbitol = 1 + false +//! : ^^^|^^^ +//! : `-- `orbitol` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/plainJSRedeclare3_es5.2.minified.js b/crates/swc/tests/tsc-references/plainJSRedeclare3_es5.2.minified.js index c1d01a3a320e..491b6ced8dad 100644 --- a/crates/swc/tests/tsc-references/plainJSRedeclare3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/plainJSRedeclare3_es5.2.minified.js @@ -1 +1,11 @@ -1..toExponential(); +// @filename: plainJSRedeclare.js +//! +//! x the name `orbitol` is defined multiple times +//! ,-[2:1] +//! 2 | const orbitol = 1 +//! : ^^^|^^^ +//! : `-- previous definition of `orbitol` here +//! 3 | var orbitol = 1 + false +//! : ^^^|^^^ +//! : `-- `orbitol` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/plainJSRedeclare_es2015.1.normal.js b/crates/swc/tests/tsc-references/plainJSRedeclare_es2015.1.normal.js index bbf1c378d056..a7acb604bd74 100644 --- a/crates/swc/tests/tsc-references/plainJSRedeclare_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/plainJSRedeclare_es2015.1.normal.js @@ -1,6 +1,13 @@ // @outdir: out/ // @allowJS: true // @filename: plainJSRedeclare.js -const orbitol = 1; -var orbitol = 1 + false; -orbitol.toExponential(); +//! +//! x the name `orbitol` is defined multiple times +//! ,-[2:1] +//! 2 | const orbitol = 1 +//! : ^^^|^^^ +//! : `-- previous definition of `orbitol` here +//! 3 | var orbitol = 1 + false +//! : ^^^|^^^ +//! : `-- `orbitol` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/plainJSRedeclare_es2015.2.minified.js b/crates/swc/tests/tsc-references/plainJSRedeclare_es2015.2.minified.js index a024fec1c929..491b6ced8dad 100644 --- a/crates/swc/tests/tsc-references/plainJSRedeclare_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/plainJSRedeclare_es2015.2.minified.js @@ -1,3 +1,11 @@ -const orbitol = 1; -var orbitol = 1; -orbitol.toExponential(); +// @filename: plainJSRedeclare.js +//! +//! x the name `orbitol` is defined multiple times +//! ,-[2:1] +//! 2 | const orbitol = 1 +//! : ^^^|^^^ +//! : `-- previous definition of `orbitol` here +//! 3 | var orbitol = 1 + false +//! : ^^^|^^^ +//! : `-- `orbitol` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/plainJSRedeclare_es5.1.normal.js b/crates/swc/tests/tsc-references/plainJSRedeclare_es5.1.normal.js index 21a100a46a2e..a7acb604bd74 100644 --- a/crates/swc/tests/tsc-references/plainJSRedeclare_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/plainJSRedeclare_es5.1.normal.js @@ -1,6 +1,13 @@ // @outdir: out/ // @allowJS: true // @filename: plainJSRedeclare.js -var orbitol = 1; -var orbitol = 1 + false; -orbitol.toExponential(); +//! +//! x the name `orbitol` is defined multiple times +//! ,-[2:1] +//! 2 | const orbitol = 1 +//! : ^^^|^^^ +//! : `-- previous definition of `orbitol` here +//! 3 | var orbitol = 1 + false +//! : ^^^|^^^ +//! : `-- `orbitol` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/plainJSRedeclare_es5.2.minified.js b/crates/swc/tests/tsc-references/plainJSRedeclare_es5.2.minified.js index c1d01a3a320e..491b6ced8dad 100644 --- a/crates/swc/tests/tsc-references/plainJSRedeclare_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/plainJSRedeclare_es5.2.minified.js @@ -1 +1,11 @@ -1..toExponential(); +// @filename: plainJSRedeclare.js +//! +//! x the name `orbitol` is defined multiple times +//! ,-[2:1] +//! 2 | const orbitol = 1 +//! : ^^^|^^^ +//! : `-- previous definition of `orbitol` here +//! 3 | var orbitol = 1 + false +//! : ^^^|^^^ +//! : `-- `orbitol` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/preserveValueImports_errors_es2015.1.normal.js b/crates/swc/tests/tsc-references/preserveValueImports_errors_es2015.1.normal.js index 56edff235be4..92b7e4566cfa 100644 --- a/crates/swc/tests/tsc-references/preserveValueImports_errors_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/preserveValueImports_errors_es2015.1.normal.js @@ -2,13 +2,25 @@ // @isolatedModules: true,false // @module: esnext // @Filename: a.ts +export { }; // @Filename: b.ts class B { } -import { A } from "./a"; +export { }; +// @Filename: c.ts +export { }; +// @Filename: c.fixed.ts +export { }; // @Filename: d.ts export { A as AA } from "./a"; export { B as BB } from "./b"; +// @Filename: d.fixed.ts +export { }; // @Filename: e.ts -import { BB } from "./d"; -export { B as BB }; +export { }; +// @Filename: e.fixed.ts +export { }; +// @Filename: f.ts +export { }; +// @Filename: f.fixed.ts +export { }; diff --git a/crates/swc/tests/tsc-references/preserveValueImports_errors_es2015.2.minified.js b/crates/swc/tests/tsc-references/preserveValueImports_errors_es2015.2.minified.js index cf4282932cc8..9f1718f6ea74 100644 --- a/crates/swc/tests/tsc-references/preserveValueImports_errors_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/preserveValueImports_errors_es2015.2.minified.js @@ -1,7 +1,11 @@ -class B { -} -import { A } from "./a"; +export { }; +export { }; +export { }; +export { }; export { A as AA } from "./a"; export { B as BB } from "./b"; -import { BB } from "./d"; -export { B as BB }; +export { }; +export { }; +export { }; +export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/preserveValueImports_errors_es5.1.normal.js b/crates/swc/tests/tsc-references/preserveValueImports_errors_es5.1.normal.js index 5c5df363b359..ccb93fdd5328 100644 --- a/crates/swc/tests/tsc-references/preserveValueImports_errors_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/preserveValueImports_errors_es5.1.normal.js @@ -2,16 +2,28 @@ // @isolatedModules: true,false // @module: esnext // @Filename: a.ts -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +export { }; // @Filename: b.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var B = function B() { "use strict"; _class_call_check(this, B); }; -import { A } from "./a"; +export { }; +// @Filename: c.ts +export { }; +// @Filename: c.fixed.ts +export { }; // @Filename: d.ts export { A as AA } from "./a"; export { B as BB } from "./b"; +// @Filename: d.fixed.ts +export { }; // @Filename: e.ts -import { BB } from "./d"; -export { B as BB }; +export { }; +// @Filename: e.fixed.ts +export { }; +// @Filename: f.ts +export { }; +// @Filename: f.fixed.ts +export { }; diff --git a/crates/swc/tests/tsc-references/preserveValueImports_errors_es5.2.minified.js b/crates/swc/tests/tsc-references/preserveValueImports_errors_es5.2.minified.js index 9e753db05334..c56defb0d4b5 100644 --- a/crates/swc/tests/tsc-references/preserveValueImports_errors_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/preserveValueImports_errors_es5.2.minified.js @@ -1,10 +1,15 @@ +export { }; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var B = function() { "use strict"; _class_call_check(this, B); }; -import { A } from "./a"; +export { }; +export { }; export { A as AA } from "./a"; export { B as BB } from "./b"; -import { BB } from "./d"; -export { B as BB }; +export { }; +export { }; +export { }; +export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/preserveValueImports_es2015.1.normal.js b/crates/swc/tests/tsc-references/preserveValueImports_es2015.1.normal.js index 77a245828e11..aa62a1f28aa4 100644 --- a/crates/swc/tests/tsc-references/preserveValueImports_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/preserveValueImports_es2015.1.normal.js @@ -6,11 +6,17 @@ export default {}; export const b = 0; export const c = 1; // @Filename: b.ts -import { D } from "./a"; +export { }; +// @Filename: c.ts +export { }; +// @Filename: d.ts +module.exports = {}; +export { }; // @Filename: e.ts const D = require("./d"); const DD = require("./d"); DD; +export { }; +// @Filename: f.ts +import { b } from "./a"; b; -// @Filename: d.ts -module.exports = {}; diff --git a/crates/swc/tests/tsc-references/preserveValueImports_es2015.2.minified.js b/crates/swc/tests/tsc-references/preserveValueImports_es2015.2.minified.js index ec85d7c4a284..4106d7890407 100644 --- a/crates/swc/tests/tsc-references/preserveValueImports_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/preserveValueImports_es2015.2.minified.js @@ -1,5 +1,10 @@ export default {}; export const b = 0; export const c = 1; -import { D } from "./a"; -require("./d"), require("./d"), module.exports = {}; +export { }; +export { }; +module.exports = {}; +export { }; +require("./d"), require("./d"); +export { }; +import { b } from "./a"; diff --git a/crates/swc/tests/tsc-references/preserveValueImports_es5.1.normal.js b/crates/swc/tests/tsc-references/preserveValueImports_es5.1.normal.js index ff2f0aa416d7..8257d6ebb544 100644 --- a/crates/swc/tests/tsc-references/preserveValueImports_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/preserveValueImports_es5.1.normal.js @@ -6,11 +6,17 @@ export default {}; export var b = 0; export var c = 1; // @Filename: b.ts -import { D } from "./a"; +export { }; +// @Filename: c.ts +export { }; +// @Filename: d.ts +module.exports = {}; +export { }; // @Filename: e.ts var D = require("./d"); var DD = require("./d"); DD; +export { }; +// @Filename: f.ts +import { b } from "./a"; b; -// @Filename: d.ts -module.exports = {}; diff --git a/crates/swc/tests/tsc-references/preserveValueImports_es5.2.minified.js b/crates/swc/tests/tsc-references/preserveValueImports_es5.2.minified.js index 3510bae5e97f..c1b7ccf3330f 100644 --- a/crates/swc/tests/tsc-references/preserveValueImports_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/preserveValueImports_es5.2.minified.js @@ -1,5 +1,10 @@ export default {}; export var b = 0; export var c = 1; -import { D } from "./a"; -require("./d"), require("./d"), module.exports = {}; +export { }; +export { }; +module.exports = {}; +export { }; +require("./d"), require("./d"); +export { }; +import { b } from "./a"; diff --git a/crates/swc/tests/tsc-references/preserveValueImports_importsNotUsedAsValues_es2015.1.normal.js b/crates/swc/tests/tsc-references/preserveValueImports_importsNotUsedAsValues_es2015.1.normal.js index 6c59b8fca279..2af3c99f1411 100644 --- a/crates/swc/tests/tsc-references/preserveValueImports_importsNotUsedAsValues_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/preserveValueImports_importsNotUsedAsValues_es2015.1.normal.js @@ -3,3 +3,7 @@ // @module: esnext // @Filename: /mod.ts export { }; +// @Filename: /index.ts +export { }; +// @Filename: /reexport.ts +export { }; diff --git a/crates/swc/tests/tsc-references/preserveValueImports_importsNotUsedAsValues_es2015.2.minified.js b/crates/swc/tests/tsc-references/preserveValueImports_importsNotUsedAsValues_es2015.2.minified.js index 2234b9cae16d..f109f4c5600e 100644 --- a/crates/swc/tests/tsc-references/preserveValueImports_importsNotUsedAsValues_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/preserveValueImports_importsNotUsedAsValues_es2015.2.minified.js @@ -1 +1,3 @@ export { }; +export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/preserveValueImports_importsNotUsedAsValues_es5.1.normal.js b/crates/swc/tests/tsc-references/preserveValueImports_importsNotUsedAsValues_es5.1.normal.js index 6c59b8fca279..2af3c99f1411 100644 --- a/crates/swc/tests/tsc-references/preserveValueImports_importsNotUsedAsValues_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/preserveValueImports_importsNotUsedAsValues_es5.1.normal.js @@ -3,3 +3,7 @@ // @module: esnext // @Filename: /mod.ts export { }; +// @Filename: /index.ts +export { }; +// @Filename: /reexport.ts +export { }; diff --git a/crates/swc/tests/tsc-references/preserveValueImports_importsNotUsedAsValues_es5.2.minified.js b/crates/swc/tests/tsc-references/preserveValueImports_importsNotUsedAsValues_es5.2.minified.js index 2234b9cae16d..f109f4c5600e 100644 --- a/crates/swc/tests/tsc-references/preserveValueImports_importsNotUsedAsValues_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/preserveValueImports_importsNotUsedAsValues_es5.2.minified.js @@ -1 +1,3 @@ export { }; +export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/preserveValueImports_mixedImports_es2015.1.normal.js b/crates/swc/tests/tsc-references/preserveValueImports_mixedImports_es2015.1.normal.js index 091f5c3c0568..e688b59e74fd 100644 --- a/crates/swc/tests/tsc-references/preserveValueImports_mixedImports_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/preserveValueImports_mixedImports_es2015.1.normal.js @@ -3,3 +3,7 @@ // @module: es2015 // @Filename: /exports.ts export function Component() {} +// @Filename: /index.ts +export { }; +// @Filename: /index.fixed.ts +export { }; diff --git a/crates/swc/tests/tsc-references/preserveValueImports_mixedImports_es2015.2.minified.js b/crates/swc/tests/tsc-references/preserveValueImports_mixedImports_es2015.2.minified.js index b6de3aa66251..d3fa525919ea 100644 --- a/crates/swc/tests/tsc-references/preserveValueImports_mixedImports_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/preserveValueImports_mixedImports_es2015.2.minified.js @@ -1 +1,3 @@ export function Component() {} +export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/preserveValueImports_mixedImports_es5.1.normal.js b/crates/swc/tests/tsc-references/preserveValueImports_mixedImports_es5.1.normal.js index 091f5c3c0568..e688b59e74fd 100644 --- a/crates/swc/tests/tsc-references/preserveValueImports_mixedImports_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/preserveValueImports_mixedImports_es5.1.normal.js @@ -3,3 +3,7 @@ // @module: es2015 // @Filename: /exports.ts export function Component() {} +// @Filename: /index.ts +export { }; +// @Filename: /index.fixed.ts +export { }; diff --git a/crates/swc/tests/tsc-references/preserveValueImports_mixedImports_es5.2.minified.js b/crates/swc/tests/tsc-references/preserveValueImports_mixedImports_es5.2.minified.js index b6de3aa66251..d3fa525919ea 100644 --- a/crates/swc/tests/tsc-references/preserveValueImports_mixedImports_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/preserveValueImports_mixedImports_es5.2.minified.js @@ -1 +1,3 @@ export function Component() {} +export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/privateNameDuplicateField_es2015.1.normal.js b/crates/swc/tests/tsc-references/privateNameDuplicateField_es2015.1.normal.js index b01b444db534..f656bd3e63ae 100644 --- a/crates/swc/tests/tsc-references/privateNameDuplicateField_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/privateNameDuplicateField_es2015.1.normal.js @@ -1,878 +1,360 @@ -// @strict: true -// @target: es6 -import _class_private_field_init from "@swc/helpers/src/_class_private_field_init.mjs"; -import _class_private_method_init from "@swc/helpers/src/_class_private_method_init.mjs"; -function Field() { - var _foo = /*#__PURE__*/ new WeakMap(), _foo = /*#__PURE__*/ new WeakMap(); - // Error - class A_Field_Field { - constructor(){ - _class_private_field_init(this, _foo, { - writable: true, - value: "foo" - }); - _class_private_field_init(this, _foo, { - writable: true, - value: "foo" - }); - } - } - var _foo1 = /*#__PURE__*/ new WeakMap(), _foo1 = /*#__PURE__*/ new WeakSet(); - // Error - class A_Field_Method { - constructor(){ - _class_private_method_init(this, _foo1); - _class_private_field_init(this, _foo1, { - writable: true, - value: "foo" - }); - } - } - function foo() {} - var _foo2 = /*#__PURE__*/ new WeakMap(), _foo2 = /*#__PURE__*/ new WeakMap(); - // Error - class A_Field_Getter { - constructor(){ - _class_private_field_init(this, _foo2, { - get: get_foo, - set: void 0 - }); - _class_private_field_init(this, _foo2, { - writable: true, - value: "foo" - }); - } - } - function get_foo() { - return ""; - } - var _foo3 = /*#__PURE__*/ new WeakMap(), _foo3 = /*#__PURE__*/ new WeakMap(); - // Error - class A_Field_Setter { - constructor(){ - _class_private_field_init(this, _foo3, { - get: void 0, - set: set_foo - }); - _class_private_field_init(this, _foo3, { - writable: true, - value: "foo" - }); - } - } - function set_foo(value) {} - var _foo4 = /*#__PURE__*/ new WeakMap(); - // Error - class A_Field_StaticField { - constructor(){ - _class_private_field_init(this, _foo4, { - writable: true, - value: "foo" - }); - } - } - var _foo4 = { - writable: true, - value: "foo" - }; - var _foo5 = /*#__PURE__*/ new WeakMap(); - // Error - class A_Field_StaticMethod { - constructor(){ - _class_private_field_init(this, _foo5, { - writable: true, - value: "foo" - }); - } - } - function foo1() {} - var _foo6 = /*#__PURE__*/ new WeakMap(); - // Error - class A_Field_StaticGetter { - constructor(){ - _class_private_field_init(this, _foo6, { - writable: true, - value: "foo" - }); - } - } - var _foo6 = { - get: get_foo1, - set: void 0 - }; - function get_foo1() { - return ""; - } - var _foo7 = /*#__PURE__*/ new WeakMap(); - // Error - class A_Field_StaticSetter { - constructor(){ - _class_private_field_init(this, _foo7, { - writable: true, - value: "foo" - }); - } - } - var _foo7 = { - get: void 0, - set: set_foo1 - }; - function set_foo1(value) {} -} -function Method() { - var _foo = /*#__PURE__*/ new WeakSet(), _foo = /*#__PURE__*/ new WeakMap(); - // Error - class A_Method_Field { - constructor(){ - _class_private_method_init(this, _foo); - _class_private_field_init(this, _foo, { - writable: true, - value: "foo" - }); - } - } - function foo() {} - var _foo1 = /*#__PURE__*/ new WeakSet(), _foo1 = /*#__PURE__*/ new WeakSet(); - // Error - class A_Method_Method { - constructor(){ - _class_private_method_init(this, _foo1); - _class_private_method_init(this, _foo1); - } - } - function foo1() {} - function foo1() {} - var _foo2 = /*#__PURE__*/ new WeakSet(), _foo2 = /*#__PURE__*/ new WeakMap(); - // Error - class A_Method_Getter { - constructor(){ - _class_private_method_init(this, _foo2); - _class_private_field_init(this, _foo2, { - get: get_foo, - set: void 0 - }); - } - } - function foo2() {} - function get_foo() { - return ""; - } - var _foo3 = /*#__PURE__*/ new WeakSet(), _foo3 = /*#__PURE__*/ new WeakMap(); - // Error - class A_Method_Setter { - constructor(){ - _class_private_method_init(this, _foo3); - _class_private_field_init(this, _foo3, { - get: void 0, - set: set_foo - }); - } - } - function foo3() {} - function set_foo(value) {} - var _foo4 = /*#__PURE__*/ new WeakSet(); - // Error - class A_Method_StaticField { - constructor(){ - _class_private_method_init(this, _foo4); - } - } - var _foo4 = { - writable: true, - value: "foo" - }; - function foo4() {} - var _foo5 = /*#__PURE__*/ new WeakSet(); - // Error - class A_Method_StaticMethod { - constructor(){ - _class_private_method_init(this, _foo5); - } - } - function foo5() {} - function foo5() {} - var _foo6 = /*#__PURE__*/ new WeakSet(); - // Error - class A_Method_StaticGetter { - constructor(){ - _class_private_method_init(this, _foo6); - } - } - var _foo6 = { - get: get_foo1, - set: void 0 - }; - function foo6() {} - function get_foo1() { - return ""; - } - var _foo7 = /*#__PURE__*/ new WeakSet(); - // Error - class A_Method_StaticSetter { - constructor(){ - _class_private_method_init(this, _foo7); - } - } - var _foo7 = { - get: void 0, - set: set_foo1 - }; - function foo7() {} - function set_foo1(value) {} -} -function Getter() { - var _foo = /*#__PURE__*/ new WeakMap(), _foo = /*#__PURE__*/ new WeakMap(); - // Error - class A_Getter_Field { - constructor(){ - _class_private_field_init(this, _foo, { - get: get_foo, - set: void 0 - }); - _class_private_field_init(this, _foo, { - writable: true, - value: "foo" - }); - } - } - function get_foo() { - return ""; - } - var _foo1 = /*#__PURE__*/ new WeakMap(), _foo1 = /*#__PURE__*/ new WeakSet(); - // Error - class A_Getter_Method { - constructor(){ - _class_private_field_init(this, _foo1, { - get: get_foo1, - set: void 0 - }); - _class_private_method_init(this, _foo1); - } - } - function get_foo1() { - return ""; - } - function foo() {} - var _foo2 = /*#__PURE__*/ new WeakMap(); - // Error - class A_Getter_Getter { - constructor(){ - _class_private_field_init(this, _foo2, { - get: get_foo2, - set: void 0 - }); - } - } - function get_foo2() { - return ""; - } - function get_foo2() { - return ""; - } - var _foo3 = /*#__PURE__*/ new WeakMap(); - //OK - class A_Getter_Setter { - constructor(){ - _class_private_field_init(this, _foo3, { - get: get_foo3, - set: set_foo - }); - } - } - function get_foo3() { - return ""; - } - function set_foo(value) {} - var _foo4 = /*#__PURE__*/ new WeakMap(); - // Error - class A_Getter_StaticField { - constructor(){ - _class_private_field_init(this, _foo4, { - get: get_foo4, - set: void 0 - }); - } - } - function get_foo4() { - return ""; - } - function foo1() {} - var _foo5 = /*#__PURE__*/ new WeakMap(); - // Error - class A_Getter_StaticMethod { - constructor(){ - _class_private_field_init(this, _foo5, { - get: get_foo5, - set: void 0 - }); - } - } - function get_foo5() { - return ""; - } - function foo2() {} - var _foo6 = /*#__PURE__*/ new WeakMap(); - // Error - class A_Getter_StaticGetter { - constructor(){ - _class_private_field_init(this, _foo6, { - get: get_foo6, - set: void 0 - }); - } - } - var _foo6 = { - get: get_foo6, - set: void 0 - }; - function get_foo6() { - return ""; - } - function get_foo6() { - return ""; - } - var _foo7 = /*#__PURE__*/ new WeakMap(); - // Error - class A_Getter_StaticSetter { - constructor(){ - _class_private_field_init(this, _foo7, { - get: get_foo7, - set: void 0 - }); - } - } - var _foo7 = { - get: void 0, - set: set_foo1 - }; - function get_foo7() { - return ""; - } - function set_foo1(value) {} -} -function Setter() { - var _foo = /*#__PURE__*/ new WeakMap(), _foo = /*#__PURE__*/ new WeakMap(); - // Error - class A_Setter_Field { - constructor(){ - _class_private_field_init(this, _foo, { - get: void 0, - set: set_foo - }); - _class_private_field_init(this, _foo, { - writable: true, - value: "foo" - }); - } - } - function set_foo(value) {} - var _foo1 = /*#__PURE__*/ new WeakMap(), _foo1 = /*#__PURE__*/ new WeakSet(); - // Error - class A_Setter_Method { - constructor(){ - _class_private_field_init(this, _foo1, { - get: void 0, - set: set_foo1 - }); - _class_private_method_init(this, _foo1); - } - } - function set_foo1(value) {} - function foo() {} - var _foo2 = /*#__PURE__*/ new WeakMap(); - // OK - class A_Setter_Getter { - constructor(){ - _class_private_field_init(this, _foo2, { - get: get_foo, - set: set_foo2 - }); - } - } - function set_foo2(value) {} - function get_foo() { - return ""; - } - var _foo3 = /*#__PURE__*/ new WeakMap(); - // Error - class A_Setter_Setter { - constructor(){ - _class_private_field_init(this, _foo3, { - get: void 0, - set: set_foo3 - }); - } - } - function set_foo3(value) {} - function set_foo3(value) {} - var _foo4 = /*#__PURE__*/ new WeakMap(); - // Error - class A_Setter_StaticField { - constructor(){ - _class_private_field_init(this, _foo4, { - get: void 0, - set: set_foo4 - }); - } - } - var _foo4 = { - writable: true, - value: "foo" - }; - function set_foo4(value) {} - var _foo5 = /*#__PURE__*/ new WeakMap(); - // Error - class A_Setter_StaticMethod { - constructor(){ - _class_private_field_init(this, _foo5, { - get: void 0, - set: set_foo5 - }); - } - } - function set_foo5(value) {} - function foo1() {} - var _foo6 = /*#__PURE__*/ new WeakMap(); - // Error - class A_Setter_StaticGetter { - constructor(){ - _class_private_field_init(this, _foo6, { - get: void 0, - set: set_foo6 - }); - } - } - var _foo6 = { - get: get_foo1, - set: void 0 - }; - function set_foo6(value) {} - function get_foo1() { - return ""; - } - var _foo7 = /*#__PURE__*/ new WeakMap(); - // Error - class A_Setter_StaticSetter { - constructor(){ - _class_private_field_init(this, _foo7, { - get: void 0, - set: set_foo7 - }); - } - } - var _foo7 = { - get: void 0, - set: set_foo7 - }; - function set_foo7(value) {} - function set_foo7(value) {} -} -function StaticField() { - var _foo = /*#__PURE__*/ new WeakMap(); - // Error - class A_StaticField_Field { - constructor(){ - _class_private_field_init(this, _foo, { - writable: true, - value: "foo" - }); - } - } - var _foo = { - writable: true, - value: "foo" - }; - var _foo1 = /*#__PURE__*/ new WeakSet(); - // Error - class A_StaticField_Method { - constructor(){ - _class_private_method_init(this, _foo1); - } - } - var _foo1 = { - writable: true, - value: "foo" - }; - function foo() {} - var _foo2 = /*#__PURE__*/ new WeakMap(); - // Error - class A_StaticField_Getter { - constructor(){ - _class_private_field_init(this, _foo2, { - get: get_foo, - set: void 0 - }); - } - } - var _foo2 = { - writable: true, - value: "foo" - }; - function get_foo() { - return ""; - } - var _foo3 = /*#__PURE__*/ new WeakMap(); - // Error - class A_StaticField_Setter { - constructor(){ - _class_private_field_init(this, _foo3, { - get: void 0, - set: set_foo - }); - } - } - var _foo3 = { - writable: true, - value: "foo" - }; - function set_foo(value) {} - // Error - class A_StaticField_StaticField { - } - var _foo4 = { - writable: true, - value: "foo" - }; - var _foo4 = { - writable: true, - value: "foo" - }; - // Error - class A_StaticField_StaticMethod { - } - var _foo5 = { - writable: true, - value: "foo" - }; - function foo1() {} - // Error - class A_StaticField_StaticGetter { - } - var _foo6 = { - get: get_foo1, - set: void 0 - }; - var _foo6 = { - writable: true, - value: "foo" - }; - function get_foo1() { - return ""; - } - // Error - class A_StaticField_StaticSetter { - } - var _foo7 = { - get: void 0, - set: set_foo1 - }; - var _foo7 = { - writable: true, - value: "foo" - }; - function set_foo1(value) {} -} -function StaticMethod() { - var _foo = /*#__PURE__*/ new WeakMap(); - // Error - class A_StaticMethod_Field { - constructor(){ - _class_private_field_init(this, _foo, { - writable: true, - value: "foo" - }); - } - } - function foo() {} - var _foo1 = /*#__PURE__*/ new WeakSet(); - // Error - class A_StaticMethod_Method { - constructor(){ - _class_private_method_init(this, _foo1); - } - } - function foo1() {} - function foo1() {} - var _foo2 = /*#__PURE__*/ new WeakMap(); - // Error - class A_StaticMethod_Getter { - constructor(){ - _class_private_field_init(this, _foo2, { - get: get_foo, - set: void 0 - }); - } - } - function foo2() {} - function get_foo() { - return ""; - } - var _foo3 = /*#__PURE__*/ new WeakMap(); - // Error - class A_StaticMethod_Setter { - constructor(){ - _class_private_field_init(this, _foo3, { - get: void 0, - set: set_foo - }); - } - } - function foo3() {} - function set_foo(value) {} - // Error - class A_StaticMethod_StaticField { - } - var _foo4 = { - writable: true, - value: "foo" - }; - function foo4() {} - // Error - class A_StaticMethod_StaticMethod { - } - function foo5() {} - function foo5() {} - // Error - class A_StaticMethod_StaticGetter { - } - var _foo5 = { - get: get_foo1, - set: void 0 - }; - function foo6() {} - function get_foo1() { - return ""; - } - // Error - class A_StaticMethod_StaticSetter { - } - var _foo6 = { - get: void 0, - set: set_foo1 - }; - function foo7() {} - function set_foo1(value) {} -} -function StaticGetter() { - var _foo = /*#__PURE__*/ new WeakMap(); - // Error - class A_StaticGetter_Field { - constructor(){ - _class_private_field_init(this, _foo, { - writable: true, - value: "foo" - }); - } - } - var _foo = { - get: get_foo, - set: void 0 - }; - function get_foo() { - return ""; - } - var _foo1 = /*#__PURE__*/ new WeakSet(); - // Error - class A_StaticGetter_Method { - constructor(){ - _class_private_method_init(this, _foo1); - } - } - var _foo1 = { - get: get_foo1, - set: void 0 - }; - function get_foo1() { - return ""; - } - function foo() {} - var _foo2 = /*#__PURE__*/ new WeakMap(); - // Error - class A_StaticGetter_Getter { - constructor(){ - _class_private_field_init(this, _foo2, { - get: get_foo2, - set: void 0 - }); - } - } - var _foo2 = { - get: get_foo2, - set: void 0 - }; - function get_foo2() { - return ""; - } - function get_foo2() { - return ""; - } - var _foo3 = /*#__PURE__*/ new WeakMap(); - // Error - class A_StaticGetter_Setter { - constructor(){ - _class_private_field_init(this, _foo3, { - get: void 0, - set: set_foo - }); - } - } - var _foo3 = { - get: get_foo3, - set: void 0 - }; - function get_foo3() { - return ""; - } - function set_foo(value) {} - // Error - class A_StaticGetter_StaticField { - } - var _foo4 = { - get: get_foo4, - set: void 0 - }; - function get_foo4() { - return ""; - } - function foo1() {} - // Error - class A_StaticGetter_StaticMethod { - } - var _foo5 = { - get: get_foo5, - set: void 0 - }; - function get_foo5() { - return ""; - } - function foo2() {} - // Error - class A_StaticGetter_StaticGetter { - } - var _foo6 = { - get: get_foo6, - set: void 0 - }; - function get_foo6() { - return ""; - } - function get_foo6() { - return ""; - } - // OK - class A_StaticGetter_StaticSetter { - } - var _foo7 = { - get: get_foo7, - set: set_foo1 - }; - function get_foo7() { - return ""; - } - function set_foo1(value) {} -} -function StaticSetter() { - var _foo = /*#__PURE__*/ new WeakMap(); - // Error - class A_StaticSetter_Field { - constructor(){ - _class_private_field_init(this, _foo, { - writable: true, - value: "foo" - }); - } - } - var _foo = { - get: void 0, - set: set_foo - }; - function set_foo(value) {} - var _foo1 = /*#__PURE__*/ new WeakSet(); - // Error - class A_StaticSetter_Method { - constructor(){ - _class_private_method_init(this, _foo1); - } - } - var _foo1 = { - get: void 0, - set: set_foo1 - }; - function set_foo1(value) {} - function foo() {} - var _foo2 = /*#__PURE__*/ new WeakMap(); - // Error - class A_StaticSetter_Getter { - constructor(){ - _class_private_field_init(this, _foo2, { - get: get_foo, - set: void 0 - }); - } - } - var _foo2 = { - get: void 0, - set: set_foo2 - }; - function set_foo2(value) {} - function get_foo() { - return ""; - } - var _foo3 = /*#__PURE__*/ new WeakMap(); - // Error - class A_StaticSetter_Setter { - constructor(){ - _class_private_field_init(this, _foo3, { - get: void 0, - set: set_foo3 - }); - } - } - var _foo3 = { - get: void 0, - set: set_foo3 - }; - function set_foo3(value) {} - function set_foo3(value) {} - // Error - class A_StaticSetter_StaticField { - } - var _foo4 = { - get: void 0, - set: set_foo4 - }; - var _foo4 = { - writable: true, - value: "foo" - }; - function set_foo4(value) {} - // Error - class A_StaticSetter_StaticMethod { - } - var _foo5 = { - get: void 0, - set: set_foo5 - }; - function set_foo5(value) {} - function foo1() {} - // OK - class A_StaticSetter_StaticGetter { - } - var _foo6 = { - get: get_foo1, - set: set_foo6 - }; - function set_foo6(value) {} - function get_foo1() { - return ""; - } - // Error - class A_StaticSetter_StaticSetter { - } - var _foo7 = { - get: void 0, - set: set_foo7 - }; - function set_foo7(value) {} - function set_foo7(value) {} -} +//! +//! x duplicate private name #foo. +//! ,---- +//! 9 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 15 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 21 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 27 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 33 | static #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 39 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 45 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 51 | static set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 59 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 65 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 71 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 77 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 83 | static #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 89 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 95 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 101 | static set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 110 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 116 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 122 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 134 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 140 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 146 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 152 | static set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 160 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 166 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 178 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 184 | static #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 190 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 196 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 202 | static set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 210 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 216 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 222 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 228 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 234 | static #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 240 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 246 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 252 | static set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 260 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 266 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 272 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 278 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 284 | static #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 290 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 296 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 302 | static set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 311 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 317 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 323 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 329 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 335 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 341 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 347 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 360 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 366 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 373 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 379 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 385 | static #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 391 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 403 | static set #foo(value: string) { } +//! : ^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/privateNameDuplicateField_es2015.2.minified.js b/crates/swc/tests/tsc-references/privateNameDuplicateField_es2015.2.minified.js index 1286e0fb78fc..f656bd3e63ae 100644 --- a/crates/swc/tests/tsc-references/privateNameDuplicateField_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNameDuplicateField_es2015.2.minified.js @@ -1,2 +1,360 @@ -import _class_private_field_init from "@swc/helpers/src/_class_private_field_init.mjs"; -import _class_private_method_init from "@swc/helpers/src/_class_private_method_init.mjs"; +//! +//! x duplicate private name #foo. +//! ,---- +//! 9 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 15 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 21 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 27 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 33 | static #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 39 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 45 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 51 | static set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 59 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 65 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 71 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 77 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 83 | static #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 89 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 95 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 101 | static set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 110 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 116 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 122 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 134 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 140 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 146 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 152 | static set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 160 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 166 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 178 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 184 | static #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 190 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 196 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 202 | static set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 210 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 216 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 222 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 228 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 234 | static #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 240 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 246 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 252 | static set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 260 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 266 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 272 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 278 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 284 | static #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 290 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 296 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 302 | static set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 311 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 317 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 323 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 329 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 335 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 341 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 347 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 360 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 366 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 373 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 379 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 385 | static #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 391 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 403 | static set #foo(value: string) { } +//! : ^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/privateNameDuplicateField_es5.1.normal.js b/crates/swc/tests/tsc-references/privateNameDuplicateField_es5.1.normal.js index 504029bfa938..f656bd3e63ae 100644 --- a/crates/swc/tests/tsc-references/privateNameDuplicateField_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/privateNameDuplicateField_es5.1.normal.js @@ -1,911 +1,360 @@ -// @strict: true -// @target: es6 -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _class_private_field_init from "@swc/helpers/src/_class_private_field_init.mjs"; -import _class_private_method_init from "@swc/helpers/src/_class_private_method_init.mjs"; -function Field() { - var foo = function foo() {}; - var get_foo = function get_foo() { - return ""; - }; - var set_foo = function set_foo(value) {}; - var foo1 = function foo1() {}; - var get_foo1 = function get_foo1() { - return ""; - }; - var set_foo1 = function set_foo1(value) {}; - var _foo = /*#__PURE__*/ new WeakMap(), _foo = /*#__PURE__*/ new WeakMap(); - // Error - var A_Field_Field = function A_Field_Field() { - "use strict"; - _class_call_check(this, A_Field_Field); - _class_private_field_init(this, _foo, { - writable: true, - value: "foo" - }); - _class_private_field_init(this, _foo, { - writable: true, - value: "foo" - }); - }; - var _foo1 = /*#__PURE__*/ new WeakMap(), _foo1 = /*#__PURE__*/ new WeakSet(); - // Error - var A_Field_Method = function A_Field_Method() { - "use strict"; - _class_call_check(this, A_Field_Method); - _class_private_method_init(this, _foo1); - _class_private_field_init(this, _foo1, { - writable: true, - value: "foo" - }); - }; - var _foo2 = /*#__PURE__*/ new WeakMap(), _foo2 = /*#__PURE__*/ new WeakMap(); - // Error - var A_Field_Getter = function A_Field_Getter() { - "use strict"; - _class_call_check(this, A_Field_Getter); - _class_private_field_init(this, _foo2, { - get: get_foo, - set: void 0 - }); - _class_private_field_init(this, _foo2, { - writable: true, - value: "foo" - }); - }; - var _foo3 = /*#__PURE__*/ new WeakMap(), _foo3 = /*#__PURE__*/ new WeakMap(); - // Error - var A_Field_Setter = function A_Field_Setter() { - "use strict"; - _class_call_check(this, A_Field_Setter); - _class_private_field_init(this, _foo3, { - get: void 0, - set: set_foo - }); - _class_private_field_init(this, _foo3, { - writable: true, - value: "foo" - }); - }; - var _foo4 = /*#__PURE__*/ new WeakMap(); - // Error - var A_Field_StaticField = function A_Field_StaticField() { - "use strict"; - _class_call_check(this, A_Field_StaticField); - _class_private_field_init(this, _foo4, { - writable: true, - value: "foo" - }); - }; - var _foo4 = { - writable: true, - value: "foo" - }; - var _foo5 = /*#__PURE__*/ new WeakMap(); - // Error - var A_Field_StaticMethod = function A_Field_StaticMethod() { - "use strict"; - _class_call_check(this, A_Field_StaticMethod); - _class_private_field_init(this, _foo5, { - writable: true, - value: "foo" - }); - }; - var _foo6 = /*#__PURE__*/ new WeakMap(); - // Error - var A_Field_StaticGetter = function A_Field_StaticGetter() { - "use strict"; - _class_call_check(this, A_Field_StaticGetter); - _class_private_field_init(this, _foo6, { - writable: true, - value: "foo" - }); - }; - var _foo6 = { - get: get_foo1, - set: void 0 - }; - var _foo7 = /*#__PURE__*/ new WeakMap(); - // Error - var A_Field_StaticSetter = function A_Field_StaticSetter() { - "use strict"; - _class_call_check(this, A_Field_StaticSetter); - _class_private_field_init(this, _foo7, { - writable: true, - value: "foo" - }); - }; - var _foo7 = { - get: void 0, - set: set_foo1 - }; -} -function Method() { - var foo = function foo() {}; - var foo1 = function foo1() {}; - var foo1 = function foo1() {}; - var foo2 = function foo2() {}; - var get_foo = function get_foo() { - return ""; - }; - var foo3 = function foo3() {}; - var set_foo = function set_foo(value) {}; - var foo4 = function foo4() {}; - var foo5 = function foo5() {}; - var foo5 = function foo5() {}; - var foo6 = function foo6() {}; - var get_foo1 = function get_foo1() { - return ""; - }; - var foo7 = function foo7() {}; - var set_foo1 = function set_foo1(value) {}; - var _foo = /*#__PURE__*/ new WeakSet(), _foo = /*#__PURE__*/ new WeakMap(); - // Error - var A_Method_Field = function A_Method_Field() { - "use strict"; - _class_call_check(this, A_Method_Field); - _class_private_method_init(this, _foo); - _class_private_field_init(this, _foo, { - writable: true, - value: "foo" - }); - }; - var _foo1 = /*#__PURE__*/ new WeakSet(), _foo1 = /*#__PURE__*/ new WeakSet(); - // Error - var A_Method_Method = function A_Method_Method() { - "use strict"; - _class_call_check(this, A_Method_Method); - _class_private_method_init(this, _foo1); - _class_private_method_init(this, _foo1); - }; - var _foo2 = /*#__PURE__*/ new WeakSet(), _foo2 = /*#__PURE__*/ new WeakMap(); - // Error - var A_Method_Getter = function A_Method_Getter() { - "use strict"; - _class_call_check(this, A_Method_Getter); - _class_private_method_init(this, _foo2); - _class_private_field_init(this, _foo2, { - get: get_foo, - set: void 0 - }); - }; - var _foo3 = /*#__PURE__*/ new WeakSet(), _foo3 = /*#__PURE__*/ new WeakMap(); - // Error - var A_Method_Setter = function A_Method_Setter() { - "use strict"; - _class_call_check(this, A_Method_Setter); - _class_private_method_init(this, _foo3); - _class_private_field_init(this, _foo3, { - get: void 0, - set: set_foo - }); - }; - var _foo4 = /*#__PURE__*/ new WeakSet(); - // Error - var A_Method_StaticField = function A_Method_StaticField() { - "use strict"; - _class_call_check(this, A_Method_StaticField); - _class_private_method_init(this, _foo4); - }; - var _foo4 = { - writable: true, - value: "foo" - }; - var _foo5 = /*#__PURE__*/ new WeakSet(); - // Error - var A_Method_StaticMethod = function A_Method_StaticMethod() { - "use strict"; - _class_call_check(this, A_Method_StaticMethod); - _class_private_method_init(this, _foo5); - }; - var _foo6 = /*#__PURE__*/ new WeakSet(); - // Error - var A_Method_StaticGetter = function A_Method_StaticGetter() { - "use strict"; - _class_call_check(this, A_Method_StaticGetter); - _class_private_method_init(this, _foo6); - }; - var _foo6 = { - get: get_foo1, - set: void 0 - }; - var _foo7 = /*#__PURE__*/ new WeakSet(); - // Error - var A_Method_StaticSetter = function A_Method_StaticSetter() { - "use strict"; - _class_call_check(this, A_Method_StaticSetter); - _class_private_method_init(this, _foo7); - }; - var _foo7 = { - get: void 0, - set: set_foo1 - }; -} -function Getter() { - var get_foo = function get_foo() { - return ""; - }; - var get_foo1 = function get_foo1() { - return ""; - }; - var foo = function foo() {}; - var get_foo2 = function get_foo2() { - return ""; - }; - var get_foo2 = function get_foo2() { - return ""; - }; - var get_foo3 = function get_foo3() { - return ""; - }; - var set_foo = function set_foo(value) {}; - var get_foo4 = function get_foo4() { - return ""; - }; - var foo1 = function foo1() {}; - var get_foo5 = function get_foo5() { - return ""; - }; - var foo2 = function foo2() {}; - var get_foo6 = function get_foo6() { - return ""; - }; - var get_foo6 = function get_foo6() { - return ""; - }; - var get_foo7 = function get_foo7() { - return ""; - }; - var set_foo1 = function set_foo1(value) {}; - var _foo = /*#__PURE__*/ new WeakMap(), _foo = /*#__PURE__*/ new WeakMap(); - // Error - var A_Getter_Field = function A_Getter_Field() { - "use strict"; - _class_call_check(this, A_Getter_Field); - _class_private_field_init(this, _foo, { - get: get_foo, - set: void 0 - }); - _class_private_field_init(this, _foo, { - writable: true, - value: "foo" - }); - }; - var _foo1 = /*#__PURE__*/ new WeakMap(), _foo1 = /*#__PURE__*/ new WeakSet(); - // Error - var A_Getter_Method = function A_Getter_Method() { - "use strict"; - _class_call_check(this, A_Getter_Method); - _class_private_field_init(this, _foo1, { - get: get_foo1, - set: void 0 - }); - _class_private_method_init(this, _foo1); - }; - var _foo2 = /*#__PURE__*/ new WeakMap(); - // Error - var A_Getter_Getter = function A_Getter_Getter() { - "use strict"; - _class_call_check(this, A_Getter_Getter); - _class_private_field_init(this, _foo2, { - get: get_foo2, - set: void 0 - }); - }; - var _foo3 = /*#__PURE__*/ new WeakMap(); - //OK - var A_Getter_Setter = function A_Getter_Setter() { - "use strict"; - _class_call_check(this, A_Getter_Setter); - _class_private_field_init(this, _foo3, { - get: get_foo3, - set: set_foo - }); - }; - var _foo4 = /*#__PURE__*/ new WeakMap(); - // Error - var A_Getter_StaticField = function A_Getter_StaticField() { - "use strict"; - _class_call_check(this, A_Getter_StaticField); - _class_private_field_init(this, _foo4, { - get: get_foo4, - set: void 0 - }); - }; - var _foo5 = /*#__PURE__*/ new WeakMap(); - // Error - var A_Getter_StaticMethod = function A_Getter_StaticMethod() { - "use strict"; - _class_call_check(this, A_Getter_StaticMethod); - _class_private_field_init(this, _foo5, { - get: get_foo5, - set: void 0 - }); - }; - var _foo6 = /*#__PURE__*/ new WeakMap(); - // Error - var A_Getter_StaticGetter = function A_Getter_StaticGetter() { - "use strict"; - _class_call_check(this, A_Getter_StaticGetter); - _class_private_field_init(this, _foo6, { - get: get_foo6, - set: void 0 - }); - }; - var _foo6 = { - get: get_foo6, - set: void 0 - }; - var _foo7 = /*#__PURE__*/ new WeakMap(); - // Error - var A_Getter_StaticSetter = function A_Getter_StaticSetter() { - "use strict"; - _class_call_check(this, A_Getter_StaticSetter); - _class_private_field_init(this, _foo7, { - get: get_foo7, - set: void 0 - }); - }; - var _foo7 = { - get: void 0, - set: set_foo1 - }; -} -function Setter() { - var set_foo = function set_foo(value) {}; - var set_foo1 = function set_foo1(value) {}; - var foo = function foo() {}; - var set_foo2 = function set_foo2(value) {}; - var get_foo = function get_foo() { - return ""; - }; - var set_foo3 = function set_foo3(value) {}; - var set_foo3 = function set_foo3(value) {}; - var set_foo4 = function set_foo4(value) {}; - var set_foo5 = function set_foo5(value) {}; - var foo1 = function foo1() {}; - var set_foo6 = function set_foo6(value) {}; - var get_foo1 = function get_foo1() { - return ""; - }; - var set_foo7 = function set_foo7(value) {}; - var set_foo7 = function set_foo7(value) {}; - var _foo = /*#__PURE__*/ new WeakMap(), _foo = /*#__PURE__*/ new WeakMap(); - // Error - var A_Setter_Field = function A_Setter_Field() { - "use strict"; - _class_call_check(this, A_Setter_Field); - _class_private_field_init(this, _foo, { - get: void 0, - set: set_foo - }); - _class_private_field_init(this, _foo, { - writable: true, - value: "foo" - }); - }; - var _foo1 = /*#__PURE__*/ new WeakMap(), _foo1 = /*#__PURE__*/ new WeakSet(); - // Error - var A_Setter_Method = function A_Setter_Method() { - "use strict"; - _class_call_check(this, A_Setter_Method); - _class_private_field_init(this, _foo1, { - get: void 0, - set: set_foo1 - }); - _class_private_method_init(this, _foo1); - }; - var _foo2 = /*#__PURE__*/ new WeakMap(); - // OK - var A_Setter_Getter = function A_Setter_Getter() { - "use strict"; - _class_call_check(this, A_Setter_Getter); - _class_private_field_init(this, _foo2, { - get: get_foo, - set: set_foo2 - }); - }; - var _foo3 = /*#__PURE__*/ new WeakMap(); - // Error - var A_Setter_Setter = function A_Setter_Setter() { - "use strict"; - _class_call_check(this, A_Setter_Setter); - _class_private_field_init(this, _foo3, { - get: void 0, - set: set_foo3 - }); - }; - var _foo4 = /*#__PURE__*/ new WeakMap(); - // Error - var A_Setter_StaticField = function A_Setter_StaticField() { - "use strict"; - _class_call_check(this, A_Setter_StaticField); - _class_private_field_init(this, _foo4, { - get: void 0, - set: set_foo4 - }); - }; - var _foo4 = { - writable: true, - value: "foo" - }; - var _foo5 = /*#__PURE__*/ new WeakMap(); - // Error - var A_Setter_StaticMethod = function A_Setter_StaticMethod() { - "use strict"; - _class_call_check(this, A_Setter_StaticMethod); - _class_private_field_init(this, _foo5, { - get: void 0, - set: set_foo5 - }); - }; - var _foo6 = /*#__PURE__*/ new WeakMap(); - // Error - var A_Setter_StaticGetter = function A_Setter_StaticGetter() { - "use strict"; - _class_call_check(this, A_Setter_StaticGetter); - _class_private_field_init(this, _foo6, { - get: void 0, - set: set_foo6 - }); - }; - var _foo6 = { - get: get_foo1, - set: void 0 - }; - var _foo7 = /*#__PURE__*/ new WeakMap(); - // Error - var A_Setter_StaticSetter = function A_Setter_StaticSetter() { - "use strict"; - _class_call_check(this, A_Setter_StaticSetter); - _class_private_field_init(this, _foo7, { - get: void 0, - set: set_foo7 - }); - }; - var _foo7 = { - get: void 0, - set: set_foo7 - }; -} -function StaticField() { - var foo = function foo() {}; - var get_foo = function get_foo() { - return ""; - }; - var set_foo = function set_foo(value) {}; - var foo1 = function foo1() {}; - var get_foo1 = function get_foo1() { - return ""; - }; - var set_foo1 = function set_foo1(value) {}; - var _foo = /*#__PURE__*/ new WeakMap(); - // Error - var A_StaticField_Field = function A_StaticField_Field() { - "use strict"; - _class_call_check(this, A_StaticField_Field); - _class_private_field_init(this, _foo, { - writable: true, - value: "foo" - }); - }; - var _foo = { - writable: true, - value: "foo" - }; - var _foo1 = /*#__PURE__*/ new WeakSet(); - // Error - var A_StaticField_Method = function A_StaticField_Method() { - "use strict"; - _class_call_check(this, A_StaticField_Method); - _class_private_method_init(this, _foo1); - }; - var _foo1 = { - writable: true, - value: "foo" - }; - var _foo2 = /*#__PURE__*/ new WeakMap(); - // Error - var A_StaticField_Getter = function A_StaticField_Getter() { - "use strict"; - _class_call_check(this, A_StaticField_Getter); - _class_private_field_init(this, _foo2, { - get: get_foo, - set: void 0 - }); - }; - var _foo2 = { - writable: true, - value: "foo" - }; - var _foo3 = /*#__PURE__*/ new WeakMap(); - // Error - var A_StaticField_Setter = function A_StaticField_Setter() { - "use strict"; - _class_call_check(this, A_StaticField_Setter); - _class_private_field_init(this, _foo3, { - get: void 0, - set: set_foo - }); - }; - var _foo3 = { - writable: true, - value: "foo" - }; - // Error - var A_StaticField_StaticField = function A_StaticField_StaticField() { - "use strict"; - _class_call_check(this, A_StaticField_StaticField); - }; - var _foo4 = { - writable: true, - value: "foo" - }; - var _foo4 = { - writable: true, - value: "foo" - }; - // Error - var A_StaticField_StaticMethod = function A_StaticField_StaticMethod() { - "use strict"; - _class_call_check(this, A_StaticField_StaticMethod); - }; - var _foo5 = { - writable: true, - value: "foo" - }; - // Error - var A_StaticField_StaticGetter = function A_StaticField_StaticGetter() { - "use strict"; - _class_call_check(this, A_StaticField_StaticGetter); - }; - var _foo6 = { - get: get_foo1, - set: void 0 - }; - var _foo6 = { - writable: true, - value: "foo" - }; - // Error - var A_StaticField_StaticSetter = function A_StaticField_StaticSetter() { - "use strict"; - _class_call_check(this, A_StaticField_StaticSetter); - }; - var _foo7 = { - get: void 0, - set: set_foo1 - }; - var _foo7 = { - writable: true, - value: "foo" - }; -} -function StaticMethod() { - var foo = function foo() {}; - var foo1 = function foo1() {}; - var foo1 = function foo1() {}; - var foo2 = function foo2() {}; - var get_foo = function get_foo() { - return ""; - }; - var foo3 = function foo3() {}; - var set_foo = function set_foo(value) {}; - var foo4 = function foo4() {}; - var foo5 = function foo5() {}; - var foo5 = function foo5() {}; - var foo6 = function foo6() {}; - var get_foo1 = function get_foo1() { - return ""; - }; - var foo7 = function foo7() {}; - var set_foo1 = function set_foo1(value) {}; - var _foo = /*#__PURE__*/ new WeakMap(); - // Error - var A_StaticMethod_Field = function A_StaticMethod_Field() { - "use strict"; - _class_call_check(this, A_StaticMethod_Field); - _class_private_field_init(this, _foo, { - writable: true, - value: "foo" - }); - }; - var _foo1 = /*#__PURE__*/ new WeakSet(); - // Error - var A_StaticMethod_Method = function A_StaticMethod_Method() { - "use strict"; - _class_call_check(this, A_StaticMethod_Method); - _class_private_method_init(this, _foo1); - }; - var _foo2 = /*#__PURE__*/ new WeakMap(); - // Error - var A_StaticMethod_Getter = function A_StaticMethod_Getter() { - "use strict"; - _class_call_check(this, A_StaticMethod_Getter); - _class_private_field_init(this, _foo2, { - get: get_foo, - set: void 0 - }); - }; - var _foo3 = /*#__PURE__*/ new WeakMap(); - // Error - var A_StaticMethod_Setter = function A_StaticMethod_Setter() { - "use strict"; - _class_call_check(this, A_StaticMethod_Setter); - _class_private_field_init(this, _foo3, { - get: void 0, - set: set_foo - }); - }; - // Error - var A_StaticMethod_StaticField = function A_StaticMethod_StaticField() { - "use strict"; - _class_call_check(this, A_StaticMethod_StaticField); - }; - var _foo4 = { - writable: true, - value: "foo" - }; - // Error - var A_StaticMethod_StaticMethod = function A_StaticMethod_StaticMethod() { - "use strict"; - _class_call_check(this, A_StaticMethod_StaticMethod); - }; - // Error - var A_StaticMethod_StaticGetter = function A_StaticMethod_StaticGetter() { - "use strict"; - _class_call_check(this, A_StaticMethod_StaticGetter); - }; - var _foo5 = { - get: get_foo1, - set: void 0 - }; - // Error - var A_StaticMethod_StaticSetter = function A_StaticMethod_StaticSetter() { - "use strict"; - _class_call_check(this, A_StaticMethod_StaticSetter); - }; - var _foo6 = { - get: void 0, - set: set_foo1 - }; -} -function StaticGetter() { - var get_foo = function get_foo() { - return ""; - }; - var get_foo1 = function get_foo1() { - return ""; - }; - var foo = function foo() {}; - var get_foo2 = function get_foo2() { - return ""; - }; - var get_foo2 = function get_foo2() { - return ""; - }; - var get_foo3 = function get_foo3() { - return ""; - }; - var set_foo = function set_foo(value) {}; - var get_foo4 = function get_foo4() { - return ""; - }; - var foo1 = function foo1() {}; - var get_foo5 = function get_foo5() { - return ""; - }; - var foo2 = function foo2() {}; - var get_foo6 = function get_foo6() { - return ""; - }; - var get_foo6 = function get_foo6() { - return ""; - }; - var get_foo7 = function get_foo7() { - return ""; - }; - var set_foo1 = function set_foo1(value) {}; - var _foo = /*#__PURE__*/ new WeakMap(); - // Error - var A_StaticGetter_Field = function A_StaticGetter_Field() { - "use strict"; - _class_call_check(this, A_StaticGetter_Field); - _class_private_field_init(this, _foo, { - writable: true, - value: "foo" - }); - }; - var _foo = { - get: get_foo, - set: void 0 - }; - var _foo1 = /*#__PURE__*/ new WeakSet(); - // Error - var A_StaticGetter_Method = function A_StaticGetter_Method() { - "use strict"; - _class_call_check(this, A_StaticGetter_Method); - _class_private_method_init(this, _foo1); - }; - var _foo1 = { - get: get_foo1, - set: void 0 - }; - var _foo2 = /*#__PURE__*/ new WeakMap(); - // Error - var A_StaticGetter_Getter = function A_StaticGetter_Getter() { - "use strict"; - _class_call_check(this, A_StaticGetter_Getter); - _class_private_field_init(this, _foo2, { - get: get_foo2, - set: void 0 - }); - }; - var _foo2 = { - get: get_foo2, - set: void 0 - }; - var _foo3 = /*#__PURE__*/ new WeakMap(); - // Error - var A_StaticGetter_Setter = function A_StaticGetter_Setter() { - "use strict"; - _class_call_check(this, A_StaticGetter_Setter); - _class_private_field_init(this, _foo3, { - get: void 0, - set: set_foo - }); - }; - var _foo3 = { - get: get_foo3, - set: void 0 - }; - // Error - var A_StaticGetter_StaticField = function A_StaticGetter_StaticField() { - "use strict"; - _class_call_check(this, A_StaticGetter_StaticField); - }; - var _foo4 = { - get: get_foo4, - set: void 0 - }; - // Error - var A_StaticGetter_StaticMethod = function A_StaticGetter_StaticMethod() { - "use strict"; - _class_call_check(this, A_StaticGetter_StaticMethod); - }; - var _foo5 = { - get: get_foo5, - set: void 0 - }; - // Error - var A_StaticGetter_StaticGetter = function A_StaticGetter_StaticGetter() { - "use strict"; - _class_call_check(this, A_StaticGetter_StaticGetter); - }; - var _foo6 = { - get: get_foo6, - set: void 0 - }; - // OK - var A_StaticGetter_StaticSetter = function A_StaticGetter_StaticSetter() { - "use strict"; - _class_call_check(this, A_StaticGetter_StaticSetter); - }; - var _foo7 = { - get: get_foo7, - set: set_foo1 - }; -} -function StaticSetter() { - var set_foo = function set_foo(value) {}; - var set_foo1 = function set_foo1(value) {}; - var foo = function foo() {}; - var set_foo2 = function set_foo2(value) {}; - var get_foo = function get_foo() { - return ""; - }; - var set_foo3 = function set_foo3(value) {}; - var set_foo3 = function set_foo3(value) {}; - var set_foo4 = function set_foo4(value) {}; - var set_foo5 = function set_foo5(value) {}; - var foo1 = function foo1() {}; - var set_foo6 = function set_foo6(value) {}; - var get_foo1 = function get_foo1() { - return ""; - }; - var set_foo7 = function set_foo7(value) {}; - var set_foo7 = function set_foo7(value) {}; - var _foo = /*#__PURE__*/ new WeakMap(); - // Error - var A_StaticSetter_Field = function A_StaticSetter_Field() { - "use strict"; - _class_call_check(this, A_StaticSetter_Field); - _class_private_field_init(this, _foo, { - writable: true, - value: "foo" - }); - }; - var _foo = { - get: void 0, - set: set_foo - }; - var _foo1 = /*#__PURE__*/ new WeakSet(); - // Error - var A_StaticSetter_Method = function A_StaticSetter_Method() { - "use strict"; - _class_call_check(this, A_StaticSetter_Method); - _class_private_method_init(this, _foo1); - }; - var _foo1 = { - get: void 0, - set: set_foo1 - }; - var _foo2 = /*#__PURE__*/ new WeakMap(); - // Error - var A_StaticSetter_Getter = function A_StaticSetter_Getter() { - "use strict"; - _class_call_check(this, A_StaticSetter_Getter); - _class_private_field_init(this, _foo2, { - get: get_foo, - set: void 0 - }); - }; - var _foo2 = { - get: void 0, - set: set_foo2 - }; - var _foo3 = /*#__PURE__*/ new WeakMap(); - // Error - var A_StaticSetter_Setter = function A_StaticSetter_Setter() { - "use strict"; - _class_call_check(this, A_StaticSetter_Setter); - _class_private_field_init(this, _foo3, { - get: void 0, - set: set_foo3 - }); - }; - var _foo3 = { - get: void 0, - set: set_foo3 - }; - // Error - var A_StaticSetter_StaticField = function A_StaticSetter_StaticField() { - "use strict"; - _class_call_check(this, A_StaticSetter_StaticField); - }; - var _foo4 = { - get: void 0, - set: set_foo4 - }; - var _foo4 = { - writable: true, - value: "foo" - }; - // Error - var A_StaticSetter_StaticMethod = function A_StaticSetter_StaticMethod() { - "use strict"; - _class_call_check(this, A_StaticSetter_StaticMethod); - }; - var _foo5 = { - get: void 0, - set: set_foo5 - }; - // OK - var A_StaticSetter_StaticGetter = function A_StaticSetter_StaticGetter() { - "use strict"; - _class_call_check(this, A_StaticSetter_StaticGetter); - }; - var _foo6 = { - get: get_foo1, - set: set_foo6 - }; - // Error - var A_StaticSetter_StaticSetter = function A_StaticSetter_StaticSetter() { - "use strict"; - _class_call_check(this, A_StaticSetter_StaticSetter); - }; - var _foo7 = { - get: void 0, - set: set_foo7 - }; -} +//! +//! x duplicate private name #foo. +//! ,---- +//! 9 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 15 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 21 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 27 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 33 | static #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 39 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 45 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 51 | static set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 59 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 65 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 71 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 77 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 83 | static #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 89 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 95 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 101 | static set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 110 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 116 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 122 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 134 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 140 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 146 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 152 | static set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 160 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 166 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 178 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 184 | static #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 190 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 196 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 202 | static set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 210 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 216 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 222 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 228 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 234 | static #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 240 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 246 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 252 | static set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 260 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 266 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 272 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 278 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 284 | static #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 290 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 296 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 302 | static set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 311 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 317 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 323 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 329 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 335 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 341 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 347 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 360 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 366 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 373 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 379 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 385 | static #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 391 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 403 | static set #foo(value: string) { } +//! : ^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/privateNameDuplicateField_es5.2.minified.js b/crates/swc/tests/tsc-references/privateNameDuplicateField_es5.2.minified.js index 237b7aec440d..f656bd3e63ae 100644 --- a/crates/swc/tests/tsc-references/privateNameDuplicateField_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNameDuplicateField_es5.2.minified.js @@ -1,3 +1,360 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _class_private_field_init from "@swc/helpers/src/_class_private_field_init.mjs"; -import _class_private_method_init from "@swc/helpers/src/_class_private_method_init.mjs"; +//! +//! x duplicate private name #foo. +//! ,---- +//! 9 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 15 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 21 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 27 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 33 | static #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 39 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 45 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 51 | static set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 59 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 65 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 71 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 77 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 83 | static #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 89 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 95 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 101 | static set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 110 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 116 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 122 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 134 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 140 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 146 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 152 | static set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 160 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 166 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 178 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 184 | static #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 190 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 196 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 202 | static set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 210 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 216 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 222 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 228 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 234 | static #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 240 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 246 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 252 | static set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 260 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 266 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 272 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 278 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 284 | static #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 290 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 296 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 302 | static set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 311 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 317 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 323 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 329 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 335 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 341 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 347 | static get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 360 | #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 366 | #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 373 | get #foo() { return ""} +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 379 | set #foo(value: string) { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 385 | static #foo = "foo"; +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 391 | static #foo() { } +//! : ^^^ +//! `---- +//! +//! x duplicate private name #foo. +//! ,---- +//! 403 | static set #foo(value: string) { } +//! : ^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/privateNameEmitHelpers_es2015.1.normal.js b/crates/swc/tests/tsc-references/privateNameEmitHelpers_es2015.1.normal.js index 47db35bb23ad..6e5359e9fb89 100644 --- a/crates/swc/tests/tsc-references/privateNameEmitHelpers_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/privateNameEmitHelpers_es2015.1.normal.js @@ -26,3 +26,6 @@ function b() { function set_c(v) { _class_private_field_set(this, _a, _class_private_field_get(this, _a) + v); } +// @filename: tslib.d.ts +// these are pre-TS4.3 versions of emit helpers, which only supported private instance fields +export { }; diff --git a/crates/swc/tests/tsc-references/privateNameEmitHelpers_es2015.2.minified.js b/crates/swc/tests/tsc-references/privateNameEmitHelpers_es2015.2.minified.js index 4c15e7021fc4..99db1b5edf9b 100644 --- a/crates/swc/tests/tsc-references/privateNameEmitHelpers_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNameEmitHelpers_es2015.2.minified.js @@ -16,3 +16,4 @@ export class C { }); } } +export { }; diff --git a/crates/swc/tests/tsc-references/privateNameEmitHelpers_es5.1.normal.js b/crates/swc/tests/tsc-references/privateNameEmitHelpers_es5.1.normal.js index b652cc200d0e..9c2f54fedbc6 100644 --- a/crates/swc/tests/tsc-references/privateNameEmitHelpers_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/privateNameEmitHelpers_es5.1.normal.js @@ -27,3 +27,6 @@ function b() { function set_c(v) { _class_private_field_set(this, _a, _class_private_field_get(this, _a) + v); } +// @filename: tslib.d.ts +// these are pre-TS4.3 versions of emit helpers, which only supported private instance fields +export { }; diff --git a/crates/swc/tests/tsc-references/privateNameEmitHelpers_es5.2.minified.js b/crates/swc/tests/tsc-references/privateNameEmitHelpers_es5.2.minified.js index 70a041317118..8656b25f937e 100644 --- a/crates/swc/tests/tsc-references/privateNameEmitHelpers_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNameEmitHelpers_es5.2.minified.js @@ -17,3 +17,4 @@ export var C = function() { function set_c(v) { _class_private_field_set(this, _a, _class_private_field_get(this, _a) + v); } +export { }; diff --git a/crates/swc/tests/tsc-references/privateNameStaticEmitHelpers_es2015.1.normal.js b/crates/swc/tests/tsc-references/privateNameStaticEmitHelpers_es2015.1.normal.js index b301507c82be..768b44aa8a73 100644 --- a/crates/swc/tests/tsc-references/privateNameStaticEmitHelpers_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/privateNameStaticEmitHelpers_es2015.1.normal.js @@ -20,3 +20,6 @@ function b() { function get_c() { return _class_static_private_method_get(S, S, b).call(S); } +// @filename: tslib.d.ts +// these are pre-TS4.3 versions of emit helpers, which only supported private instance fields +export { }; diff --git a/crates/swc/tests/tsc-references/privateNameStaticEmitHelpers_es2015.2.minified.js b/crates/swc/tests/tsc-references/privateNameStaticEmitHelpers_es2015.2.minified.js index 8d3fe9e981f0..1fdcc8e1b2d1 100644 --- a/crates/swc/tests/tsc-references/privateNameStaticEmitHelpers_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNameStaticEmitHelpers_es2015.2.minified.js @@ -2,3 +2,4 @@ import _class_static_private_field_spec_set from "@swc/helpers/src/_class_static import _class_static_private_method_get from "@swc/helpers/src/_class_static_private_method_get.mjs"; export class S { } +export { }; diff --git a/crates/swc/tests/tsc-references/privateNameStaticEmitHelpers_es5.1.normal.js b/crates/swc/tests/tsc-references/privateNameStaticEmitHelpers_es5.1.normal.js index a7cd0848b8ed..abbe0031ae4b 100644 --- a/crates/swc/tests/tsc-references/privateNameStaticEmitHelpers_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/privateNameStaticEmitHelpers_es5.1.normal.js @@ -23,3 +23,6 @@ function b() { function get_c() { return _class_static_private_method_get(S, S, b).call(S); } +// @filename: tslib.d.ts +// these are pre-TS4.3 versions of emit helpers, which only supported private instance fields +export { }; diff --git a/crates/swc/tests/tsc-references/privateNameStaticEmitHelpers_es5.2.minified.js b/crates/swc/tests/tsc-references/privateNameStaticEmitHelpers_es5.2.minified.js index 5184cc60a527..7845c48cec0b 100644 --- a/crates/swc/tests/tsc-references/privateNameStaticEmitHelpers_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNameStaticEmitHelpers_es5.2.minified.js @@ -5,3 +5,4 @@ export var S = function() { "use strict"; _class_call_check(this, S); }; +export { }; diff --git a/crates/swc/tests/tsc-references/privateNamesUnique-2_es2015.1.normal.js b/crates/swc/tests/tsc-references/privateNamesUnique-2_es2015.1.normal.js index 8664b247f904..df1c373d4721 100644 --- a/crates/swc/tests/tsc-references/privateNamesUnique-2_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/privateNamesUnique-2_es2015.1.normal.js @@ -14,11 +14,12 @@ export class Foo { }); } } -var _x1 = /*#__PURE__*/ new WeakMap(); // @filename: b.ts +import _class_private_field_init from "@swc/helpers/src/_class_private_field_init.mjs"; +var _x = /*#__PURE__*/ new WeakMap(); export class Foo { constructor(){ - _class_private_field_init(this, _x1, { + _class_private_field_init(this, _x, { writable: true, value: void 0 }); diff --git a/crates/swc/tests/tsc-references/privateNamesUnique-2_es2015.2.minified.js b/crates/swc/tests/tsc-references/privateNamesUnique-2_es2015.2.minified.js index eb1500809474..9972a8425b65 100644 --- a/crates/swc/tests/tsc-references/privateNamesUnique-2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNamesUnique-2_es2015.2.minified.js @@ -12,10 +12,11 @@ export class Foo { }); } } -var _x1 = new WeakMap(); +import _class_private_field_init from "@swc/helpers/src/_class_private_field_init.mjs"; +var _x = new WeakMap(); export class Foo { constructor(){ - _class_private_field_init(this, _x1, { + _class_private_field_init(this, _x, { writable: !0, value: void 0 }); diff --git a/crates/swc/tests/tsc-references/privateNamesUnique-2_es5.1.normal.js b/crates/swc/tests/tsc-references/privateNamesUnique-2_es5.1.normal.js index 1f46a139a4a4..19d83e884dd0 100644 --- a/crates/swc/tests/tsc-references/privateNamesUnique-2_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/privateNamesUnique-2_es5.1.normal.js @@ -19,12 +19,14 @@ export var Foo = /*#__PURE__*/ function() { }; return Foo; }(); -var _x1 = /*#__PURE__*/ new WeakMap(); // @filename: b.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _class_private_field_init from "@swc/helpers/src/_class_private_field_init.mjs"; +var _x = /*#__PURE__*/ new WeakMap(); export var Foo = function Foo() { "use strict"; _class_call_check(this, Foo); - _class_private_field_init(this, _x1, { + _class_private_field_init(this, _x, { writable: true, value: void 0 }); diff --git a/crates/swc/tests/tsc-references/privateNamesUnique-2_es5.2.minified.js b/crates/swc/tests/tsc-references/privateNamesUnique-2_es5.2.minified.js index c4b5f4abf79f..4f6310f57d15 100644 --- a/crates/swc/tests/tsc-references/privateNamesUnique-2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNamesUnique-2_es5.2.minified.js @@ -14,10 +14,12 @@ export var Foo = function() { _class_private_field_get(other, _x); }, Foo; }(); -var _x1 = new WeakMap(); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _class_private_field_init from "@swc/helpers/src/_class_private_field_init.mjs"; +var _x = new WeakMap(); export var Foo = function() { "use strict"; - _class_call_check(this, Foo), _class_private_field_init(this, _x1, { + _class_call_check(this, Foo), _class_private_field_init(this, _x, { writable: !0, value: void 0 }); diff --git a/crates/swc/tests/tsc-references/privateNamesUnique-3_es2015.1.normal.js b/crates/swc/tests/tsc-references/privateNamesUnique-3_es2015.1.normal.js index 02f4a42c25cc..b6ab4f1d4efc 100644 --- a/crates/swc/tests/tsc-references/privateNamesUnique-3_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/privateNamesUnique-3_es2015.1.normal.js @@ -1,26 +1,6 @@ -// @target: es2015 -import _class_private_field_init from "@swc/helpers/src/_class_private_field_init.mjs"; -import _class_static_private_field_spec_get from "@swc/helpers/src/_class_static_private_field_spec_get.mjs"; -var _foo = /*#__PURE__*/ new WeakMap(); -class A { - constructor(){ - _class_private_field_init(this, _foo, { - writable: true, - value: 1 - }); - } -} -var _foo = { - writable: true, - value: true -}// error (duplicate) -; -class B { - test(x) { - _class_static_private_field_spec_get(x, B, _foo1); // error (#foo is a static property on B, not an instance property) - } -} -var _foo1 = { - writable: true, - value: true -}; +//! +//! x duplicate private name #foo. +//! ,---- +//! 5 | static #foo = true; // error (duplicate) +//! : ^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/privateNamesUnique-3_es2015.2.minified.js b/crates/swc/tests/tsc-references/privateNamesUnique-3_es2015.2.minified.js index 88eb8092624a..b6ab4f1d4efc 100644 --- a/crates/swc/tests/tsc-references/privateNamesUnique-3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNamesUnique-3_es2015.2.minified.js @@ -1,11 +1,6 @@ -import _class_private_field_init from "@swc/helpers/src/_class_private_field_init.mjs"; -import _class_static_private_field_spec_get from "@swc/helpers/src/_class_static_private_field_spec_get.mjs"; -class B { - test(x) { - _class_static_private_field_spec_get(x, B, _foo); - } -} -var _foo = { - writable: !0, - value: !0 -}; +//! +//! x duplicate private name #foo. +//! ,---- +//! 5 | static #foo = true; // error (duplicate) +//! : ^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/privateNamesUnique-3_es5.1.normal.js b/crates/swc/tests/tsc-references/privateNamesUnique-3_es5.1.normal.js index 0797ea97acfc..b6ab4f1d4efc 100644 --- a/crates/swc/tests/tsc-references/privateNamesUnique-3_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/privateNamesUnique-3_es5.1.normal.js @@ -1,33 +1,6 @@ -// @target: es2015 -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _class_private_field_init from "@swc/helpers/src/_class_private_field_init.mjs"; -import _class_static_private_field_spec_get from "@swc/helpers/src/_class_static_private_field_spec_get.mjs"; -var _foo = /*#__PURE__*/ new WeakMap(); -var A = function A() { - "use strict"; - _class_call_check(this, A); - _class_private_field_init(this, _foo, { - writable: true, - value: 1 - }); -}; -var _foo = { - writable: true, - value: true -}// error (duplicate) -; -var B = /*#__PURE__*/ function() { - "use strict"; - function B() { - _class_call_check(this, B); - } - var _proto = B.prototype; - _proto.test = function test(x) { - _class_static_private_field_spec_get(x, B, _foo1); // error (#foo is a static property on B, not an instance property) - }; - return B; -}(); -var _foo1 = { - writable: true, - value: true -}; +//! +//! x duplicate private name #foo. +//! ,---- +//! 5 | static #foo = true; // error (duplicate) +//! : ^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/privateNamesUnique-3_es5.2.minified.js b/crates/swc/tests/tsc-references/privateNamesUnique-3_es5.2.minified.js index aea06fbc82be..b6ab4f1d4efc 100644 --- a/crates/swc/tests/tsc-references/privateNamesUnique-3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNamesUnique-3_es5.2.minified.js @@ -1,24 +1,6 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _class_private_field_init from "@swc/helpers/src/_class_private_field_init.mjs"; -import _class_static_private_field_spec_get from "@swc/helpers/src/_class_static_private_field_spec_get.mjs"; -var _foo = new WeakMap(), A = function() { - "use strict"; - _class_call_check(this, A), _class_private_field_init(this, _foo, { - writable: !0, - value: 1 - }); -}, _foo = { - writable: !0, - value: !0 -}, B = function() { - "use strict"; - function B() { - _class_call_check(this, B); - } - return B.prototype.test = function(x) { - _class_static_private_field_spec_get(x, B, _foo1); - }, B; -}(), _foo1 = { - writable: !0, - value: !0 -}; +//! +//! x duplicate private name #foo. +//! ,---- +//! 5 | static #foo = true; // error (duplicate) +//! : ^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/propertyAssignmentOnImportedSymbol_es2015.1.normal.js b/crates/swc/tests/tsc-references/propertyAssignmentOnImportedSymbol_es2015.1.normal.js index dba399ea5d03..0f0e0b77733c 100644 --- a/crates/swc/tests/tsc-references/propertyAssignmentOnImportedSymbol_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/propertyAssignmentOnImportedSymbol_es2015.1.normal.js @@ -3,4 +3,6 @@ // @noEmit: true // @Filename: mod1.js export var hurk = {}; +// @Filename: bug24658.js +import { hurk } from './mod1'; hurk.expando = 4; diff --git a/crates/swc/tests/tsc-references/propertyAssignmentOnImportedSymbol_es2015.2.minified.js b/crates/swc/tests/tsc-references/propertyAssignmentOnImportedSymbol_es2015.2.minified.js index 57a3cb206578..bc19fd104a02 100644 --- a/crates/swc/tests/tsc-references/propertyAssignmentOnImportedSymbol_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/propertyAssignmentOnImportedSymbol_es2015.2.minified.js @@ -1,2 +1,3 @@ export var hurk = {}; +import { hurk } from './mod1'; hurk.expando = 4; diff --git a/crates/swc/tests/tsc-references/propertyAssignmentOnImportedSymbol_es5.1.normal.js b/crates/swc/tests/tsc-references/propertyAssignmentOnImportedSymbol_es5.1.normal.js index dba399ea5d03..b6bf505c516e 100644 --- a/crates/swc/tests/tsc-references/propertyAssignmentOnImportedSymbol_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/propertyAssignmentOnImportedSymbol_es5.1.normal.js @@ -3,4 +3,6 @@ // @noEmit: true // @Filename: mod1.js export var hurk = {}; +// @Filename: bug24658.js +import { hurk } from "./mod1"; hurk.expando = 4; diff --git a/crates/swc/tests/tsc-references/propertyAssignmentOnImportedSymbol_es5.2.minified.js b/crates/swc/tests/tsc-references/propertyAssignmentOnImportedSymbol_es5.2.minified.js index 57a3cb206578..019956a8220b 100644 --- a/crates/swc/tests/tsc-references/propertyAssignmentOnImportedSymbol_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/propertyAssignmentOnImportedSymbol_es5.2.minified.js @@ -1,2 +1,3 @@ export var hurk = {}; +import { hurk } from "./mod1"; hurk.expando = 4; diff --git a/crates/swc/tests/tsc-references/prototypePropertyAssignmentMergeAcrossFiles2_es2015.2.minified.js b/crates/swc/tests/tsc-references/prototypePropertyAssignmentMergeAcrossFiles2_es2015.2.minified.js index 599b69ed23b2..955e38226124 100644 --- a/crates/swc/tests/tsc-references/prototypePropertyAssignmentMergeAcrossFiles2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/prototypePropertyAssignmentMergeAcrossFiles2_es2015.2.minified.js @@ -1,4 +1,6 @@ -var one, two, Ns = {}; +var Ns = {}; Ns.One = function() {}, Ns.Two = function() {}, Ns.One.prototype = { ok () {} -}, Ns.Two.prototype = {}, one.wat, two.wat; +}, Ns.Two.prototype = {}; +var two; +(void 0).wat, two.wat; diff --git a/crates/swc/tests/tsc-references/prototypePropertyAssignmentMergeAcrossFiles2_es5.2.minified.js b/crates/swc/tests/tsc-references/prototypePropertyAssignmentMergeAcrossFiles2_es5.2.minified.js index e235da296f18..c27f8b162184 100644 --- a/crates/swc/tests/tsc-references/prototypePropertyAssignmentMergeAcrossFiles2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/prototypePropertyAssignmentMergeAcrossFiles2_es5.2.minified.js @@ -1,4 +1,6 @@ -var one, two, Ns = {}; +var Ns = {}; Ns.One = function() {}, Ns.Two = function() {}, Ns.One.prototype = { ok: function() {} -}, Ns.Two.prototype = {}, one.wat, two.wat; +}, Ns.Two.prototype = {}; +var two; +(void 0).wat, two.wat; diff --git a/crates/swc/tests/tsc-references/prototypePropertyAssignmentMergeAcrossFiles_es2015.2.minified.js b/crates/swc/tests/tsc-references/prototypePropertyAssignmentMergeAcrossFiles_es2015.2.minified.js index 2877f0f36c14..55fcff781dde 100644 --- a/crates/swc/tests/tsc-references/prototypePropertyAssignmentMergeAcrossFiles_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/prototypePropertyAssignmentMergeAcrossFiles_es2015.2.minified.js @@ -1,5 +1,3 @@ -(function() { - this.a = 1; -}).prototype.foo = function() { +C.prototype.foo = function() { return this.a; }; diff --git a/crates/swc/tests/tsc-references/prototypePropertyAssignmentMergeAcrossFiles_es5.2.minified.js b/crates/swc/tests/tsc-references/prototypePropertyAssignmentMergeAcrossFiles_es5.2.minified.js index 2877f0f36c14..55fcff781dde 100644 --- a/crates/swc/tests/tsc-references/prototypePropertyAssignmentMergeAcrossFiles_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/prototypePropertyAssignmentMergeAcrossFiles_es5.2.minified.js @@ -1,5 +1,3 @@ -(function() { - this.a = 1; -}).prototype.foo = function() { +C.prototype.foo = function() { return this.a; }; diff --git a/crates/swc/tests/tsc-references/reExportDefaultExport_es2015.2.minified.js b/crates/swc/tests/tsc-references/reExportDefaultExport_es2015.2.minified.js index 5965858309be..019e7e1c7da1 100644 --- a/crates/swc/tests/tsc-references/reExportDefaultExport_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/reExportDefaultExport_es2015.2.minified.js @@ -1,5 +1,5 @@ export default function f() {}; +export { f }; import foo from "./m1"; import { f } from "./m1"; f(), foo(); -export { f }; diff --git a/crates/swc/tests/tsc-references/reExportDefaultExport_es5.2.minified.js b/crates/swc/tests/tsc-references/reExportDefaultExport_es5.2.minified.js index 5965858309be..019e7e1c7da1 100644 --- a/crates/swc/tests/tsc-references/reExportDefaultExport_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/reExportDefaultExport_es5.2.minified.js @@ -1,5 +1,5 @@ export default function f() {}; +export { f }; import foo from "./m1"; import { f } from "./m1"; f(), foo(); -export { f }; diff --git a/crates/swc/tests/tsc-references/readonlyInAmbientClass_es2015.1.normal.js b/crates/swc/tests/tsc-references/readonlyInAmbientClass_es2015.1.normal.js new file mode 100644 index 000000000000..edec5c16d2bb --- /dev/null +++ b/crates/swc/tests/tsc-references/readonlyInAmbientClass_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 2 | constructor(readonly x: number); +//! : ^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 3 | method(readonly x: number); +//! : ^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/readonlyInAmbientClass_es2015.2.minified.js b/crates/swc/tests/tsc-references/readonlyInAmbientClass_es2015.2.minified.js new file mode 100644 index 000000000000..edec5c16d2bb --- /dev/null +++ b/crates/swc/tests/tsc-references/readonlyInAmbientClass_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 2 | constructor(readonly x: number); +//! : ^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 3 | method(readonly x: number); +//! : ^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/readonlyInAmbientClass_es5.1.normal.js b/crates/swc/tests/tsc-references/readonlyInAmbientClass_es5.1.normal.js new file mode 100644 index 000000000000..edec5c16d2bb --- /dev/null +++ b/crates/swc/tests/tsc-references/readonlyInAmbientClass_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 2 | constructor(readonly x: number); +//! : ^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 3 | method(readonly x: number); +//! : ^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/readonlyInAmbientClass_es5.2.minified.js b/crates/swc/tests/tsc-references/readonlyInAmbientClass_es5.2.minified.js new file mode 100644 index 000000000000..edec5c16d2bb --- /dev/null +++ b/crates/swc/tests/tsc-references/readonlyInAmbientClass_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 2 | constructor(readonly x: number); +//! : ^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x A parameter property is only allowed in a constructor implementation +//! ,---- +//! 3 | method(readonly x: number); +//! : ^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/reexportClassDefinition_es2015.1.normal.js b/crates/swc/tests/tsc-references/reexportClassDefinition_es2015.1.normal.js index d2bcaa4ba909..bf516acc1103 100644 --- a/crates/swc/tests/tsc-references/reexportClassDefinition_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/reexportClassDefinition_es2015.1.normal.js @@ -2,11 +2,16 @@ // @Filename: foo1.ts class x { } +module.exports = x; +export { }; // @Filename: foo2.ts const foo1 = require('./foo1'); +module.exports = { + x: foo1 +}; +export { }; // @Filename: foo3.ts const foo2 = require('./foo2'); class x extends foo2.x { } -module.exports = x; export { }; diff --git a/crates/swc/tests/tsc-references/reexportClassDefinition_es2015.2.minified.js b/crates/swc/tests/tsc-references/reexportClassDefinition_es2015.2.minified.js index 229100316c86..3c0befcf023a 100644 --- a/crates/swc/tests/tsc-references/reexportClassDefinition_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/reexportClassDefinition_es2015.2.minified.js @@ -1,8 +1,12 @@ -class x { -} -require('./foo1'); +module.exports = class { +}; +export { }; +let foo1 = require('./foo1'); +module.exports = { + x: foo1 +}; +export { }; let foo2 = require('./foo2'); class x extends foo2.x { } -module.exports = x; export { }; diff --git a/crates/swc/tests/tsc-references/reexportClassDefinition_es5.1.normal.js b/crates/swc/tests/tsc-references/reexportClassDefinition_es5.1.normal.js index f79ec7413479..037150892623 100644 --- a/crates/swc/tests/tsc-references/reexportClassDefinition_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/reexportClassDefinition_es5.1.normal.js @@ -1,15 +1,22 @@ // @module: commonjs // @Filename: foo1.ts import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; var x = function x() { "use strict"; _class_call_check(this, x); }; +module.exports = x; +export { }; // @Filename: foo2.ts var foo1 = require("./foo1"); +module.exports = { + x: foo1 +}; +export { }; // @Filename: foo3.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var foo2 = require("./foo2"); var x = /*#__PURE__*/ function(_x) { "use strict"; @@ -21,5 +28,4 @@ var x = /*#__PURE__*/ function(_x) { } return x; }(foo2.x); -module.exports = x; export { }; diff --git a/crates/swc/tests/tsc-references/reexportClassDefinition_es5.2.minified.js b/crates/swc/tests/tsc-references/reexportClassDefinition_es5.2.minified.js index d64d4fc33092..314eb7fca673 100644 --- a/crates/swc/tests/tsc-references/reexportClassDefinition_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/reexportClassDefinition_es5.2.minified.js @@ -1,11 +1,17 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; var x = function() { "use strict"; _class_call_check(this, x); }; -require("./foo1"); +module.exports = x; +var foo1 = require("./foo1"); +module.exports = { + x: foo1 +}; +export { }; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var x = function(_x) { "use strict"; _inherits(x, _x); @@ -15,4 +21,3 @@ var x = function(_x) { } return x; }(require("./foo2").x); -module.exports = x; diff --git a/crates/swc/tests/tsc-references/relativePathMustResolve_es2015.1.normal.js b/crates/swc/tests/tsc-references/relativePathMustResolve_es2015.1.normal.js index 9164106117cf..baac536d440a 100644 --- a/crates/swc/tests/tsc-references/relativePathMustResolve_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/relativePathMustResolve_es2015.1.normal.js @@ -4,3 +4,4 @@ export var x = 42; // @Filename: foo_1.ts const foo = require('./test/foo'); var z = foo.x + 10; +export { }; diff --git a/crates/swc/tests/tsc-references/relativePathMustResolve_es2015.2.minified.js b/crates/swc/tests/tsc-references/relativePathMustResolve_es2015.2.minified.js index ceaf39816647..b4ffee0eec6b 100644 --- a/crates/swc/tests/tsc-references/relativePathMustResolve_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/relativePathMustResolve_es2015.2.minified.js @@ -1,3 +1,4 @@ export var x = 42; let foo = require('./test/foo'); foo.x; +export { }; diff --git a/crates/swc/tests/tsc-references/relativePathMustResolve_es5.1.normal.js b/crates/swc/tests/tsc-references/relativePathMustResolve_es5.1.normal.js index 07249a718d9d..7297d85e7953 100644 --- a/crates/swc/tests/tsc-references/relativePathMustResolve_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/relativePathMustResolve_es5.1.normal.js @@ -4,3 +4,4 @@ export var x = 42; // @Filename: foo_1.ts var foo = require("./test/foo"); var z = foo.x + 10; +export { }; diff --git a/crates/swc/tests/tsc-references/relativePathMustResolve_es5.2.minified.js b/crates/swc/tests/tsc-references/relativePathMustResolve_es5.2.minified.js index 75669317f557..622411847236 100644 --- a/crates/swc/tests/tsc-references/relativePathMustResolve_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/relativePathMustResolve_es5.2.minified.js @@ -1,2 +1,3 @@ export var x = 42; require("./test/foo").x; +export { }; diff --git a/crates/swc/tests/tsc-references/relativePathToDeclarationFile_es2015.1.normal.js b/crates/swc/tests/tsc-references/relativePathToDeclarationFile_es2015.1.normal.js index 4544552e9f10..4a2fcd19c1ce 100644 --- a/crates/swc/tests/tsc-references/relativePathToDeclarationFile_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/relativePathToDeclarationFile_es2015.1.normal.js @@ -1,5 +1,11 @@ // @ModuleResolution: classic // @Filename: test/foo.d.ts +export { }; +// @Filename: test/other.d.ts +export { }; +// @Filename: test/sub/relMod.d.ts +module.exports = Test; +export { }; // @Filename: test/file1.ts const foo = require('foo'); const other = require('./other'); @@ -7,5 +13,4 @@ const relMod = require('./sub/relMod'); if (foo.M2.x) { var x = new relMod(other.M2.x.charCodeAt(0)); } -module.exports = Test; export { }; diff --git a/crates/swc/tests/tsc-references/relativePathToDeclarationFile_es2015.2.minified.js b/crates/swc/tests/tsc-references/relativePathToDeclarationFile_es2015.2.minified.js index 0642445eee86..90183c9a844c 100644 --- a/crates/swc/tests/tsc-references/relativePathToDeclarationFile_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/relativePathToDeclarationFile_es2015.2.minified.js @@ -1,3 +1,7 @@ +export { }; +export { }; +module.exports = Test; +export { }; let foo = require('foo'), other = require('./other'), relMod = require('./sub/relMod'); -foo.M2.x && new relMod(other.M2.x.charCodeAt(0)), module.exports = Test; +foo.M2.x && new relMod(other.M2.x.charCodeAt(0)); export { }; diff --git a/crates/swc/tests/tsc-references/relativePathToDeclarationFile_es5.1.normal.js b/crates/swc/tests/tsc-references/relativePathToDeclarationFile_es5.1.normal.js index 569f90c9a6ad..0ac0b0d19b63 100644 --- a/crates/swc/tests/tsc-references/relativePathToDeclarationFile_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/relativePathToDeclarationFile_es5.1.normal.js @@ -1,5 +1,11 @@ // @ModuleResolution: classic // @Filename: test/foo.d.ts +export { }; +// @Filename: test/other.d.ts +export { }; +// @Filename: test/sub/relMod.d.ts +module.exports = Test; +export { }; // @Filename: test/file1.ts var foo = require("foo"); var other = require("./other"); @@ -7,5 +13,4 @@ var relMod = require("./sub/relMod"); if (foo.M2.x) { var x = new relMod(other.M2.x.charCodeAt(0)); } -module.exports = Test; export { }; diff --git a/crates/swc/tests/tsc-references/relativePathToDeclarationFile_es5.2.minified.js b/crates/swc/tests/tsc-references/relativePathToDeclarationFile_es5.2.minified.js index 235e27405d8c..fc715129fffe 100644 --- a/crates/swc/tests/tsc-references/relativePathToDeclarationFile_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/relativePathToDeclarationFile_es5.2.minified.js @@ -1,3 +1,7 @@ +export { }; +export { }; +module.exports = Test; +export { }; var foo = require("foo"), other = require("./other"), relMod = require("./sub/relMod"); -foo.M2.x && new relMod(other.M2.x.charCodeAt(0)), module.exports = Test; +foo.M2.x && new relMod(other.M2.x.charCodeAt(0)); export { }; diff --git a/crates/swc/tests/tsc-references/renamed_es2015.1.normal.js b/crates/swc/tests/tsc-references/renamed_es2015.1.normal.js index d8e1708a3286..f446d0d7f375 100644 --- a/crates/swc/tests/tsc-references/renamed_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/renamed_es2015.1.normal.js @@ -2,5 +2,9 @@ // @Filename: /a.ts class A { } +export { }; +// @Filename: /b.ts +export { }; +// @Filename: /c.ts const d = {}; export { }; diff --git a/crates/swc/tests/tsc-references/renamed_es2015.2.minified.js b/crates/swc/tests/tsc-references/renamed_es2015.2.minified.js index 2234b9cae16d..f109f4c5600e 100644 --- a/crates/swc/tests/tsc-references/renamed_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/renamed_es2015.2.minified.js @@ -1 +1,3 @@ export { }; +export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/renamed_es5.1.normal.js b/crates/swc/tests/tsc-references/renamed_es5.1.normal.js index 7099ae234205..22fa879f7a1a 100644 --- a/crates/swc/tests/tsc-references/renamed_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/renamed_es5.1.normal.js @@ -5,5 +5,9 @@ var A = function A() { "use strict"; _class_call_check(this, A); }; +export { }; +// @Filename: /b.ts +export { }; +// @Filename: /c.ts var d = {}; export { }; diff --git a/crates/swc/tests/tsc-references/renamed_es5.2.minified.js b/crates/swc/tests/tsc-references/renamed_es5.2.minified.js index 592a79d4705e..185814c32146 100644 --- a/crates/swc/tests/tsc-references/renamed_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/renamed_es5.2.minified.js @@ -3,3 +3,5 @@ var A = function() { "use strict"; _class_call_check(this, A); }; +export { }; +export { }; diff --git a/crates/swc/tests/tsc-references/requireOfESWithPropertyAccess_es2015.2.minified.js b/crates/swc/tests/tsc-references/requireOfESWithPropertyAccess_es2015.2.minified.js index 9bc4643a77ff..3313c4ee273f 100644 --- a/crates/swc/tests/tsc-references/requireOfESWithPropertyAccess_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/requireOfESWithPropertyAccess_es2015.2.minified.js @@ -1,4 +1,4 @@ -let x = require('./ch').x; +const x = require('./ch').x; x.grey, x.x.grey; let x = { grey: {} diff --git a/crates/swc/tests/tsc-references/restElementMustBeLast_es2015.1.normal.js b/crates/swc/tests/tsc-references/restElementMustBeLast_es2015.1.normal.js new file mode 100644 index 000000000000..6a5f304fc3d0 --- /dev/null +++ b/crates/swc/tests/tsc-references/restElementMustBeLast_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x Rest element must be final element +//! ,---- +//! 1 | var [...a, x] = [1, 2, 3]; // Error, rest must be last element +//! : ^^^^ +//! `---- +//! +//! x Rest element must be final element +//! ,---- +//! 2 | [...a, x] = [1, 2, 3]; // Error, rest must be last element +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/restElementMustBeLast_es2015.2.minified.js b/crates/swc/tests/tsc-references/restElementMustBeLast_es2015.2.minified.js new file mode 100644 index 000000000000..6a5f304fc3d0 --- /dev/null +++ b/crates/swc/tests/tsc-references/restElementMustBeLast_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x Rest element must be final element +//! ,---- +//! 1 | var [...a, x] = [1, 2, 3]; // Error, rest must be last element +//! : ^^^^ +//! `---- +//! +//! x Rest element must be final element +//! ,---- +//! 2 | [...a, x] = [1, 2, 3]; // Error, rest must be last element +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/restElementMustBeLast_es5.1.normal.js b/crates/swc/tests/tsc-references/restElementMustBeLast_es5.1.normal.js new file mode 100644 index 000000000000..6a5f304fc3d0 --- /dev/null +++ b/crates/swc/tests/tsc-references/restElementMustBeLast_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x Rest element must be final element +//! ,---- +//! 1 | var [...a, x] = [1, 2, 3]; // Error, rest must be last element +//! : ^^^^ +//! `---- +//! +//! x Rest element must be final element +//! ,---- +//! 2 | [...a, x] = [1, 2, 3]; // Error, rest must be last element +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/restElementMustBeLast_es5.2.minified.js b/crates/swc/tests/tsc-references/restElementMustBeLast_es5.2.minified.js new file mode 100644 index 000000000000..6a5f304fc3d0 --- /dev/null +++ b/crates/swc/tests/tsc-references/restElementMustBeLast_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x Rest element must be final element +//! ,---- +//! 1 | var [...a, x] = [1, 2, 3]; // Error, rest must be last element +//! : ^^^^ +//! `---- +//! +//! x Rest element must be final element +//! ,---- +//! 2 | [...a, x] = [1, 2, 3]; // Error, rest must be last element +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/scopedPackagesClassic_es2015.1.normal.js b/crates/swc/tests/tsc-references/scopedPackagesClassic_es2015.1.normal.js index 650dfdc5443d..a0cda555c68b 100644 --- a/crates/swc/tests/tsc-references/scopedPackagesClassic_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/scopedPackagesClassic_es2015.1.normal.js @@ -4,3 +4,5 @@ // @moduleResolution: classic // @filename: /node_modules/@types/see__saw/index.d.ts export const x = 0; +// @filename: /a.ts +export { }; diff --git a/crates/swc/tests/tsc-references/scopedPackagesClassic_es2015.2.minified.js b/crates/swc/tests/tsc-references/scopedPackagesClassic_es2015.2.minified.js index 297819228b8c..4eb92e6cc3b9 100644 --- a/crates/swc/tests/tsc-references/scopedPackagesClassic_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/scopedPackagesClassic_es2015.2.minified.js @@ -1 +1,2 @@ export const x = 0; +export { }; diff --git a/crates/swc/tests/tsc-references/scopedPackagesClassic_es5.1.normal.js b/crates/swc/tests/tsc-references/scopedPackagesClassic_es5.1.normal.js index b18a88adb77d..d6a4a16fea8d 100644 --- a/crates/swc/tests/tsc-references/scopedPackagesClassic_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/scopedPackagesClassic_es5.1.normal.js @@ -4,3 +4,5 @@ // @moduleResolution: classic // @filename: /node_modules/@types/see__saw/index.d.ts export var x = 0; +// @filename: /a.ts +export { }; diff --git a/crates/swc/tests/tsc-references/scopedPackagesClassic_es5.2.minified.js b/crates/swc/tests/tsc-references/scopedPackagesClassic_es5.2.minified.js index db41b54f1a85..3356f013df63 100644 --- a/crates/swc/tests/tsc-references/scopedPackagesClassic_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/scopedPackagesClassic_es5.2.minified.js @@ -1 +1,2 @@ export var x = 0; +export { }; diff --git a/crates/swc/tests/tsc-references/shadowedInternalModule_es2015.1.normal.js b/crates/swc/tests/tsc-references/shadowedInternalModule_es2015.1.normal.js index cd79b25e0852..3b8c040a962b 100644 --- a/crates/swc/tests/tsc-references/shadowedInternalModule_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/shadowedInternalModule_es2015.1.normal.js @@ -1,25 +1,11 @@ -// all errors imported modules conflict with local variables -var A; -(function(A) { - var Point = A.Point = { - x: 0, - y: 0 - }; -})(A || (A = {})); -var B; -(function(B) { - var A = { - x: 0, - y: 0 - }; -})(B || (B = {})); -var X; -(function(X) { - class Y { - } - X.Y = Y; -})(X || (X = {})); -var Z; -(function(Z) { - var Y = 12; -})(Z || (Z = {})); +//! +//! x the name `Y` is defined multiple times +//! ,-[30:5] +//! 30 | import Y = X.Y; +//! : | +//! : `-- previous definition of `Y` here +//! 31 | +//! 32 | var Y = 12; +//! : | +//! : `-- `Y` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/shadowedInternalModule_es2015.2.minified.js b/crates/swc/tests/tsc-references/shadowedInternalModule_es2015.2.minified.js index 58aa7fdc12a8..3b8c040a962b 100644 --- a/crates/swc/tests/tsc-references/shadowedInternalModule_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/shadowedInternalModule_es2015.2.minified.js @@ -1,6 +1,11 @@ -var A, B, X, Z; -(A || (A = {})).Point = { - x: 0, - y: 0 -}, B || (B = {}), (X || (X = {})).Y = class { -}, Z || (Z = {}); +//! +//! x the name `Y` is defined multiple times +//! ,-[30:5] +//! 30 | import Y = X.Y; +//! : | +//! : `-- previous definition of `Y` here +//! 31 | +//! 32 | var Y = 12; +//! : | +//! : `-- `Y` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/shadowedInternalModule_es5.1.normal.js b/crates/swc/tests/tsc-references/shadowedInternalModule_es5.1.normal.js index 8f3da8674c64..3b8c040a962b 100644 --- a/crates/swc/tests/tsc-references/shadowedInternalModule_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/shadowedInternalModule_es5.1.normal.js @@ -1,28 +1,11 @@ -// all errors imported modules conflict with local variables -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var A; -(function(A) { - var Point = A.Point = { - x: 0, - y: 0 - }; -})(A || (A = {})); -var B; -(function(B) { - var A = { - x: 0, - y: 0 - }; -})(B || (B = {})); -var X; -(function(X) { - var Y = function Y() { - "use strict"; - _class_call_check(this, Y); - }; - X.Y = Y; -})(X || (X = {})); -var Z; -(function(Z) { - var Y = 12; -})(Z || (Z = {})); +//! +//! x the name `Y` is defined multiple times +//! ,-[30:5] +//! 30 | import Y = X.Y; +//! : | +//! : `-- previous definition of `Y` here +//! 31 | +//! 32 | var Y = 12; +//! : | +//! : `-- `Y` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/shadowedInternalModule_es5.2.minified.js b/crates/swc/tests/tsc-references/shadowedInternalModule_es5.2.minified.js index d3be30603932..3b8c040a962b 100644 --- a/crates/swc/tests/tsc-references/shadowedInternalModule_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/shadowedInternalModule_es5.2.minified.js @@ -1,12 +1,11 @@ -var A, B, X, Z; -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -(A || (A = {})).Point = { - x: 0, - y: 0 -}, B || (B = {}), function(X) { - var Y = function() { - "use strict"; - _class_call_check(this, Y); - }; - X.Y = Y; -}(X || (X = {})), Z || (Z = {}); +//! +//! x the name `Y` is defined multiple times +//! ,-[30:5] +//! 30 | import Y = X.Y; +//! : | +//! : `-- previous definition of `Y` here +//! 31 | +//! 32 | var Y = 12; +//! : | +//! : `-- `Y` redefined here +//! `---- diff --git a/crates/swc/tests/tsc-references/spellingUncheckedJS_es2015.2.minified.js b/crates/swc/tests/tsc-references/spellingUncheckedJS_es2015.2.minified.js index 7e610a19f797..bd7da8cc9ea4 100644 --- a/crates/swc/tests/tsc-references/spellingUncheckedJS_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/spellingUncheckedJS_es2015.2.minified.js @@ -3,7 +3,5 @@ inmodule.toFixed(); var object = { spaaace: 3 }; -object.spaaaace, object.spaace = 12, object.fresh = 12, other.puuuce, new Date().getGMTDate(), setIntegral(()=>console.log('ok'), 500), AudioBuffin, Jon, Jon; -var other = { - puuce: 4 -}; +object.spaaaace, object.spaace = 12, object.fresh = 12, other.puuuce, new Date().getGMTDate(), setIntegral(()=>console.log('ok'), 500), AudioBuffin, Jimmy, Jon; +Jon; diff --git a/crates/swc/tests/tsc-references/spellingUncheckedJS_es5.2.minified.js b/crates/swc/tests/tsc-references/spellingUncheckedJS_es5.2.minified.js index 0ae952071b79..3b9e03f0d5b4 100644 --- a/crates/swc/tests/tsc-references/spellingUncheckedJS_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/spellingUncheckedJS_es5.2.minified.js @@ -28,7 +28,5 @@ var Classe = function() { }; object.spaaaace, object.spaace = 12, object.fresh = 12, other.puuuce, new Date().getGMTDate(), setIntegral(function() { return console.log("ok"); -}, 500), AudioBuffin, Jon, Jon; -var other = { - puuce: 4 -}; +}, 500), AudioBuffin, Jimmy, Jon; +Jon; diff --git a/crates/swc/tests/tsc-references/superInStaticMembers1_es2015.1.normal.js b/crates/swc/tests/tsc-references/superInStaticMembers1_es2015.1.normal.js index e594c52d143f..c285cdd81f2e 100644 --- a/crates/swc/tests/tsc-references/superInStaticMembers1_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/superInStaticMembers1_es2015.1.normal.js @@ -1,16 +1,15 @@ // @target: es5, es2015, es2021, es2022, esnext // @noTypesAndSymbols: true // @filename: external.ts -import _get from "@swc/helpers/src/_get.mjs"; -import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; -var _Reflect, __, _Reflect1, __1; export class Reflect { } export var Baz; (function(Baz) {})(Baz || (Baz = {})); -class _class { -} -export { _class as default }; +export default class { +}; +// @filename: locals.ts +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = [ @@ -67,7 +66,7 @@ C._ = [ _get(_get_prototype_of(C), "w", C).call(C); })(), ]; -var __2 = { +var __ = { writable: true, value: (()=>{ var { Reflect } = { @@ -76,7 +75,7 @@ var __2 = { super.w(); })() }; -var __11 = { +var __1 = { writable: true, value: (()=>{ var [Reflect] = [ @@ -85,7 +84,7 @@ var __11 = { super.w(); })() }; -var __21 = { +var __2 = { writable: true, value: (()=>{ var Reflect; // collision (es2015-es2021 only) @@ -154,254 +153,387 @@ var __10 = { super.w(); })() }; +export { }; +// @filename: varInContainingScopeStaticField1.ts +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; var Reflect = null; // collision (es2015-es2021 only) class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: varInContainingScopeStaticField2.ts +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; var { Reflect } = { Reflect: null }; // collision (es2015-es2021 only) class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: varInContainingScopeStaticField3.ts +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; var [Reflect] = [ null ]; // collision (es2015-es2021 only) class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: varInContainingScopeStaticBlock1.ts var Reflect = null; // collision (es2015-es2021 only) class C extends B { } -var __12 = { +var __ = { writable: true, value: (()=>{ super.w(); })() }; +export { }; +// @filename: varInContainingScopeStaticBlock2.ts var { Reflect } = { Reflect: null }; // collision (es2015-es2021 only) class C extends B { } -var __13 = { +var __ = { writable: true, value: (()=>{ super.w(); })() }; +export { }; +// @filename: varInContainingScopeStaticBlock3.ts var [Reflect] = [ null ]; // collision (es2015-es2021 only) class C extends B { } -var __14 = { +var __ = { writable: true, value: (()=>{ super.w(); })() }; +export { }; +// @filename: classDeclInContainingScopeStaticField.ts +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class Reflect { } // collision (es2015-es2021 only) class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: classDeclInContainingScopeStaticBlock.ts class Reflect { } // collision (es2015-es2021 only) class C extends B { } -var __15 = { +var __ = { writable: true, value: (()=>{ super.w(); })() }; +export { }; +// @filename: funcDeclInContainingScopeStaticField.ts +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; function Reflect() {} // collision (es2015-es2021 only) class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: funcDeclInContainingScopeStaticBlock.ts function Reflect() {} // collision (es2015-es2021 only) class C extends B { } -var __16 = { +var __ = { writable: true, value: (()=>{ super.w(); })() }; +export { }; +// @filename: valueNamespaceInContainingScopeStaticField.ts +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: valueNamespaceInContainingScopeStaticBlock.ts class C extends B { } -var __17 = { +var __ = { writable: true, value: (()=>{ super.w(); })() }; +export { }; +// @filename: enumInContainingScopeStaticField.ts +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +var Reflect// collision (es2015-es2021 only) +; (function(Reflect) {})(Reflect || (Reflect = {})); class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: enumInContainingScopeStaticBlock.ts +var Reflect// collision (es2015-es2021 only) +; (function(Reflect) {})(Reflect || (Reflect = {})); class C extends B { } -var __18 = { +var __ = { writable: true, value: (()=>{ super.w(); })() }; +export { }; +// @filename: constEnumInContainingScopeStaticField.ts +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +var Reflect// collision (es2015-es2021 only) +; (function(Reflect) {})(Reflect || (Reflect = {})); class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: constEnumInContainingScopeStaticBlock.ts +var Reflect// collision (es2015-es2021 only) +; (function(Reflect) {})(Reflect || (Reflect = {})); class C extends B { } -var __19 = { +var __ = { writable: true, value: (()=>{ super.w(); })() }; +export { }; +// @filename: namespaceImportInContainingScopeStaticField.ts +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: namespaceImportInContainingScopeStaticBlock.ts class C extends B { } -var __20 = { +var __ = { writable: true, value: (()=>{ super.w(); })() }; +export { }; +// @filename: namedImportInContainingScopeStaticField.ts +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: namedImportInContainingScopeStaticBlock.ts class C extends B { } -var __22 = { +var __ = { writable: true, value: (()=>{ super.w(); })() }; +export { }; +// @filename: namedImportOfInterfaceInContainingScopeStaticField.ts +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: namedImportOfInterfaceInContainingScopeStaticBlock.ts class C extends B { } -var __23 = { +var __ = { writable: true, value: (()=>{ super.w(); })() }; +export { }; +// @filename: namedImportOfUninstantiatedNamespaceInContainingScopeStaticField.ts +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: namedImportOfUninstantiatedNamespaceInContainingScopeStaticBlock.ts class C extends B { } -var __24 = { +var __ = { writable: true, value: (()=>{ super.w(); })() }; +export { }; +// @filename: namedImportOfConstEnumInContainingScopeStaticField.ts +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: namedImportOfConstEnumInContainingScopeStaticBlock.ts class C extends B { } -var __25 = { +var __ = { writable: true, value: (()=>{ super.w(); })() }; +export { }; +// @filename: typeOnlyNamedImportInContainingScopeStaticField.ts +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: typeOnlyNamedImportInContainingScopeStaticBlock.ts class C extends B { } -var __26 = { +var __ = { writable: true, value: (()=>{ super.w(); })() }; +export { }; +// @filename: defaultImportInContainingScopeStaticField.ts +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: defaultImportInContainingScopeStaticBlock.ts class C extends B { } -var __27 = { +var __ = { writable: true, value: (()=>{ super.w(); })() }; +export { }; +// @filename: typeOnlyDefaultImportInContainingScopeStaticField.ts +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: typeOnlyDefaultImportInContainingScopeStaticBlock.ts class C extends B { } -var __28 = { +var __ = { writable: true, value: (()=>{ super.w(); })() }; +export { }; +// @filename: typeInContainingScopeStaticField.ts +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: typeInContainingScopeStaticBlock.ts class C extends B { } -var __29 = { +var __ = { writable: true, value: (()=>{ super.w(); })() }; +export { }; +// @filename: interfaceInContainingScopeStaticField.ts +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: interfaceInContainingScopeStaticBlock.ts class C extends B { } -var __30 = { +var __ = { writable: true, value: (()=>{ super.w(); })() }; +export { }; +// @filename: uninstantiatedNamespaceInContainingScopeStaticField.ts +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: uninstantiatedNamespaceInContainingScopeStaticBlock.ts class C extends B { } -var __31 = { +var __ = { writable: true, value: (()=>{ super.w(); })() }; +export { }; +// @filename: classExprInContainingScopeStaticField.ts +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; (class Reflect { }); // no collision class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: classExprInContainingScopeStaticBlock.ts (class Reflect { }); // no collision class C extends B { } -var __32 = { +var __ = { writable: true, value: (()=>{ super.w(); })() }; +export { }; +// @filename: inContainingClassExprStaticField.ts +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +var _Reflect, __; _Reflect = class Reflect { }, __ = { writable: true, @@ -411,8 +543,11 @@ _Reflect = class Reflect { C._ = _get(_get_prototype_of(C), "w", C).call(C); })() }, _Reflect; -_Reflect1 = class Reflect { -}, __1 = { +export { }; +// @filename: inContainingClassExprStaticBlock.ts +var _Reflect, __; +_Reflect = class Reflect { +}, __ = { writable: true, value: (()=>{ class C extends B { @@ -424,25 +559,37 @@ _Reflect1 = class Reflect { })() }; })() -}, _Reflect1; +}, _Reflect; +export { }; +// @filename: funcExprInContainingScopeStaticField.ts +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; (function Reflect() {}); // no collision class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: funcExprInContainingScopeStaticBlock.ts (function Reflect() {}); // no collision class C extends B { } -var __33 = { +var __ = { writable: true, value: (()=>{ super.w(); })() }; +export { }; +// @filename: inContainingFuncExprStaticField.ts +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; (function Reflect() { class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); }); +export { }; +// @filename: inContainingFuncExprStaticBlock.ts (function Reflect() { class C extends B { } @@ -453,3 +600,4 @@ var __33 = { })() }; }); +export { }; diff --git a/crates/swc/tests/tsc-references/superInStaticMembers1_es2015.2.minified.js b/crates/swc/tests/tsc-references/superInStaticMembers1_es2015.2.minified.js index a46b5d643264..e6fa6a48d7f8 100644 --- a/crates/swc/tests/tsc-references/superInStaticMembers1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/superInStaticMembers1_es2015.2.minified.js @@ -1,11 +1,11 @@ -import _get from "@swc/helpers/src/_get.mjs"; -import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; export class Reflect { } export var Baz; Baz || (Baz = {}); -class _class { -} +export default class { +}; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = [ @@ -53,154 +53,180 @@ C._ = [ let Reflect; Reflect || (Reflect = {}), super.w(); })(), super.w(), super.w(), super.w(), super.w(); -var Reflect = null; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; var { Reflect } = { Reflect: null }; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; var [Reflect] = [ null ]; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); -var Reflect = null; -class C extends B { -} super.w(); +export { }; var { Reflect } = { Reflect: null }; -class C extends B { -} super.w(); +export { }; var [Reflect] = [ null ]; -class C extends B { -} super.w(); -class Reflect { -} +export { }; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); -class Reflect { -} -class C extends B { -} -function Reflect() {} super.w(); +export { }; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } -function Reflect() {} C._ = _get(_get_prototype_of(C), "w", C).call(C); -class C extends B { -} super.w(); +export { }; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); -class C extends B { -} -super.w(), Reflect || (Reflect = {}); -class C extends B { -} -C._ = _get(_get_prototype_of(C), "w", C).call(C), Reflect || (Reflect = {}); -class C extends B { -} -super.w(), Reflect || (Reflect = {}); -class C extends B { -} -C._ = _get(_get_prototype_of(C), "w", C).call(C), Reflect || (Reflect = {}); -class C extends B { -} super.w(); +export { }; +var Reflect; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +Reflect || (Reflect = {}); class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); -class C extends B { -} -super.w(); +var Reflect; +Reflect || (Reflect = {}), super.w(); +export { }; +var Reflect; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +Reflect || (Reflect = {}); class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); +var Reflect; +Reflect || (Reflect = {}), super.w(); +export { }; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } +C._ = _get(_get_prototype_of(C), "w", C).call(C); super.w(); +export { }; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); -class C extends B { -} super.w(); +export { }; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); -class C extends B { -} super.w(); +export { }; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); -class C extends B { -} super.w(); +export { }; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); -class C extends B { -} super.w(); +export { }; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); -class C extends B { -} super.w(); +export { }; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); -class C extends B { -} super.w(); +export { }; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); -class C extends B { -} super.w(); +export { }; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); -class C extends B { -} super.w(); +export { }; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); -class C extends B { -} super.w(); +export { }; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); +super.w(); +export { }; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } -super.w(), (()=>{ +C._ = _get(_get_prototype_of(C), "w", C).call(C); +super.w(); +export { }; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +(()=>{ class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); -})(), super.w(); +})(); +super.w(); +export { }; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); -class C extends B { -} super.w(); -export { _class as default }; +export { }; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +export { }; diff --git a/crates/swc/tests/tsc-references/superInStaticMembers1_es5.1.normal.js b/crates/swc/tests/tsc-references/superInStaticMembers1_es5.1.normal.js index e5b8f3608a70..3b4cea3b7bf4 100644 --- a/crates/swc/tests/tsc-references/superInStaticMembers1_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/superInStaticMembers1_es5.1.normal.js @@ -2,23 +2,24 @@ // @noTypesAndSymbols: true // @filename: external.ts import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _get from "@swc/helpers/src/_get.mjs"; -import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; -var _this = this, _superprop_get_w = ()=>super.w; -var _Reflect, __, _Reflect1, __1; export var Reflect = function Reflect() { "use strict"; _class_call_check(this, Reflect); }; export var Baz; (function(Baz) {})(Baz || (Baz = {})); -var _class = function _class() { +var _default = function _default() { "use strict"; - _class_call_check(this, _class); + _class_call_check(this, _default); }; -export { _class as default }; +export { _default as default }; +// @filename: locals.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _this = this, _superprop_get_w = ()=>super.w; var C = /*#__PURE__*/ function(B1) { "use strict"; _inherits(C, B1); @@ -87,7 +88,7 @@ C._ = [ _get(_get_prototype_of(C), "w", C).call(C); }(), ]; -var __2 = { +var __ = { writable: true, value: function() { var Reflect = { @@ -96,14 +97,14 @@ var __2 = { _superprop_get_w().call(_this); }() }; -var __11 = { +var __1 = { writable: true, value: function() { var Reflect = null; // collision (es2015-es2021 only) _superprop_get_w().call(_this); }() }; -var __21 = { +var __2 = { writable: true, value: function() { var Reflect; // collision (es2015-es2021 only) @@ -178,6 +179,13 @@ var __10 = { _superprop_get_w().call(_this); }() }; +export { }; +// @filename: varInContainingScopeStaticField1.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var Reflect = null; // collision (es2015-es2021 only) var C = /*#__PURE__*/ function(B1) { "use strict"; @@ -190,6 +198,13 @@ var C = /*#__PURE__*/ function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: varInContainingScopeStaticField2.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var Reflect = { Reflect: null }.Reflect; // collision (es2015-es2021 only) @@ -204,6 +219,13 @@ var C = /*#__PURE__*/ function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: varInContainingScopeStaticField3.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var Reflect = null; // collision (es2015-es2021 only) var C = /*#__PURE__*/ function(B1) { "use strict"; @@ -216,6 +238,12 @@ var C = /*#__PURE__*/ function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: varInContainingScopeStaticBlock1.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _this = this, _superprop_get_w = ()=>super.w; var Reflect = null; // collision (es2015-es2021 only) var C = /*#__PURE__*/ function(B1) { "use strict"; @@ -227,12 +255,18 @@ var C = /*#__PURE__*/ function(B1) { } return C; }(B); -var __12 = { +var __ = { writable: true, value: function() { _superprop_get_w().call(_this); }() }; +export { }; +// @filename: varInContainingScopeStaticBlock2.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _this = this, _superprop_get_w = ()=>super.w; var Reflect = { Reflect: null }.Reflect; // collision (es2015-es2021 only) @@ -246,12 +280,18 @@ var C = /*#__PURE__*/ function(B1) { } return C; }(B); -var __13 = { +var __ = { writable: true, value: function() { _superprop_get_w().call(_this); }() }; +export { }; +// @filename: varInContainingScopeStaticBlock3.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _this = this, _superprop_get_w = ()=>super.w; var Reflect = null; // collision (es2015-es2021 only) var C = /*#__PURE__*/ function(B1) { "use strict"; @@ -263,12 +303,19 @@ var C = /*#__PURE__*/ function(B1) { } return C; }(B); -var __14 = { +var __ = { writable: true, value: function() { _superprop_get_w().call(_this); }() }; +export { }; +// @filename: classDeclInContainingScopeStaticField.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var Reflect = function Reflect() { "use strict"; _class_call_check(this, Reflect); @@ -285,6 +332,12 @@ var C = /*#__PURE__*/ function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: classDeclInContainingScopeStaticBlock.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _this = this, _superprop_get_w = ()=>super.w; var Reflect = function Reflect() { "use strict"; _class_call_check(this, Reflect); @@ -300,12 +353,19 @@ var C = /*#__PURE__*/ function(B1) { } return C; }(B); -var __15 = { +var __ = { writable: true, value: function() { _superprop_get_w().call(_this); }() }; +export { }; +// @filename: funcDeclInContainingScopeStaticField.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; function Reflect() {} // collision (es2015-es2021 only) var C = /*#__PURE__*/ function(B1) { "use strict"; @@ -318,6 +378,12 @@ var C = /*#__PURE__*/ function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: funcDeclInContainingScopeStaticBlock.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _this = this, _superprop_get_w = ()=>super.w; function Reflect() {} // collision (es2015-es2021 only) var C = /*#__PURE__*/ function(B1) { "use strict"; @@ -329,12 +395,19 @@ var C = /*#__PURE__*/ function(B1) { } return C; }(B); -var __16 = { +var __ = { writable: true, value: function() { _superprop_get_w().call(_this); }() }; +export { }; +// @filename: valueNamespaceInContainingScopeStaticField.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = /*#__PURE__*/ function(B1) { "use strict"; _inherits(C, B1); @@ -346,6 +419,12 @@ var C = /*#__PURE__*/ function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: valueNamespaceInContainingScopeStaticBlock.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _this = this, _superprop_get_w = ()=>super.w; var C = /*#__PURE__*/ function(B1) { "use strict"; _inherits(C, B1); @@ -356,12 +435,21 @@ var C = /*#__PURE__*/ function(B1) { } return C; }(B); -var __17 = { +var __ = { writable: true, value: function() { _superprop_get_w().call(_this); }() }; +export { }; +// @filename: enumInContainingScopeStaticField.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var Reflect// collision (es2015-es2021 only) +; (function(Reflect) {})(Reflect || (Reflect = {})); var C = /*#__PURE__*/ function(B1) { "use strict"; @@ -374,6 +462,14 @@ var C = /*#__PURE__*/ function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: enumInContainingScopeStaticBlock.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _this = this, _superprop_get_w = ()=>super.w; +var Reflect// collision (es2015-es2021 only) +; (function(Reflect) {})(Reflect || (Reflect = {})); var C = /*#__PURE__*/ function(B1) { "use strict"; @@ -385,12 +481,21 @@ var C = /*#__PURE__*/ function(B1) { } return C; }(B); -var __18 = { +var __ = { writable: true, value: function() { _superprop_get_w().call(_this); }() }; +export { }; +// @filename: constEnumInContainingScopeStaticField.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var Reflect// collision (es2015-es2021 only) +; (function(Reflect) {})(Reflect || (Reflect = {})); var C = /*#__PURE__*/ function(B1) { "use strict"; @@ -403,6 +508,14 @@ var C = /*#__PURE__*/ function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: constEnumInContainingScopeStaticBlock.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _this = this, _superprop_get_w = ()=>super.w; +var Reflect// collision (es2015-es2021 only) +; (function(Reflect) {})(Reflect || (Reflect = {})); var C = /*#__PURE__*/ function(B1) { "use strict"; @@ -414,12 +527,19 @@ var C = /*#__PURE__*/ function(B1) { } return C; }(B); -var __19 = { +var __ = { writable: true, value: function() { _superprop_get_w().call(_this); }() }; +export { }; +// @filename: namespaceImportInContainingScopeStaticField.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = /*#__PURE__*/ function(B1) { "use strict"; _inherits(C, B1); @@ -431,6 +551,12 @@ var C = /*#__PURE__*/ function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: namespaceImportInContainingScopeStaticBlock.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _this = this, _superprop_get_w = ()=>super.w; var C = /*#__PURE__*/ function(B1) { "use strict"; _inherits(C, B1); @@ -441,12 +567,19 @@ var C = /*#__PURE__*/ function(B1) { } return C; }(B); -var __20 = { +var __ = { writable: true, value: function() { _superprop_get_w().call(_this); }() }; +export { }; +// @filename: namedImportInContainingScopeStaticField.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = /*#__PURE__*/ function(B1) { "use strict"; _inherits(C, B1); @@ -458,6 +591,12 @@ var C = /*#__PURE__*/ function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: namedImportInContainingScopeStaticBlock.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _this = this, _superprop_get_w = ()=>super.w; var C = /*#__PURE__*/ function(B1) { "use strict"; _inherits(C, B1); @@ -468,12 +607,19 @@ var C = /*#__PURE__*/ function(B1) { } return C; }(B); -var __22 = { +var __ = { writable: true, value: function() { _superprop_get_w().call(_this); }() }; +export { }; +// @filename: namedImportOfInterfaceInContainingScopeStaticField.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = /*#__PURE__*/ function(B1) { "use strict"; _inherits(C, B1); @@ -485,6 +631,12 @@ var C = /*#__PURE__*/ function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: namedImportOfInterfaceInContainingScopeStaticBlock.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _this = this, _superprop_get_w = ()=>super.w; var C = /*#__PURE__*/ function(B1) { "use strict"; _inherits(C, B1); @@ -495,12 +647,19 @@ var C = /*#__PURE__*/ function(B1) { } return C; }(B); -var __23 = { +var __ = { writable: true, value: function() { _superprop_get_w().call(_this); }() }; +export { }; +// @filename: namedImportOfUninstantiatedNamespaceInContainingScopeStaticField.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = /*#__PURE__*/ function(B1) { "use strict"; _inherits(C, B1); @@ -512,6 +671,12 @@ var C = /*#__PURE__*/ function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: namedImportOfUninstantiatedNamespaceInContainingScopeStaticBlock.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _this = this, _superprop_get_w = ()=>super.w; var C = /*#__PURE__*/ function(B1) { "use strict"; _inherits(C, B1); @@ -522,12 +687,19 @@ var C = /*#__PURE__*/ function(B1) { } return C; }(B); -var __24 = { +var __ = { writable: true, value: function() { _superprop_get_w().call(_this); }() }; +export { }; +// @filename: namedImportOfConstEnumInContainingScopeStaticField.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = /*#__PURE__*/ function(B1) { "use strict"; _inherits(C, B1); @@ -539,6 +711,12 @@ var C = /*#__PURE__*/ function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: namedImportOfConstEnumInContainingScopeStaticBlock.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _this = this, _superprop_get_w = ()=>super.w; var C = /*#__PURE__*/ function(B1) { "use strict"; _inherits(C, B1); @@ -549,12 +727,19 @@ var C = /*#__PURE__*/ function(B1) { } return C; }(B); -var __25 = { +var __ = { writable: true, value: function() { _superprop_get_w().call(_this); }() }; +export { }; +// @filename: typeOnlyNamedImportInContainingScopeStaticField.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = /*#__PURE__*/ function(B1) { "use strict"; _inherits(C, B1); @@ -566,6 +751,12 @@ var C = /*#__PURE__*/ function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: typeOnlyNamedImportInContainingScopeStaticBlock.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _this = this, _superprop_get_w = ()=>super.w; var C = /*#__PURE__*/ function(B1) { "use strict"; _inherits(C, B1); @@ -576,12 +767,19 @@ var C = /*#__PURE__*/ function(B1) { } return C; }(B); -var __26 = { +var __ = { writable: true, value: function() { _superprop_get_w().call(_this); }() }; +export { }; +// @filename: defaultImportInContainingScopeStaticField.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = /*#__PURE__*/ function(B1) { "use strict"; _inherits(C, B1); @@ -593,6 +791,12 @@ var C = /*#__PURE__*/ function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: defaultImportInContainingScopeStaticBlock.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _this = this, _superprop_get_w = ()=>super.w; var C = /*#__PURE__*/ function(B1) { "use strict"; _inherits(C, B1); @@ -603,12 +807,19 @@ var C = /*#__PURE__*/ function(B1) { } return C; }(B); -var __27 = { +var __ = { writable: true, value: function() { _superprop_get_w().call(_this); }() }; +export { }; +// @filename: typeOnlyDefaultImportInContainingScopeStaticField.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = /*#__PURE__*/ function(B1) { "use strict"; _inherits(C, B1); @@ -620,6 +831,12 @@ var C = /*#__PURE__*/ function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: typeOnlyDefaultImportInContainingScopeStaticBlock.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _this = this, _superprop_get_w = ()=>super.w; var C = /*#__PURE__*/ function(B1) { "use strict"; _inherits(C, B1); @@ -630,12 +847,19 @@ var C = /*#__PURE__*/ function(B1) { } return C; }(B); -var __28 = { +var __ = { writable: true, value: function() { _superprop_get_w().call(_this); }() }; +export { }; +// @filename: typeInContainingScopeStaticField.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = /*#__PURE__*/ function(B1) { "use strict"; _inherits(C, B1); @@ -647,6 +871,12 @@ var C = /*#__PURE__*/ function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: typeInContainingScopeStaticBlock.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _this = this, _superprop_get_w = ()=>super.w; var C = /*#__PURE__*/ function(B1) { "use strict"; _inherits(C, B1); @@ -657,12 +887,19 @@ var C = /*#__PURE__*/ function(B1) { } return C; }(B); -var __29 = { +var __ = { writable: true, value: function() { _superprop_get_w().call(_this); }() }; +export { }; +// @filename: interfaceInContainingScopeStaticField.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = /*#__PURE__*/ function(B1) { "use strict"; _inherits(C, B1); @@ -674,6 +911,12 @@ var C = /*#__PURE__*/ function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: interfaceInContainingScopeStaticBlock.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _this = this, _superprop_get_w = ()=>super.w; var C = /*#__PURE__*/ function(B1) { "use strict"; _inherits(C, B1); @@ -684,12 +927,19 @@ var C = /*#__PURE__*/ function(B1) { } return C; }(B); -var __30 = { +var __ = { writable: true, value: function() { _superprop_get_w().call(_this); }() }; +export { }; +// @filename: uninstantiatedNamespaceInContainingScopeStaticField.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = /*#__PURE__*/ function(B1) { "use strict"; _inherits(C, B1); @@ -701,6 +951,12 @@ var C = /*#__PURE__*/ function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: uninstantiatedNamespaceInContainingScopeStaticBlock.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _this = this, _superprop_get_w = ()=>super.w; var C = /*#__PURE__*/ function(B1) { "use strict"; _inherits(C, B1); @@ -711,12 +967,19 @@ var C = /*#__PURE__*/ function(B1) { } return C; }(B); -var __31 = { +var __ = { writable: true, value: function() { _superprop_get_w().call(_this); }() }; +export { }; +// @filename: classExprInContainingScopeStaticField.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; (function Reflect() { "use strict"; _class_call_check(this, Reflect); @@ -732,6 +995,12 @@ var C = /*#__PURE__*/ function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: classExprInContainingScopeStaticBlock.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _this = this, _superprop_get_w = ()=>super.w; (function Reflect() { "use strict"; _class_call_check(this, Reflect); @@ -746,12 +1015,20 @@ var C = /*#__PURE__*/ function(B1) { } return C; }(B); -var __32 = { +var __ = { writable: true, value: function() { _superprop_get_w().call(_this); }() }; +export { }; +// @filename: inContainingClassExprStaticField.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _Reflect, __; _Reflect = function Reflect() { "use strict"; _class_call_check(this, Reflect); @@ -771,10 +1048,17 @@ _Reflect = function Reflect() { C._ = _get(_get_prototype_of(C), "w", C).call(C); }() }, _Reflect; -_Reflect1 = function Reflect() { +export { }; +// @filename: inContainingClassExprStaticBlock.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _this = this, _superprop_get_w = ()=>super.w; +var _Reflect, __; +_Reflect = function Reflect() { "use strict"; _class_call_check(this, Reflect); -}, __1 = { +}, __ = { writable: true, value: function() { var C = /*#__PURE__*/ function(B1) { @@ -794,7 +1078,14 @@ _Reflect1 = function Reflect() { }() }; }() -}, _Reflect1; +}, _Reflect; +export { }; +// @filename: funcExprInContainingScopeStaticField.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; (function Reflect() {}); // no collision var C = /*#__PURE__*/ function(B1) { "use strict"; @@ -807,6 +1098,12 @@ var C = /*#__PURE__*/ function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +export { }; +// @filename: funcExprInContainingScopeStaticBlock.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _this = this, _superprop_get_w = ()=>super.w; (function Reflect() {}); // no collision var C = /*#__PURE__*/ function(B1) { "use strict"; @@ -818,12 +1115,19 @@ var C = /*#__PURE__*/ function(B1) { } return C; }(B); -var __33 = { +var __ = { writable: true, value: function() { _superprop_get_w().call(_this); }() }; +export { }; +// @filename: inContainingFuncExprStaticField.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; (function Reflect() { var C = /*#__PURE__*/ function(B1) { "use strict"; @@ -837,6 +1141,11 @@ var __33 = { }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); }); +export { }; +// @filename: inContainingFuncExprStaticBlock.ts +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; (function Reflect() { var _this = this, _superprop_get_w = ()=>super.w; var C = /*#__PURE__*/ function(B1) { @@ -856,3 +1165,4 @@ var __33 = { }() }; }); +export { }; diff --git a/crates/swc/tests/tsc-references/superInStaticMembers1_es5.2.minified.js b/crates/swc/tests/tsc-references/superInStaticMembers1_es5.2.minified.js index 4e7fec571f19..8fc3d4e80cce 100644 --- a/crates/swc/tests/tsc-references/superInStaticMembers1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/superInStaticMembers1_es5.2.minified.js @@ -1,20 +1,21 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -import _get from "@swc/helpers/src/_get.mjs"; -import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; -var _this = this, _superprop_get_w = ()=>super.w; export var Reflect = function() { "use strict"; _class_call_check(this, Reflect); }; export var Baz; Baz || (Baz = {}); -var _class = function() { +var _default = function() { "use strict"; - _class_call_check(this, _class); + _class_call_check(this, _default); }; -var C = function(B1) { +export { _default as default }; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _this = this, _superprop_get_w = ()=>super.w, C = function(B1) { "use strict"; _inherits(C, B1); var _super = _create_super(C); @@ -60,7 +61,12 @@ C._ = [ var Reflect; Reflect || (Reflect = {}), _superprop_get_w().call(_this); }(), _superprop_get_w().call(_this), _superprop_get_w().call(_this), _superprop_get_w().call(_this), _superprop_get_w().call(_this); -var Reflect = null, C = function(B1) { +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var C = function(B1) { "use strict"; _inherits(C, B1); var _super = _create_super(C); @@ -70,7 +76,12 @@ var Reflect = null, C = function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); -var Reflect = null, C = function(B1) { +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var C = function(B1) { "use strict"; _inherits(C, B1); var _super = _create_super(C); @@ -80,7 +91,12 @@ var Reflect = null, C = function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); -var Reflect = null, C = function(B1) { +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var C = function(B1) { "use strict"; _inherits(C, B1); var _super = _create_super(C); @@ -90,7 +106,10 @@ var Reflect = null, C = function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); -var Reflect = null, C = function(B1) { +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var C = function(B1) { "use strict"; _inherits(C, B1); var _super = _create_super(C); @@ -99,8 +118,11 @@ var Reflect = null, C = function(B1) { } return C; }(B); -_superprop_get_w().call(_this); -var Reflect = null, C = function(B1) { +super.w.call(this); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var C = function(B1) { "use strict"; _inherits(C, B1); var _super = _create_super(C); @@ -109,8 +131,11 @@ var Reflect = null, C = function(B1) { } return C; }(B); -_superprop_get_w().call(_this); -var Reflect = null, C = function(B1) { +super.w.call(this); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var C = function(B1) { "use strict"; _inherits(C, B1); var _super = _create_super(C); @@ -119,7 +144,12 @@ var Reflect = null, C = function(B1) { } return C; }(B); -_superprop_get_w().call(_this); +super.w.call(this); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var Reflect = function() { "use strict"; _class_call_check(this, Reflect); @@ -133,6 +163,9 @@ var Reflect = function() { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var Reflect = function() { "use strict"; _class_call_check(this, Reflect); @@ -145,8 +178,12 @@ var Reflect = function() { } return C; }(B); -function Reflect() {} -_superprop_get_w().call(_this); +super.w.call(this); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -156,8 +193,10 @@ var C = function(B1) { } return C; }(B); -function Reflect() {} C._ = _get(_get_prototype_of(C), "w", C).call(C); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -167,7 +206,12 @@ var C = function(B1) { } return C; }(B); -_superprop_get_w().call(_this); +super.w.call(this); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -178,6 +222,9 @@ var C = function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -187,8 +234,14 @@ var C = function(B1) { } return C; }(B); -_superprop_get_w().call(_this), Reflect || (Reflect = {}); -var C = function(B1) { +super.w.call(this); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +Reflect || (Reflect = {}); +var Reflect, C = function(B1) { "use strict"; _inherits(C, B1); var _super = _create_super(C); @@ -197,8 +250,12 @@ var C = function(B1) { } return C; }(B); -C._ = _get(_get_prototype_of(C), "w", C).call(C), Reflect || (Reflect = {}); -var C = function(B1) { +C._ = _get(_get_prototype_of(C), "w", C).call(C); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +Reflect || (Reflect = {}); +var Reflect, C = function(B1) { "use strict"; _inherits(C, B1); var _super = _create_super(C); @@ -207,8 +264,14 @@ var C = function(B1) { } return C; }(B); -_superprop_get_w().call(_this), Reflect || (Reflect = {}); -var C = function(B1) { +super.w.call(this); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +Reflect || (Reflect = {}); +var Reflect, C = function(B1) { "use strict"; _inherits(C, B1); var _super = _create_super(C); @@ -217,8 +280,12 @@ var C = function(B1) { } return C; }(B); -C._ = _get(_get_prototype_of(C), "w", C).call(C), Reflect || (Reflect = {}); -var C = function(B1) { +C._ = _get(_get_prototype_of(C), "w", C).call(C); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +Reflect || (Reflect = {}); +var Reflect, C = function(B1) { "use strict"; _inherits(C, B1); var _super = _create_super(C); @@ -227,7 +294,12 @@ var C = function(B1) { } return C; }(B); -_superprop_get_w().call(_this); +super.w.call(this); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -238,6 +310,9 @@ var C = function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -247,7 +322,12 @@ var C = function(B1) { } return C; }(B); -_superprop_get_w().call(_this); +super.w.call(this); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -258,6 +338,9 @@ var C = function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -267,7 +350,12 @@ var C = function(B1) { } return C; }(B); -_superprop_get_w().call(_this); +super.w.call(this); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -278,6 +366,9 @@ var C = function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -287,7 +378,12 @@ var C = function(B1) { } return C; }(B); -_superprop_get_w().call(_this); +super.w.call(this); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -298,6 +394,9 @@ var C = function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -307,7 +406,12 @@ var C = function(B1) { } return C; }(B); -_superprop_get_w().call(_this); +super.w.call(this); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -318,6 +422,9 @@ var C = function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -327,7 +434,12 @@ var C = function(B1) { } return C; }(B); -_superprop_get_w().call(_this); +super.w.call(this); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -338,6 +450,9 @@ var C = function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -347,7 +462,12 @@ var C = function(B1) { } return C; }(B); -_superprop_get_w().call(_this); +super.w.call(this); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -358,6 +478,9 @@ var C = function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -367,7 +490,12 @@ var C = function(B1) { } return C; }(B); -_superprop_get_w().call(_this); +super.w.call(this); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -378,6 +506,9 @@ var C = function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -387,7 +518,12 @@ var C = function(B1) { } return C; }(B); -_superprop_get_w().call(_this); +super.w.call(this); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -398,6 +534,9 @@ var C = function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -407,7 +546,12 @@ var C = function(B1) { } return C; }(B); -_superprop_get_w().call(_this); +super.w.call(this); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -418,6 +562,9 @@ var C = function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -427,7 +574,12 @@ var C = function(B1) { } return C; }(B); -_superprop_get_w().call(_this); +super.w.call(this); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -438,6 +590,9 @@ var C = function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -447,7 +602,12 @@ var C = function(B1) { } return C; }(B); -_superprop_get_w().call(_this); +super.w.call(this); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -458,6 +618,9 @@ var C = function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -467,7 +630,13 @@ var C = function(B1) { } return C; }(B); -_superprop_get_w().call(_this), function() { +super.w.call(this); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +!function() { var C = function(B1) { "use strict"; _inherits(C, B1); @@ -478,7 +647,12 @@ _superprop_get_w().call(_this), function() { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); -}(), function() { +}(); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var _this = this, _superprop_get_w = ()=>super.w; +!function() { var C = function(B1) { "use strict"; _inherits(C, B1); @@ -490,6 +664,11 @@ _superprop_get_w().call(_this), function() { }(B); _superprop_get_w().call(_this); }(); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -500,6 +679,9 @@ var C = function(B1) { return C; }(B); C._ = _get(_get_prototype_of(C), "w", C).call(C); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; var C = function(B1) { "use strict"; _inherits(C, B1); @@ -509,5 +691,12 @@ var C = function(B1) { } return C; }(B); -_superprop_get_w().call(_this); -export { _class as default }; +super.w.call(this); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _get from "@swc/helpers/src/_get.mjs"; +import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; diff --git a/crates/swc/tests/tsc-references/symbolType20_es2015.1.normal.js b/crates/swc/tests/tsc-references/symbolType20_es2015.1.normal.js new file mode 100644 index 000000000000..1437554dc599 --- /dev/null +++ b/crates/swc/tests/tsc-references/symbolType20_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x interface name is invalid +//! ,---- +//! 2 | interface symbol { } +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/symbolType20_es2015.2.minified.js b/crates/swc/tests/tsc-references/symbolType20_es2015.2.minified.js new file mode 100644 index 000000000000..1437554dc599 --- /dev/null +++ b/crates/swc/tests/tsc-references/symbolType20_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x interface name is invalid +//! ,---- +//! 2 | interface symbol { } +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/symbolType20_es5.1.normal.js b/crates/swc/tests/tsc-references/symbolType20_es5.1.normal.js new file mode 100644 index 000000000000..1437554dc599 --- /dev/null +++ b/crates/swc/tests/tsc-references/symbolType20_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x interface name is invalid +//! ,---- +//! 2 | interface symbol { } +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/symbolType20_es5.2.minified.js b/crates/swc/tests/tsc-references/symbolType20_es5.2.minified.js new file mode 100644 index 000000000000..1437554dc599 --- /dev/null +++ b/crates/swc/tests/tsc-references/symbolType20_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x interface name is invalid +//! ,---- +//! 2 | interface symbol { } +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/templateStringInDeleteExpressionES6_es2015.1.normal.js b/crates/swc/tests/tsc-references/templateStringInDeleteExpressionES6_es2015.1.normal.js new file mode 100644 index 000000000000..640555632dfe --- /dev/null +++ b/crates/swc/tests/tsc-references/templateStringInDeleteExpressionES6_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 2 | delete `abc${0}abc`; +//! : ^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/templateStringInDeleteExpressionES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringInDeleteExpressionES6_es2015.2.minified.js new file mode 100644 index 000000000000..640555632dfe --- /dev/null +++ b/crates/swc/tests/tsc-references/templateStringInDeleteExpressionES6_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 2 | delete `abc${0}abc`; +//! : ^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/templateStringInDeleteExpressionES6_es5.1.normal.js b/crates/swc/tests/tsc-references/templateStringInDeleteExpressionES6_es5.1.normal.js new file mode 100644 index 000000000000..640555632dfe --- /dev/null +++ b/crates/swc/tests/tsc-references/templateStringInDeleteExpressionES6_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 2 | delete `abc${0}abc`; +//! : ^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/templateStringInDeleteExpressionES6_es5.2.minified.js b/crates/swc/tests/tsc-references/templateStringInDeleteExpressionES6_es5.2.minified.js new file mode 100644 index 000000000000..640555632dfe --- /dev/null +++ b/crates/swc/tests/tsc-references/templateStringInDeleteExpressionES6_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 2 | delete `abc${0}abc`; +//! : ^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/templateStringInDeleteExpression_es2015.1.normal.js b/crates/swc/tests/tsc-references/templateStringInDeleteExpression_es2015.1.normal.js new file mode 100644 index 000000000000..a69b80195724 --- /dev/null +++ b/crates/swc/tests/tsc-references/templateStringInDeleteExpression_es2015.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 1 | delete `abc${0}abc`; +//! : ^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/templateStringInDeleteExpression_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringInDeleteExpression_es2015.2.minified.js new file mode 100644 index 000000000000..a69b80195724 --- /dev/null +++ b/crates/swc/tests/tsc-references/templateStringInDeleteExpression_es2015.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 1 | delete `abc${0}abc`; +//! : ^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/templateStringInDeleteExpression_es5.1.normal.js b/crates/swc/tests/tsc-references/templateStringInDeleteExpression_es5.1.normal.js new file mode 100644 index 000000000000..a69b80195724 --- /dev/null +++ b/crates/swc/tests/tsc-references/templateStringInDeleteExpression_es5.1.normal.js @@ -0,0 +1,12 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 1 | delete `abc${0}abc`; +//! : ^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/templateStringInDeleteExpression_es5.2.minified.js b/crates/swc/tests/tsc-references/templateStringInDeleteExpression_es5.2.minified.js new file mode 100644 index 000000000000..a69b80195724 --- /dev/null +++ b/crates/swc/tests/tsc-references/templateStringInDeleteExpression_es5.2.minified.js @@ -0,0 +1,12 @@ +//! +//! x The operand of a delete operator must be a property reference. +//! ,---- +//! 1 | delete `abc${0}abc`; +//! : ^^^^^^^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/thisPropertyOverridesAccessors_es2015.2.minified.js b/crates/swc/tests/tsc-references/thisPropertyOverridesAccessors_es2015.2.minified.js new file mode 100644 index 000000000000..76e945c3c683 --- /dev/null +++ b/crates/swc/tests/tsc-references/thisPropertyOverridesAccessors_es2015.2.minified.js @@ -0,0 +1,5 @@ +class Bar extends Foo { + constructor(){ + super(), this.p = 2; + } +} diff --git a/crates/swc/tests/tsc-references/thisPropertyOverridesAccessors_es5.1.normal.js b/crates/swc/tests/tsc-references/thisPropertyOverridesAccessors_es5.1.normal.js index 457fcfa50ae1..d66bb86a4af2 100644 --- a/crates/swc/tests/tsc-references/thisPropertyOverridesAccessors_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/thisPropertyOverridesAccessors_es5.1.normal.js @@ -5,8 +5,6 @@ // @Filename: foo.ts import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _create_class from "@swc/helpers/src/_create_class.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; var Foo = /*#__PURE__*/ function() { "use strict"; function Foo() { @@ -24,9 +22,12 @@ var Foo = /*#__PURE__*/ function() { return Foo; }(); // @Filename: bar.js -var Bar = /*#__PURE__*/ function(Foo) { +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var Bar = /*#__PURE__*/ function(Foo1) { "use strict"; - _inherits(Bar, Foo); + _inherits(Bar, Foo1); var _super = _create_super(Bar); function Bar() { _class_call_check(this, Bar); diff --git a/crates/swc/tests/tsc-references/thisPropertyOverridesAccessors_es5.2.minified.js b/crates/swc/tests/tsc-references/thisPropertyOverridesAccessors_es5.2.minified.js index cb9751f13800..c65291ff098b 100644 --- a/crates/swc/tests/tsc-references/thisPropertyOverridesAccessors_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/thisPropertyOverridesAccessors_es5.2.minified.js @@ -1,7 +1,5 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _create_class from "@swc/helpers/src/_create_class.mjs"; -import _inherits from "@swc/helpers/src/_inherits.mjs"; -import _create_super from "@swc/helpers/src/_create_super.mjs"; var Foo = function() { "use strict"; function Foo() { @@ -16,9 +14,13 @@ var Foo = function() { set: function(value) {} } ]), Foo; -}(), Bar = function(Foo) { +}(); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; +var Bar = function(Foo1) { "use strict"; - _inherits(Bar, Foo); + _inherits(Bar, Foo1); var _super = _create_super(Bar); function Bar() { var _this; diff --git a/crates/swc/tests/tsc-references/topLevelAwait.2_es2015.1.normal.js b/crates/swc/tests/tsc-references/topLevelAwait.2_es2015.1.normal.js new file mode 100644 index 000000000000..15cbb3bba258 --- /dev/null +++ b/crates/swc/tests/tsc-references/topLevelAwait.2_es2015.1.normal.js @@ -0,0 +1,11 @@ +//! +//! x Expected 'from', got 'await' +//! ,---- +//! 7 | import await = foo.await; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/topLevelAwait.2_es2015.2.minified.js b/crates/swc/tests/tsc-references/topLevelAwait.2_es2015.2.minified.js new file mode 100644 index 000000000000..15cbb3bba258 --- /dev/null +++ b/crates/swc/tests/tsc-references/topLevelAwait.2_es2015.2.minified.js @@ -0,0 +1,11 @@ +//! +//! x Expected 'from', got 'await' +//! ,---- +//! 7 | import await = foo.await; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/topLevelAwait.2_es5.1.normal.js b/crates/swc/tests/tsc-references/topLevelAwait.2_es5.1.normal.js new file mode 100644 index 000000000000..15cbb3bba258 --- /dev/null +++ b/crates/swc/tests/tsc-references/topLevelAwait.2_es5.1.normal.js @@ -0,0 +1,11 @@ +//! +//! x Expected 'from', got 'await' +//! ,---- +//! 7 | import await = foo.await; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/topLevelAwait.2_es5.2.minified.js b/crates/swc/tests/tsc-references/topLevelAwait.2_es5.2.minified.js new file mode 100644 index 000000000000..15cbb3bba258 --- /dev/null +++ b/crates/swc/tests/tsc-references/topLevelAwait.2_es5.2.minified.js @@ -0,0 +1,11 @@ +//! +//! x Expected 'from', got 'await' +//! ,---- +//! 7 | import await = foo.await; +//! : ^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/topLevelFileModuleMissing_es2015.1.normal.js b/crates/swc/tests/tsc-references/topLevelFileModuleMissing_es2015.1.normal.js index 9297b4eb3863..7325c270e30d 100644 --- a/crates/swc/tests/tsc-references/topLevelFileModuleMissing_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/topLevelFileModuleMissing_es2015.1.normal.js @@ -4,3 +4,4 @@ export var x; // @Filename: foo_1.ts const foo = require("vs/foo"); var z = foo.x + 10; +export { }; diff --git a/crates/swc/tests/tsc-references/topLevelFileModuleMissing_es2015.2.minified.js b/crates/swc/tests/tsc-references/topLevelFileModuleMissing_es2015.2.minified.js index 84eea32b944e..3ab9a5972d94 100644 --- a/crates/swc/tests/tsc-references/topLevelFileModuleMissing_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/topLevelFileModuleMissing_es2015.2.minified.js @@ -1,3 +1,4 @@ export var x; let foo = require("vs/foo"); foo.x; +export { }; diff --git a/crates/swc/tests/tsc-references/topLevelFileModuleMissing_es5.1.normal.js b/crates/swc/tests/tsc-references/topLevelFileModuleMissing_es5.1.normal.js index f14d993a1787..8309d5217de2 100644 --- a/crates/swc/tests/tsc-references/topLevelFileModuleMissing_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/topLevelFileModuleMissing_es5.1.normal.js @@ -4,3 +4,4 @@ export var x; // @Filename: foo_1.ts var foo = require("vs/foo"); var z = foo.x + 10; +export { }; diff --git a/crates/swc/tests/tsc-references/topLevelFileModuleMissing_es5.2.minified.js b/crates/swc/tests/tsc-references/topLevelFileModuleMissing_es5.2.minified.js index 73062ce1c66d..2129037c8e7c 100644 --- a/crates/swc/tests/tsc-references/topLevelFileModuleMissing_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/topLevelFileModuleMissing_es5.2.minified.js @@ -1,2 +1,3 @@ export var x; require("vs/foo").x; +export { }; diff --git a/crates/swc/tests/tsc-references/topLevelFileModule_es2015.1.normal.js b/crates/swc/tests/tsc-references/topLevelFileModule_es2015.1.normal.js index 616ba980f6c6..ab3840ca5f76 100644 --- a/crates/swc/tests/tsc-references/topLevelFileModule_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/topLevelFileModule_es2015.1.normal.js @@ -1,7 +1,10 @@ // @module: commonjs // @Filename: vs/foo_0.ts export var x; +// @Filename: vs/fum.d.ts +export { }; // @Filename: foo_1.ts const foo = require("./vs/foo_0"); const fum = require("./vs/fum"); var z = foo.x + fum.y; +export { }; diff --git a/crates/swc/tests/tsc-references/topLevelFileModule_es2015.2.minified.js b/crates/swc/tests/tsc-references/topLevelFileModule_es2015.2.minified.js index 11c3ba5b3f39..3637ea5ef478 100644 --- a/crates/swc/tests/tsc-references/topLevelFileModule_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/topLevelFileModule_es2015.2.minified.js @@ -1,3 +1,5 @@ export var x; +export { }; let foo = require("./vs/foo_0"), fum = require("./vs/fum"); foo.x, fum.y; +export { }; diff --git a/crates/swc/tests/tsc-references/topLevelFileModule_es5.1.normal.js b/crates/swc/tests/tsc-references/topLevelFileModule_es5.1.normal.js index c280a277cebc..20b12a20f244 100644 --- a/crates/swc/tests/tsc-references/topLevelFileModule_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/topLevelFileModule_es5.1.normal.js @@ -1,7 +1,10 @@ // @module: commonjs // @Filename: vs/foo_0.ts export var x; +// @Filename: vs/fum.d.ts +export { }; // @Filename: foo_1.ts var foo = require("./vs/foo_0"); var fum = require("./vs/fum"); var z = foo.x + fum.y; +export { }; diff --git a/crates/swc/tests/tsc-references/topLevelFileModule_es5.2.minified.js b/crates/swc/tests/tsc-references/topLevelFileModule_es5.2.minified.js index d54ffe6cfdd3..4e24ba180587 100644 --- a/crates/swc/tests/tsc-references/topLevelFileModule_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/topLevelFileModule_es5.2.minified.js @@ -1,3 +1,5 @@ export var x; +export { }; var foo = require("./vs/foo_0"), fum = require("./vs/fum"); foo.x, fum.y; +export { }; diff --git a/crates/swc/tests/tsc-references/topLevelModuleDeclarationAndFile_es2015.1.normal.js b/crates/swc/tests/tsc-references/topLevelModuleDeclarationAndFile_es2015.1.normal.js index 3940379cd802..1a6ab2035dd6 100644 --- a/crates/swc/tests/tsc-references/topLevelModuleDeclarationAndFile_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/topLevelModuleDeclarationAndFile_es2015.1.normal.js @@ -1,8 +1,10 @@ // @module: commonjs // @Filename: vs/foo_0/index.ts export var x = 42; +// @Filename: foo_1.ts // @Filename: foo_2.ts /// const foo = require("vs/foo_0"); var z1 = foo.x + 10; // Should error, as declaration should win var z2 = foo.y() + 10; // Should resolve +export { }; diff --git a/crates/swc/tests/tsc-references/topLevelModuleDeclarationAndFile_es2015.2.minified.js b/crates/swc/tests/tsc-references/topLevelModuleDeclarationAndFile_es2015.2.minified.js index e24ae570773e..9f0d0e66d1cd 100644 --- a/crates/swc/tests/tsc-references/topLevelModuleDeclarationAndFile_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/topLevelModuleDeclarationAndFile_es2015.2.minified.js @@ -1,3 +1,4 @@ export var x = 42; let foo = require("vs/foo_0"); foo.x, foo.y(); +export { }; diff --git a/crates/swc/tests/tsc-references/topLevelModuleDeclarationAndFile_es5.1.normal.js b/crates/swc/tests/tsc-references/topLevelModuleDeclarationAndFile_es5.1.normal.js index 07d2f4a31b8d..ca106624ff12 100644 --- a/crates/swc/tests/tsc-references/topLevelModuleDeclarationAndFile_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/topLevelModuleDeclarationAndFile_es5.1.normal.js @@ -1,8 +1,10 @@ // @module: commonjs // @Filename: vs/foo_0/index.ts export var x = 42; +// @Filename: foo_1.ts // @Filename: foo_2.ts /// var foo = require("vs/foo_0"); var z1 = foo.x + 10; // Should error, as declaration should win var z2 = foo.y() + 10; // Should resolve +export { }; diff --git a/crates/swc/tests/tsc-references/topLevelModuleDeclarationAndFile_es5.2.minified.js b/crates/swc/tests/tsc-references/topLevelModuleDeclarationAndFile_es5.2.minified.js index 2193b7e975f4..8e81271f91db 100644 --- a/crates/swc/tests/tsc-references/topLevelModuleDeclarationAndFile_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/topLevelModuleDeclarationAndFile_es5.2.minified.js @@ -1,3 +1,4 @@ export var x = 42; var foo = require("vs/foo_0"); foo.x, foo.y(); +export { }; diff --git a/crates/swc/tests/tsc-references/topLevelThisAssignment_es2015.2.minified.js b/crates/swc/tests/tsc-references/topLevelThisAssignment_es2015.2.minified.js index 0828aef182fb..870953e1229e 100644 --- a/crates/swc/tests/tsc-references/topLevelThisAssignment_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/topLevelThisAssignment_es2015.2.minified.js @@ -1 +1,2 @@ -this.a = 10, this.a, a, this.a, a; +this.a = 10, this.a, a; +this.a, a; diff --git a/crates/swc/tests/tsc-references/topLevelThisAssignment_es5.2.minified.js b/crates/swc/tests/tsc-references/topLevelThisAssignment_es5.2.minified.js index 0828aef182fb..870953e1229e 100644 --- a/crates/swc/tests/tsc-references/topLevelThisAssignment_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/topLevelThisAssignment_es5.2.minified.js @@ -1 +1,2 @@ -this.a = 10, this.a, a, this.a, a; +this.a = 10, this.a, a; +this.a, a; diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution10_es5.1.normal.js b/crates/swc/tests/tsc-references/tsxAttributeResolution10_es5.1.normal.js index dba02a051a92..182a142cfdb8 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution10_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution10_es5.1.normal.js @@ -1,8 +1,8 @@ //@jsx: preserve //@module: amd //@filename: react.d.ts -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; //@filename: file.tsx +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export var MyComponent = /*#__PURE__*/ function() { "use strict"; function MyComponent() { diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution11_es5.1.normal.js b/crates/swc/tests/tsc-references/tsxAttributeResolution11_es5.1.normal.js index 7dc630a491c3..ad5783b45b5b 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution11_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution11_es5.1.normal.js @@ -1,8 +1,8 @@ //@jsx: preserve //@module: amd //@filename: react.d.ts -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; //@filename: file.tsx +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var MyComponent = /*#__PURE__*/ function() { "use strict"; function MyComponent() { diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution12_es2015.1.normal.js b/crates/swc/tests/tsc-references/tsxAttributeResolution12_es2015.1.normal.js index 91ec6dc08441..33959bb742e0 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution12_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution12_es2015.1.normal.js @@ -1,5 +1,6 @@ //@jsx: preserve //@filename: react.d.ts +//@filename: file.tsx // Errors correctly const T = TestMod.Test; var t1 = /*#__PURE__*/ React.createElement(T, null); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution12_es5.1.normal.js b/crates/swc/tests/tsc-references/tsxAttributeResolution12_es5.1.normal.js index 5808537df387..f2961f416bb5 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution12_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution12_es5.1.normal.js @@ -1,5 +1,6 @@ //@jsx: preserve //@filename: react.d.ts +//@filename: file.tsx // Errors correctly var T = TestMod.Test; var t1 = /*#__PURE__*/ React.createElement(T, null); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution14_es2015.1.normal.js b/crates/swc/tests/tsc-references/tsxAttributeResolution14_es2015.1.normal.js index b769a57b23a0..0ecf3596017c 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution14_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution14_es2015.1.normal.js @@ -1,6 +1,7 @@ //@jsx: preserve //@module: amd //@filename: react.d.ts +//@filename: file.tsx function VerticalNavMenuItem(prop) { return /*#__PURE__*/ React.createElement("div", null, "props.primaryText"); } diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution14_es5.1.normal.js b/crates/swc/tests/tsc-references/tsxAttributeResolution14_es5.1.normal.js index b769a57b23a0..0ecf3596017c 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution14_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution14_es5.1.normal.js @@ -1,6 +1,7 @@ //@jsx: preserve //@module: amd //@filename: react.d.ts +//@filename: file.tsx function VerticalNavMenuItem(prop) { return /*#__PURE__*/ React.createElement("div", null, "props.primaryText"); } diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution9_es5.1.normal.js b/crates/swc/tests/tsc-references/tsxAttributeResolution9_es5.1.normal.js index 5f9b8eefddcd..41bdb4f154f6 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution9_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution9_es5.1.normal.js @@ -1,8 +1,8 @@ //@jsx: preserve //@module: amd //@filename: react.d.ts -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; //@filename: file.tsx +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export var MyComponent = /*#__PURE__*/ function() { "use strict"; function MyComponent() { diff --git a/crates/swc/tests/tsc-references/tsxDynamicTagName5_es5.1.normal.js b/crates/swc/tests/tsc-references/tsxDynamicTagName5_es5.1.normal.js index e9668ceadcce..20925048fecf 100644 --- a/crates/swc/tests/tsc-references/tsxDynamicTagName5_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxDynamicTagName5_es5.1.normal.js @@ -1,9 +1,9 @@ // @jsx: preserve //@filename: react.d.ts +//@filename: app.tsx import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; -//@filename: app.tsx import * as React from "react"; export var Text = /*#__PURE__*/ function(_Component) { "use strict"; diff --git a/crates/swc/tests/tsc-references/tsxDynamicTagName7_es5.1.normal.js b/crates/swc/tests/tsc-references/tsxDynamicTagName7_es5.1.normal.js index 75982ed903bb..565058356ec3 100644 --- a/crates/swc/tests/tsc-references/tsxDynamicTagName7_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxDynamicTagName7_es5.1.normal.js @@ -1,9 +1,9 @@ // @jsx: preserve //@filename: react.d.ts +//@filename: app.tsx import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; -//@filename: app.tsx import * as React from "react"; export var Text = /*#__PURE__*/ function(_Component) { "use strict"; diff --git a/crates/swc/tests/tsc-references/tsxDynamicTagName8_es5.1.normal.js b/crates/swc/tests/tsc-references/tsxDynamicTagName8_es5.1.normal.js index 71958fd54c13..63fdf5bb09d0 100644 --- a/crates/swc/tests/tsc-references/tsxDynamicTagName8_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxDynamicTagName8_es5.1.normal.js @@ -1,9 +1,9 @@ // @jsx: preserve //@filename: react.d.ts +//@filename: app.tsx import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; -//@filename: app.tsx import * as React from "react"; export var Text = /*#__PURE__*/ function(_Component) { "use strict"; diff --git a/crates/swc/tests/tsc-references/tsxDynamicTagName9_es5.1.normal.js b/crates/swc/tests/tsc-references/tsxDynamicTagName9_es5.1.normal.js index 71958fd54c13..63fdf5bb09d0 100644 --- a/crates/swc/tests/tsc-references/tsxDynamicTagName9_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxDynamicTagName9_es5.1.normal.js @@ -1,9 +1,9 @@ // @jsx: preserve //@filename: react.d.ts +//@filename: app.tsx import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; -//@filename: app.tsx import * as React from "react"; export var Text = /*#__PURE__*/ function(_Component) { "use strict"; diff --git a/crates/swc/tests/tsc-references/tsxElementResolution19_es2015.1.normal.js b/crates/swc/tests/tsc-references/tsxElementResolution19_es2015.1.normal.js index ed875f9b8cc0..2a59e5eef8a8 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution19_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution19_es2015.1.normal.js @@ -1,9 +1,11 @@ //@jsx: react //@module: amd //@filename: react.d.ts +//@filename: file1.tsx export class MyClass { } //@filename: file2.tsx // Should not elide React import import * as React from 'react'; +import { MyClass } from './file1'; /*#__PURE__*/ React.createElement(MyClass, null); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution19_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution19_es2015.2.minified.js index 872305ca6a91..4d1d37f75385 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution19_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution19_es2015.2.minified.js @@ -1,3 +1,4 @@ export class MyClass { } import * as React from 'react'; +import { MyClass } from './file1'; diff --git a/crates/swc/tests/tsc-references/tsxElementResolution19_es5.1.normal.js b/crates/swc/tests/tsc-references/tsxElementResolution19_es5.1.normal.js index 456b559419ac..dc4fa79c00e5 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution19_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution19_es5.1.normal.js @@ -1,6 +1,7 @@ //@jsx: react //@module: amd //@filename: react.d.ts +//@filename: file1.tsx import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export var MyClass = function MyClass() { "use strict"; @@ -9,4 +10,5 @@ export var MyClass = function MyClass() { //@filename: file2.tsx // Should not elide React import import * as React from "react"; +import { MyClass } from "./file1"; /*#__PURE__*/ React.createElement(MyClass, null); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution19_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution19_es5.2.minified.js index 2c2652c2f0aa..472626db6366 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution19_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution19_es5.2.minified.js @@ -4,3 +4,4 @@ export var MyClass = function() { _class_call_check(this, MyClass); }; import * as React from "react"; +import { MyClass } from "./file1"; diff --git a/crates/swc/tests/tsc-references/tsxErrorRecovery2_es2015.1.normal.js b/crates/swc/tests/tsc-references/tsxErrorRecovery2_es2015.1.normal.js new file mode 100644 index 000000000000..7415e087826c --- /dev/null +++ b/crates/swc/tests/tsc-references/tsxErrorRecovery2_es2015.1.normal.js @@ -0,0 +1,25 @@ +//@jsx: preserve +//@filename: file1.tsx +//! +//! x Unexpected token `div`. Expected jsx identifier +//! ,---- +//! 4 |
+//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error +//@filename: file2.tsx +//! +//! x Unexpected token `div`. Expected jsx identifier +//! ,---- +//! 2 | var x =
+//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/tsxErrorRecovery2_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxErrorRecovery2_es2015.2.minified.js new file mode 100644 index 000000000000..0368778b2b49 --- /dev/null +++ b/crates/swc/tests/tsc-references/tsxErrorRecovery2_es2015.2.minified.js @@ -0,0 +1,24 @@ +//@filename: file1.tsx +//! +//! x Unexpected token `div`. Expected jsx identifier +//! ,---- +//! 4 |
+//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error +//@filename: file2.tsx +//! +//! x Unexpected token `div`. Expected jsx identifier +//! ,---- +//! 2 | var x =
+//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/tsxErrorRecovery2_es5.1.normal.js b/crates/swc/tests/tsc-references/tsxErrorRecovery2_es5.1.normal.js new file mode 100644 index 000000000000..7415e087826c --- /dev/null +++ b/crates/swc/tests/tsc-references/tsxErrorRecovery2_es5.1.normal.js @@ -0,0 +1,25 @@ +//@jsx: preserve +//@filename: file1.tsx +//! +//! x Unexpected token `div`. Expected jsx identifier +//! ,---- +//! 4 |
+//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error +//@filename: file2.tsx +//! +//! x Unexpected token `div`. Expected jsx identifier +//! ,---- +//! 2 | var x =
+//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/tsxErrorRecovery2_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxErrorRecovery2_es5.2.minified.js new file mode 100644 index 000000000000..0368778b2b49 --- /dev/null +++ b/crates/swc/tests/tsc-references/tsxErrorRecovery2_es5.2.minified.js @@ -0,0 +1,24 @@ +//@filename: file1.tsx +//! +//! x Unexpected token `div`. Expected jsx identifier +//! ,---- +//! 4 |
+//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error +//@filename: file2.tsx +//! +//! x Unexpected token `div`. Expected jsx identifier +//! ,---- +//! 2 | var x =
+//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/tsxErrorRecovery3_es2015.1.normal.js b/crates/swc/tests/tsc-references/tsxErrorRecovery3_es2015.1.normal.js new file mode 100644 index 000000000000..ce42981c6d3e --- /dev/null +++ b/crates/swc/tests/tsc-references/tsxErrorRecovery3_es2015.1.normal.js @@ -0,0 +1,25 @@ +//@jsx: react +//@filename: file1.tsx +//! +//! x Unexpected token `div`. Expected jsx identifier +//! ,---- +//! 4 |
+//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error +//@filename: file2.tsx +//! +//! x Unexpected token `div`. Expected jsx identifier +//! ,---- +//! 2 | var x =
+//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/tsxErrorRecovery3_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxErrorRecovery3_es2015.2.minified.js new file mode 100644 index 000000000000..0368778b2b49 --- /dev/null +++ b/crates/swc/tests/tsc-references/tsxErrorRecovery3_es2015.2.minified.js @@ -0,0 +1,24 @@ +//@filename: file1.tsx +//! +//! x Unexpected token `div`. Expected jsx identifier +//! ,---- +//! 4 |
+//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error +//@filename: file2.tsx +//! +//! x Unexpected token `div`. Expected jsx identifier +//! ,---- +//! 2 | var x =
+//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/tsxErrorRecovery3_es5.1.normal.js b/crates/swc/tests/tsc-references/tsxErrorRecovery3_es5.1.normal.js new file mode 100644 index 000000000000..ce42981c6d3e --- /dev/null +++ b/crates/swc/tests/tsc-references/tsxErrorRecovery3_es5.1.normal.js @@ -0,0 +1,25 @@ +//@jsx: react +//@filename: file1.tsx +//! +//! x Unexpected token `div`. Expected jsx identifier +//! ,---- +//! 4 |
+//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error +//@filename: file2.tsx +//! +//! x Unexpected token `div`. Expected jsx identifier +//! ,---- +//! 2 | var x =
+//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/tsxErrorRecovery3_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxErrorRecovery3_es5.2.minified.js new file mode 100644 index 000000000000..0368778b2b49 --- /dev/null +++ b/crates/swc/tests/tsc-references/tsxErrorRecovery3_es5.2.minified.js @@ -0,0 +1,24 @@ +//@filename: file1.tsx +//! +//! x Unexpected token `div`. Expected jsx identifier +//! ,---- +//! 4 |
+//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error +//@filename: file2.tsx +//! +//! x Unexpected token `div`. Expected jsx identifier +//! ,---- +//! 2 | var x =
+//! : ^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/tsxExternalModuleEmit1_es2015.1.normal.js b/crates/swc/tests/tsc-references/tsxExternalModuleEmit1_es2015.1.normal.js index 4a1e1014f029..044cdd349422 100644 --- a/crates/swc/tests/tsc-references/tsxExternalModuleEmit1_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxExternalModuleEmit1_es2015.1.normal.js @@ -3,6 +3,8 @@ //@filename: react.d.ts //@filename: app.tsx import * as React from 'react'; +// Should see var button_1 = require('./button') here +import { Button } from './button'; export class App extends React.Component { render() { return /*#__PURE__*/ React.createElement(Button, null); diff --git a/crates/swc/tests/tsc-references/tsxExternalModuleEmit1_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxExternalModuleEmit1_es2015.2.minified.js index 5bee802a3d2c..2e65f82ac7d0 100644 --- a/crates/swc/tests/tsc-references/tsxExternalModuleEmit1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxExternalModuleEmit1_es2015.2.minified.js @@ -1,4 +1,5 @@ import * as React from 'react'; +import { Button } from './button'; export class App extends React.Component { render() { return React.createElement(Button, null); diff --git a/crates/swc/tests/tsc-references/tsxExternalModuleEmit1_es5.1.normal.js b/crates/swc/tests/tsc-references/tsxExternalModuleEmit1_es5.1.normal.js index c91d61183862..5328834d5d1b 100644 --- a/crates/swc/tests/tsc-references/tsxExternalModuleEmit1_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxExternalModuleEmit1_es5.1.normal.js @@ -1,11 +1,13 @@ //@jsx: preserve //@module: commonjs //@filename: react.d.ts +//@filename: app.tsx import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; -//@filename: app.tsx import * as React from "react"; +// Should see var button_1 = require('./button') here +import { Button } from "./button"; export var App = /*#__PURE__*/ function(_Component) { "use strict"; _inherits(App, _Component); @@ -21,6 +23,9 @@ export var App = /*#__PURE__*/ function(_Component) { return App; }(React.Component); //@filename: button.tsx +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; import * as React from "react"; export var Button = /*#__PURE__*/ function(_Component) { "use strict"; diff --git a/crates/swc/tests/tsc-references/tsxExternalModuleEmit1_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxExternalModuleEmit1_es5.2.minified.js index e71bcf818938..3b58a6f66122 100644 --- a/crates/swc/tests/tsc-references/tsxExternalModuleEmit1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxExternalModuleEmit1_es5.2.minified.js @@ -2,6 +2,7 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; import * as React from "react"; +import { Button } from "./button"; export var App = function(_Component) { "use strict"; _inherits(App, _Component); @@ -13,6 +14,9 @@ export var App = function(_Component) { return React.createElement(Button, null); }, App; }(React.Component); +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +import _inherits from "@swc/helpers/src/_inherits.mjs"; +import _create_super from "@swc/helpers/src/_create_super.mjs"; import * as React from "react"; export var Button = function(_Component) { "use strict"; diff --git a/crates/swc/tests/tsc-references/tsxExternalModuleEmit2_es2015.1.normal.js b/crates/swc/tests/tsc-references/tsxExternalModuleEmit2_es2015.1.normal.js index 24f23d657e27..7ab8f592197d 100644 --- a/crates/swc/tests/tsc-references/tsxExternalModuleEmit2_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxExternalModuleEmit2_es2015.1.normal.js @@ -1,8 +1,8 @@ //@jsx: react //@module: commonjs //@filename: modules.d.ts -import _extends from "@swc/helpers/src/_extends.mjs"; //@filename: app.tsx +import _extends from "@swc/helpers/src/_extends.mjs"; import Main from 'mod'; // Should see mod_1['default'] in emit here /*#__PURE__*/ React.createElement(Foo, { diff --git a/crates/swc/tests/tsc-references/tsxExternalModuleEmit2_es5.1.normal.js b/crates/swc/tests/tsc-references/tsxExternalModuleEmit2_es5.1.normal.js index fe6271641a78..6be5de59e120 100644 --- a/crates/swc/tests/tsc-references/tsxExternalModuleEmit2_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxExternalModuleEmit2_es5.1.normal.js @@ -1,8 +1,8 @@ //@jsx: react //@module: commonjs //@filename: modules.d.ts -import _extends from "@swc/helpers/src/_extends.mjs"; //@filename: app.tsx +import _extends from "@swc/helpers/src/_extends.mjs"; import Main from "mod"; // Should see mod_1['default'] in emit here /*#__PURE__*/ React.createElement(Foo, { diff --git a/crates/swc/tests/tsc-references/tsxPreserveEmit1_es2015.1.normal.js b/crates/swc/tests/tsc-references/tsxPreserveEmit1_es2015.1.normal.js index 79d739a1adb5..4641eb3602f8 100644 --- a/crates/swc/tests/tsc-references/tsxPreserveEmit1_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxPreserveEmit1_es2015.1.normal.js @@ -2,6 +2,22 @@ //@jsx: preserve //@target: ES5 //@Filename: react.d.ts +//! +//! x multiple `export =` found +//! ,-[4:5] +//! 4 | export = x; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 5 | } +//! 6 | +//! 7 | declare module ReactRouter { +//! 8 | var Route: any; +//! 9 | interface Thing { } +//! 10 | } +//! 11 | declare module 'react-router' { +//! 12 | export = ReactRouter; +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- //@Filename: test.tsx // Should emit 'react-router' in the AMD dependency list const React = require('react'); diff --git a/crates/swc/tests/tsc-references/tsxPreserveEmit1_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxPreserveEmit1_es2015.2.minified.js index b70b42ee25ed..4d2d550fb8e8 100644 --- a/crates/swc/tests/tsc-references/tsxPreserveEmit1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxPreserveEmit1_es2015.2.minified.js @@ -1,3 +1,20 @@ +//@Filename: react.d.ts +//! +//! x multiple `export =` found +//! ,-[4:5] +//! 4 | export = x; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 5 | } +//! 6 | +//! 7 | declare module ReactRouter { +//! 8 | var Route: any; +//! 9 | interface Thing { } +//! 10 | } +//! 11 | declare module 'react-router' { +//! 12 | export = ReactRouter; +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- var M; require('react'); let ReactRouter = require('react-router'); diff --git a/crates/swc/tests/tsc-references/tsxPreserveEmit1_es5.1.normal.js b/crates/swc/tests/tsc-references/tsxPreserveEmit1_es5.1.normal.js index f9b5d970d36c..e18a57e7e505 100644 --- a/crates/swc/tests/tsc-references/tsxPreserveEmit1_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxPreserveEmit1_es5.1.normal.js @@ -2,6 +2,22 @@ //@jsx: preserve //@target: ES5 //@Filename: react.d.ts +//! +//! x multiple `export =` found +//! ,-[4:5] +//! 4 | export = x; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 5 | } +//! 6 | +//! 7 | declare module ReactRouter { +//! 8 | var Route: any; +//! 9 | interface Thing { } +//! 10 | } +//! 11 | declare module 'react-router' { +//! 12 | export = ReactRouter; +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- //@Filename: test.tsx // Should emit 'react-router' in the AMD dependency list var React = require("react"); diff --git a/crates/swc/tests/tsc-references/tsxPreserveEmit1_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxPreserveEmit1_es5.2.minified.js index 760789b17afc..c39fba23939a 100644 --- a/crates/swc/tests/tsc-references/tsxPreserveEmit1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxPreserveEmit1_es5.2.minified.js @@ -1,3 +1,20 @@ +//@Filename: react.d.ts +//! +//! x multiple `export =` found +//! ,-[4:5] +//! 4 | export = x; +//! : ^^^^^|^^^^^ +//! : `-- previous `export =` declared here +//! 5 | } +//! 6 | +//! 7 | declare module ReactRouter { +//! 8 | var Route: any; +//! 9 | interface Thing { } +//! 10 | } +//! 11 | declare module 'react-router' { +//! 12 | export = ReactRouter; +//! : ^^^^^^^^^^^^^^^^^^^^^ +//! `---- var M; require("react"), require("react-router").Route, function(M) { var X1; diff --git a/crates/swc/tests/tsc-references/tsxReactEmit5_es2015.1.normal.js b/crates/swc/tests/tsc-references/tsxReactEmit5_es2015.1.normal.js index 32bad21e5680..33cfb6b27781 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmit5_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxReactEmit5_es2015.1.normal.js @@ -1,10 +1,10 @@ //@jsx: react //@module: commonjs //@filename: file.tsx -import _extends from "@swc/helpers/src/_extends.mjs"; //@filename: test.d.ts export var React; //@filename: react-consumer.tsx +import _extends from "@swc/helpers/src/_extends.mjs"; import { React } from "./test"; // Should emit test_1.React.createElement // and React.__spread diff --git a/crates/swc/tests/tsc-references/tsxReactEmit5_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmit5_es2015.2.minified.js index 97a54ed52f79..0e8c788e11fd 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmit5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmit5_es2015.2.minified.js @@ -1,6 +1,6 @@ +export var React; var foo; import _extends from "@swc/helpers/src/_extends.mjs"; -export var React; import { React } from "./test"; _extends({ x: "" diff --git a/crates/swc/tests/tsc-references/tsxReactEmit5_es5.1.normal.js b/crates/swc/tests/tsc-references/tsxReactEmit5_es5.1.normal.js index 32bad21e5680..33cfb6b27781 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmit5_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxReactEmit5_es5.1.normal.js @@ -1,10 +1,10 @@ //@jsx: react //@module: commonjs //@filename: file.tsx -import _extends from "@swc/helpers/src/_extends.mjs"; //@filename: test.d.ts export var React; //@filename: react-consumer.tsx +import _extends from "@swc/helpers/src/_extends.mjs"; import { React } from "./test"; // Should emit test_1.React.createElement // and React.__spread diff --git a/crates/swc/tests/tsc-references/tsxReactEmit5_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmit5_es5.2.minified.js index 97a54ed52f79..0e8c788e11fd 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmit5_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmit5_es5.2.minified.js @@ -1,6 +1,6 @@ +export var React; var foo; import _extends from "@swc/helpers/src/_extends.mjs"; -export var React; import { React } from "./test"; _extends({ x: "" diff --git a/crates/swc/tests/tsc-references/tsxReactEmit6_es2015.1.normal.js b/crates/swc/tests/tsc-references/tsxReactEmit6_es2015.1.normal.js index 627ded8fae81..b726b6c8d165 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmit6_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxReactEmit6_es2015.1.normal.js @@ -1,8 +1,8 @@ //@jsx: react //@module: commonjs //@filename: file.tsx -import _extends from "@swc/helpers/src/_extends.mjs"; //@filename: react-consumer.tsx +import _extends from "@swc/helpers/src/_extends.mjs"; var M; (function(M) { var React1; diff --git a/crates/swc/tests/tsc-references/tsxReactEmit6_es5.1.normal.js b/crates/swc/tests/tsc-references/tsxReactEmit6_es5.1.normal.js index 627ded8fae81..b726b6c8d165 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmit6_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxReactEmit6_es5.1.normal.js @@ -1,8 +1,8 @@ //@jsx: react //@module: commonjs //@filename: file.tsx -import _extends from "@swc/helpers/src/_extends.mjs"; //@filename: react-consumer.tsx +import _extends from "@swc/helpers/src/_extends.mjs"; var M; (function(M) { var React1; diff --git a/crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType_es2015.1.normal.js b/crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType_es2015.1.normal.js index 009631ea3553..8ffce5047b9e 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType_es2015.1.normal.js @@ -1,15 +1,12 @@ -// @jsx: react,react-jsx -// @target: es2015,es5 -import _extends from "@swc/helpers/src/_extends.mjs"; -function Todo(prop) { - return /*#__PURE__*/ React.createElement("div", null, prop.key.toString() + prop.todo); -} -function TodoList({ todos }) { - return /*#__PURE__*/ React.createElement("div", null); -} -function TodoListNoError({ todos }) { - // any is not checked - return /*#__PURE__*/ React.createElement("div", null); -} -let x; -/*#__PURE__*/ React.createElement(TodoList, _extends({}, x)); +//! +//! x Spread children are not supported in React. +//! ,---- +//! 23 | {...} +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x Spread children are not supported in React. +//! ,---- +//! 29 | {...( as any)} +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType_es2015.2.minified.js index bfe2ed9d4834..8ffce5047b9e 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType_es2015.2.minified.js @@ -1,2 +1,12 @@ -import _extends from "@swc/helpers/src/_extends.mjs"; -_extends({}, void 0); +//! +//! x Spread children are not supported in React. +//! ,---- +//! 23 | {...} +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x Spread children are not supported in React. +//! ,---- +//! 29 | {...( as any)} +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType_es5.1.normal.js b/crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType_es5.1.normal.js index 6aad14ef176b..8ffce5047b9e 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType_es5.1.normal.js @@ -1,17 +1,12 @@ -// @jsx: react,react-jsx -// @target: es2015,es5 -import _extends from "@swc/helpers/src/_extends.mjs"; -function Todo(prop) { - return /*#__PURE__*/ React.createElement("div", null, prop.key.toString() + prop.todo); -} -function TodoList(param) { - var todos = param.todos; - return /*#__PURE__*/ React.createElement("div", null); -} -function TodoListNoError(param) { - var todos = param.todos; - // any is not checked - return /*#__PURE__*/ React.createElement("div", null); -} -var x; -/*#__PURE__*/ React.createElement(TodoList, _extends({}, x)); +//! +//! x Spread children are not supported in React. +//! ,---- +//! 23 | {...} +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x Spread children are not supported in React. +//! ,---- +//! 29 | {...( as any)} +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType_es5.2.minified.js index 65b51afa4ce2..8ffce5047b9e 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType_es5.2.minified.js @@ -1,3 +1,12 @@ -var x; -import _extends from "@swc/helpers/src/_extends.mjs"; -_extends({}, x); +//! +//! x Spread children are not supported in React. +//! ,---- +//! 23 | {...} +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- +//! +//! x Spread children are not supported in React. +//! ,---- +//! 29 | {...( as any)} +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/tsxSpreadChildren_es2015.1.normal.js b/crates/swc/tests/tsc-references/tsxSpreadChildren_es2015.1.normal.js index 499659c76b9b..2f16978a0430 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadChildren_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxSpreadChildren_es2015.1.normal.js @@ -1,10 +1,6 @@ -//@jsx: preserve -import _extends from "@swc/helpers/src/_extends.mjs"; -function Todo(prop) { - return /*#__PURE__*/ React.createElement("div", null, prop.key.toString() + prop.todo); -} -function TodoList({ todos }) { - return /*#__PURE__*/ React.createElement("div", null); -} -let x; -/*#__PURE__*/ React.createElement(TodoList, _extends({}, x)); +//! +//! x Spread children are not supported in React. +//! ,---- +//! 23 | {...todos.map(todo => )} +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/tsxSpreadChildren_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadChildren_es2015.2.minified.js index bfe2ed9d4834..2f16978a0430 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadChildren_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadChildren_es2015.2.minified.js @@ -1,2 +1,6 @@ -import _extends from "@swc/helpers/src/_extends.mjs"; -_extends({}, void 0); +//! +//! x Spread children are not supported in React. +//! ,---- +//! 23 | {...todos.map(todo => )} +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/tsxSpreadChildren_es5.1.normal.js b/crates/swc/tests/tsc-references/tsxSpreadChildren_es5.1.normal.js index 31c6b4bb6ce7..2f16978a0430 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadChildren_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxSpreadChildren_es5.1.normal.js @@ -1,11 +1,6 @@ -//@jsx: preserve -import _extends from "@swc/helpers/src/_extends.mjs"; -function Todo(prop) { - return /*#__PURE__*/ React.createElement("div", null, prop.key.toString() + prop.todo); -} -function TodoList(param) { - var todos = param.todos; - return /*#__PURE__*/ React.createElement("div", null); -} -var x; -/*#__PURE__*/ React.createElement(TodoList, _extends({}, x)); +//! +//! x Spread children are not supported in React. +//! ,---- +//! 23 | {...todos.map(todo => )} +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/tsxSpreadChildren_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadChildren_es5.2.minified.js index 65b51afa4ce2..2f16978a0430 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadChildren_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadChildren_es5.2.minified.js @@ -1,3 +1,6 @@ -var x; -import _extends from "@swc/helpers/src/_extends.mjs"; -_extends({}, x); +//! +//! x Spread children are not supported in React. +//! ,---- +//! 23 | {...todos.map(todo => )} +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! `---- diff --git a/crates/swc/tests/tsc-references/typeFromParamTagForFunction_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeFromParamTagForFunction_es2015.2.minified.js index cf07152215e5..249df184b4b9 100644 --- a/crates/swc/tests/tsc-references/typeFromParamTagForFunction_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromParamTagForFunction_es2015.2.minified.js @@ -1,24 +1,24 @@ exports.A = function() { this.x = 1; }; -let { A } = require("./a-ext"); +const { A } = require("./a-ext"); exports.B = class { constructor(){ this.x = 1; } }; -let { B } = require("./b-ext"); +const { B } = require("./b-ext"); export function C() { this.x = 1; } -let { C } = require("./c-ext"); +const { C } = require("./c-ext"); export var D = function() { this.x = 1; }; -let { D } = require("./d-ext"); +const { D } = require("./d-ext"); export class E { constructor(){ this.x = 1; } } -let { E } = require("./e-ext"); +const { E } = require("./e-ext"); diff --git a/crates/swc/tests/tsc-references/typeFromParamTagForFunction_es5.1.normal.js b/crates/swc/tests/tsc-references/typeFromParamTagForFunction_es5.1.normal.js index 6f2d7449be85..bd87e228eabf 100644 --- a/crates/swc/tests/tsc-references/typeFromParamTagForFunction_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/typeFromParamTagForFunction_es5.1.normal.js @@ -3,7 +3,6 @@ // @noEmit: true // @module: commonjs // @filename: node.d.ts -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; // @filename: a-ext.js exports.A = function() { this.x = 1; @@ -14,6 +13,7 @@ var A = require("./a-ext").A; p.x; } // @filename: b-ext.js +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; exports.B = function _class() { "use strict"; _class_call_check(this, _class); @@ -43,6 +43,7 @@ var D = require("./d-ext").D; p.x; } // @filename: e-ext.js +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export var E = function E() { "use strict"; _class_call_check(this, E); @@ -68,6 +69,7 @@ function G() { p.x; } // @filename: h.js +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var H = function H() { "use strict"; _class_call_check(this, H); diff --git a/crates/swc/tests/tsc-references/typeFromParamTagForFunction_es5.2.minified.js b/crates/swc/tests/tsc-references/typeFromParamTagForFunction_es5.2.minified.js index d27b6b9232ba..37e428525fc6 100644 --- a/crates/swc/tests/tsc-references/typeFromParamTagForFunction_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromParamTagForFunction_es5.2.minified.js @@ -1,10 +1,13 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; exports.A = function() { this.x = 1; -}, require("./a-ext").A, exports.B = function _class() { +}; +require("./a-ext").A; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +exports.B = function _class() { "use strict"; _class_call_check(this, _class), this.x = 1; -}, require("./b-ext").B; +}; +require("./b-ext").B; export function C() { this.x = 1; } @@ -13,11 +16,14 @@ export var D = function() { this.x = 1; }; require("./d-ext").D; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export var E = function() { "use strict"; _class_call_check(this, E), this.x = 1; }; -var E = require("./e-ext").E, H = function() { +require("./e-ext").E; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +var H = function() { "use strict"; _class_call_check(this, H), this.x = 1; }; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment10_1_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment10_1_es2015.2.minified.js index c9a2e2d4d010..b1fb15ce42fc 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment10_1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment10_1_es2015.2.minified.js @@ -1,11 +1,15 @@ -var _app, x, Outer = null != Outer ? Outer : {}; -Outer.app = null !== (_app = Outer.app) && void 0 !== _app ? _app : {}, Outer.app.SomeView = function() {}, Outer.app.Inner = class { +var _app, Outer = null != Outer ? Outer : {}; +Outer.app = null !== (_app = Outer.app) && void 0 !== _app ? _app : {}; +Outer.app.SomeView = function() {}, Outer.app.Inner = class { constructor(){ this.y = 12; } }, new Outer.app.Inner().y, Outer.app.statische = function(k) { return Math.pow(k, k); -}, Outer.app.Application = function() { +}; +Outer.app.Application = function() { var me = this; me.view = new Outer.app.SomeView(); -}, new Outer.app.Application(), new Outer.app.Inner().y, x.y, Outer.app.statische(101); +}; +var x; +new Outer.app.Application(), new Outer.app.Inner().y, x.y, Outer.app.statische(101); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment10_1_es5.1.normal.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment10_1_es5.1.normal.js index e320fae681e6..dd8905f44fe4 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment10_1_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment10_1_es5.1.normal.js @@ -3,11 +3,11 @@ // @checkJs: true // @target: esnext // @Filename: module.js -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var Outer = Outer !== null && Outer !== void 0 ? Outer : {}; var _app; Outer.app = (_app = Outer.app) !== null && _app !== void 0 ? _app : {}; // @Filename: someview.js +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; Outer.app.SomeView = function() { var SomeView = function SomeView() { var me = this; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment10_1_es5.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment10_1_es5.2.minified.js index 153635f72657..1d5c95fce7df 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment10_1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment10_1_es5.2.minified.js @@ -1,11 +1,15 @@ +var _app, Outer = null != Outer ? Outer : {}; +Outer.app = null !== (_app = Outer.app) && void 0 !== _app ? _app : {}; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var _app, x, Outer = null != Outer ? Outer : {}; -Outer.app = null !== (_app = Outer.app) && void 0 !== _app ? _app : {}, Outer.app.SomeView = function() {}, Outer.app.Inner = function _class() { +Outer.app.SomeView = function() {}, Outer.app.Inner = function _class() { "use strict"; _class_call_check(this, _class), this.y = 12; }, new Outer.app.Inner().y, Outer.app.statische = function(k) { return Math.pow(k, k); -}, Outer.app.Application = function() { +}; +Outer.app.Application = function() { var me = this; me.view = new Outer.app.SomeView(); -}, new Outer.app.Application(), new Outer.app.Inner().y, x.y, Outer.app.statische(101); +}; +var x; +new Outer.app.Application(), new Outer.app.Inner().y, x.y, Outer.app.statische(101); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment10_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment10_es2015.2.minified.js index 20c8fcbfc2ed..fd04ac07f2e6 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment10_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment10_es2015.2.minified.js @@ -1,11 +1,15 @@ -var x, Outer = Outer || {}; -Outer.app = Outer.app || {}, Outer.app.SomeView = function() {}, Outer.app.Inner = class { +var Outer = Outer || {}; +Outer.app = Outer.app || {}; +Outer.app.SomeView = function() {}, Outer.app.Inner = class { constructor(){ this.y = 12; } }, new Outer.app.Inner().y, Outer.app.statische = function(k) { return Math.pow(k, k); -}, Outer.app.Application = function() { +}; +Outer.app.Application = function() { var me = this; me.view = new Outer.app.SomeView(); -}, new Outer.app.Application(), new Outer.app.Inner().y, x.y, Outer.app.statische(101); +}; +var x; +new Outer.app.Application(), new Outer.app.Inner().y, x.y, Outer.app.statische(101); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment10_es5.1.normal.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment10_es5.1.normal.js index 3af8c7314e12..4b5113bee4ef 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment10_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment10_es5.1.normal.js @@ -3,10 +3,10 @@ // @checkJs: true // @target: es6 // @Filename: module.js -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var Outer = Outer || {}; Outer.app = Outer.app || {}; // @Filename: someview.js +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; Outer.app.SomeView = function() { var SomeView = function SomeView() { var me = this; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment10_es5.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment10_es5.2.minified.js index 8b2dae07406d..d3146bde1d3b 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment10_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment10_es5.2.minified.js @@ -1,11 +1,15 @@ +var Outer = Outer || {}; +Outer.app = Outer.app || {}; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var x, Outer = Outer || {}; -Outer.app = Outer.app || {}, Outer.app.SomeView = function() {}, Outer.app.Inner = function _class() { +Outer.app.SomeView = function() {}, Outer.app.Inner = function _class() { "use strict"; _class_call_check(this, _class), this.y = 12; }, new Outer.app.Inner().y, Outer.app.statische = function(k) { return Math.pow(k, k); -}, Outer.app.Application = function() { +}; +Outer.app.Application = function() { var me = this; me.view = new Outer.app.SomeView(); -}, new Outer.app.Application(), new Outer.app.Inner().y, x.y, Outer.app.statische(101); +}; +var x; +new Outer.app.Application(), new Outer.app.Inner().y, x.y, Outer.app.statische(101); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment12_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment12_es2015.2.minified.js index 80461d3308b5..da1f9d62b110 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment12_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment12_es2015.2.minified.js @@ -1,2 +1 @@ -var Outer = function(element, config) {}; Outer.Pos = function(line, ch) {}, Outer.Pos.prototype.line, new Outer.Pos(1, 'x').line; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment12_es5.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment12_es5.2.minified.js index b257288318cb..45f8e37e9998 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment12_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment12_es5.2.minified.js @@ -1,2 +1 @@ -var Outer = function(element, config) {}; Outer.Pos = function(line, ch) {}, Outer.Pos.prototype.line, new Outer.Pos(1, "x").line; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment14_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment14_es2015.2.minified.js index 40ab0b0d323b..468800c5c1a2 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment14_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment14_es2015.2.minified.js @@ -1,7 +1,7 @@ -var inner, Outer = {}; Outer.Inner = function() {}, Outer.Inner.prototype = { x: 1, m () {} -}, inner.x, inner.m(); -var inno = new Outer.Inner(); +}; +inner.x, inner.m(); +var inner, inno = new Outer.Inner(); inno.x, inno.m(); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment14_es5.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment14_es5.2.minified.js index 0b9e16e01642..f7c0addf4982 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment14_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment14_es5.2.minified.js @@ -1,7 +1,7 @@ -var inner, Outer = {}; Outer.Inner = function() {}, Outer.Inner.prototype = { x: 1, m: function() {} -}, inner.x, inner.m(); -var inno = new Outer.Inner(); +}; +inner.x, inner.m(); +var inner, inno = new Outer.Inner(); inno.x, inno.m(); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment19_es5.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment19_es5.2.minified.js index aaaf6bb6c040..a14b6753ed5f 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment19_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment19_es5.2.minified.js @@ -4,5 +4,4 @@ function C() { exports = module.exports = C, C.f = function(n) { return n + 1; }; -var C = require("./semver"); -C.f(1); +require("./semver").f(1); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment24_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment24_es2015.2.minified.js index 6eb44bc51f94..3a5120ba4f83 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment24_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment24_es2015.2.minified.js @@ -1,6 +1,6 @@ +var x; Outer.Inner.Message = function() {}, new Outer.Inner().name, x.name; -var x, Outer = {}; -Outer.Inner = class { +({}).Inner = class { name() { return 'hi'; } diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment24_es5.1.normal.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment24_es5.1.normal.js index 03c9f7dd438f..eb45073d4013 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment24_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment24_es5.1.normal.js @@ -3,13 +3,13 @@ // @allowJs: true // @Filename: usage.js // note that usage is first in the compilation -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; Outer.Inner.Message = function() {}; var y = new Outer.Inner(); y.name; /** @type {Outer.Inner} should be instance type, not static type */ var x; x.name; // @Filename: def.js +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var Outer = {}; Outer.Inner = /*#__PURE__*/ function() { "use strict"; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment24_es5.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment24_es5.2.minified.js index 5c0b30731ab7..8d7e9bf37cc8 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment24_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment24_es5.2.minified.js @@ -1,7 +1,7 @@ -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +var x; Outer.Inner.Message = function() {}, new Outer.Inner().name, x.name; -var x, Outer = {}; -Outer.Inner = function() { +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +({}).Inner = function() { "use strict"; function _class() { _class_call_check(this, _class); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment32_es2015.1.normal.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment32_es2015.1.normal.js index 9df0a4c70b13..95c34e6a0366 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment32_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment32_es2015.1.normal.js @@ -13,6 +13,8 @@ ExpandoMerge.p7 = 777777; ExpandoMerge.p8 = false; // type error ExpandoMerge.p9 = false; // type error var n = ExpandoMerge.p1 + ExpandoMerge.p2 + ExpandoMerge.p3 + ExpandoMerge.p4 + ExpandoMerge.p5 + ExpandoMerge.p6 + ExpandoMerge.p7 + ExpandoMerge.p8 + ExpandoMerge.p9 + ExpandoMerge.m(12) + ExpandoMerge(1001); +// @Filename: ns.ts +var ExpandoMerge; (function(ExpandoMerge) { var p3 = ExpandoMerge.p3 = 333; var p4 = ExpandoMerge.p4 = 4; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment32_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment32_es2015.2.minified.js index 5ed08c9d2cc9..4026a2d51890 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment32_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment32_es2015.2.minified.js @@ -3,6 +3,8 @@ function ExpandoMerge(n) { } ExpandoMerge.p1 = 111, ExpandoMerge.m = function(n) { return n + 1; -}, ExpandoMerge.p4 = 44444, ExpandoMerge.p5 = 555555, ExpandoMerge.p6 = 66666, ExpandoMerge.p7 = 777777, ExpandoMerge.p8 = !1, ExpandoMerge.p9 = !1, ExpandoMerge.p1, ExpandoMerge.p2, ExpandoMerge.p3, ExpandoMerge.p4, ExpandoMerge.p5, ExpandoMerge.p6, ExpandoMerge.p7, ExpandoMerge.p8, ExpandoMerge.p9, ExpandoMerge.m(12), ExpandoMerge(1001), function(ExpandoMerge) { +}, ExpandoMerge.p4 = 44444, ExpandoMerge.p5 = 555555, ExpandoMerge.p6 = 66666, ExpandoMerge.p7 = 777777, ExpandoMerge.p8 = !1, ExpandoMerge.p9 = !1, ExpandoMerge.p1, ExpandoMerge.p2, ExpandoMerge.p3, ExpandoMerge.p4, ExpandoMerge.p5, ExpandoMerge.p6, ExpandoMerge.p7, ExpandoMerge.p8, ExpandoMerge.p9, ExpandoMerge.m(12); +var ExpandoMerge; +!function(ExpandoMerge) { ExpandoMerge.p3 = 333, ExpandoMerge.p4 = 4, ExpandoMerge.p5 = 5, ExpandoMerge.p6 = 6, ExpandoMerge.p7 = 7, ExpandoMerge.p8 = 6, ExpandoMerge.p9 = 7; }(ExpandoMerge || (ExpandoMerge = {})), (ExpandoMerge || (ExpandoMerge = {})).p2 = 222; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment32_es5.1.normal.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment32_es5.1.normal.js index 9df0a4c70b13..95c34e6a0366 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment32_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment32_es5.1.normal.js @@ -13,6 +13,8 @@ ExpandoMerge.p7 = 777777; ExpandoMerge.p8 = false; // type error ExpandoMerge.p9 = false; // type error var n = ExpandoMerge.p1 + ExpandoMerge.p2 + ExpandoMerge.p3 + ExpandoMerge.p4 + ExpandoMerge.p5 + ExpandoMerge.p6 + ExpandoMerge.p7 + ExpandoMerge.p8 + ExpandoMerge.p9 + ExpandoMerge.m(12) + ExpandoMerge(1001); +// @Filename: ns.ts +var ExpandoMerge; (function(ExpandoMerge) { var p3 = ExpandoMerge.p3 = 333; var p4 = ExpandoMerge.p4 = 4; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment32_es5.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment32_es5.2.minified.js index 5ed08c9d2cc9..4026a2d51890 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment32_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment32_es5.2.minified.js @@ -3,6 +3,8 @@ function ExpandoMerge(n) { } ExpandoMerge.p1 = 111, ExpandoMerge.m = function(n) { return n + 1; -}, ExpandoMerge.p4 = 44444, ExpandoMerge.p5 = 555555, ExpandoMerge.p6 = 66666, ExpandoMerge.p7 = 777777, ExpandoMerge.p8 = !1, ExpandoMerge.p9 = !1, ExpandoMerge.p1, ExpandoMerge.p2, ExpandoMerge.p3, ExpandoMerge.p4, ExpandoMerge.p5, ExpandoMerge.p6, ExpandoMerge.p7, ExpandoMerge.p8, ExpandoMerge.p9, ExpandoMerge.m(12), ExpandoMerge(1001), function(ExpandoMerge) { +}, ExpandoMerge.p4 = 44444, ExpandoMerge.p5 = 555555, ExpandoMerge.p6 = 66666, ExpandoMerge.p7 = 777777, ExpandoMerge.p8 = !1, ExpandoMerge.p9 = !1, ExpandoMerge.p1, ExpandoMerge.p2, ExpandoMerge.p3, ExpandoMerge.p4, ExpandoMerge.p5, ExpandoMerge.p6, ExpandoMerge.p7, ExpandoMerge.p8, ExpandoMerge.p9, ExpandoMerge.m(12); +var ExpandoMerge; +!function(ExpandoMerge) { ExpandoMerge.p3 = 333, ExpandoMerge.p4 = 4, ExpandoMerge.p5 = 5, ExpandoMerge.p6 = 6, ExpandoMerge.p7 = 7, ExpandoMerge.p8 = 6, ExpandoMerge.p9 = 7; }(ExpandoMerge || (ExpandoMerge = {})), (ExpandoMerge || (ExpandoMerge = {})).p2 = 222; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment33_es2015.1.normal.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment33_es2015.1.normal.js index 5e1c7ef582ab..23ccd0fcd061 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment33_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment33_es2015.1.normal.js @@ -1,4 +1,5 @@ // @Filename: ns.ts +var ExpandoMerge; (function(ExpandoMerge) { var p3 = ExpandoMerge.p3 = 333; var p4 = ExpandoMerge.p4 = 4; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment33_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment33_es2015.2.minified.js index 8ed5188c8e39..7c9b9d7c75ca 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment33_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment33_es2015.2.minified.js @@ -1,8 +1,10 @@ +var ExpandoMerge; +!function(ExpandoMerge) { + ExpandoMerge.p3 = 333, ExpandoMerge.p4 = 4, ExpandoMerge.p5 = 5, ExpandoMerge.p6 = 6, ExpandoMerge.p7 = 7, ExpandoMerge.p8 = 6, ExpandoMerge.p9 = 7; +}(ExpandoMerge || (ExpandoMerge = {})), (ExpandoMerge || (ExpandoMerge = {})).p2 = 222; function ExpandoMerge(n) { return n; } -!function(ExpandoMerge) { - ExpandoMerge.p3 = 333, ExpandoMerge.p4 = 4, ExpandoMerge.p5 = 5, ExpandoMerge.p6 = 6, ExpandoMerge.p7 = 7, ExpandoMerge.p8 = 6, ExpandoMerge.p9 = 7; -}(ExpandoMerge || (ExpandoMerge = {})), (ExpandoMerge || (ExpandoMerge = {})).p2 = 222, ExpandoMerge.p1 = 111, ExpandoMerge.m = function(n) { +ExpandoMerge.p1 = 111, ExpandoMerge.m = function(n) { return n + 1; -}, ExpandoMerge.p4 = 44444, ExpandoMerge.p5 = 555555, ExpandoMerge.p6 = 66666, ExpandoMerge.p7 = 777777, ExpandoMerge.p8 = !1, ExpandoMerge.p9 = !1, ExpandoMerge.p1, ExpandoMerge.p2, ExpandoMerge.p3, ExpandoMerge.p4, ExpandoMerge.p5, ExpandoMerge.p6, ExpandoMerge.p7, ExpandoMerge.p8, ExpandoMerge.p9, ExpandoMerge.m(12), ExpandoMerge(1001); +}, ExpandoMerge.p4 = 44444, ExpandoMerge.p5 = 555555, ExpandoMerge.p6 = 66666, ExpandoMerge.p7 = 777777, ExpandoMerge.p8 = !1, ExpandoMerge.p9 = !1, ExpandoMerge.p1, ExpandoMerge.p2, ExpandoMerge.p3, ExpandoMerge.p4, ExpandoMerge.p5, ExpandoMerge.p6, ExpandoMerge.p7, ExpandoMerge.p8, ExpandoMerge.p9, ExpandoMerge.m(12); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment33_es5.1.normal.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment33_es5.1.normal.js index 5e1c7ef582ab..23ccd0fcd061 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment33_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment33_es5.1.normal.js @@ -1,4 +1,5 @@ // @Filename: ns.ts +var ExpandoMerge; (function(ExpandoMerge) { var p3 = ExpandoMerge.p3 = 333; var p4 = ExpandoMerge.p4 = 4; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment33_es5.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment33_es5.2.minified.js index 8ed5188c8e39..7c9b9d7c75ca 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment33_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment33_es5.2.minified.js @@ -1,8 +1,10 @@ +var ExpandoMerge; +!function(ExpandoMerge) { + ExpandoMerge.p3 = 333, ExpandoMerge.p4 = 4, ExpandoMerge.p5 = 5, ExpandoMerge.p6 = 6, ExpandoMerge.p7 = 7, ExpandoMerge.p8 = 6, ExpandoMerge.p9 = 7; +}(ExpandoMerge || (ExpandoMerge = {})), (ExpandoMerge || (ExpandoMerge = {})).p2 = 222; function ExpandoMerge(n) { return n; } -!function(ExpandoMerge) { - ExpandoMerge.p3 = 333, ExpandoMerge.p4 = 4, ExpandoMerge.p5 = 5, ExpandoMerge.p6 = 6, ExpandoMerge.p7 = 7, ExpandoMerge.p8 = 6, ExpandoMerge.p9 = 7; -}(ExpandoMerge || (ExpandoMerge = {})), (ExpandoMerge || (ExpandoMerge = {})).p2 = 222, ExpandoMerge.p1 = 111, ExpandoMerge.m = function(n) { +ExpandoMerge.p1 = 111, ExpandoMerge.m = function(n) { return n + 1; -}, ExpandoMerge.p4 = 44444, ExpandoMerge.p5 = 555555, ExpandoMerge.p6 = 66666, ExpandoMerge.p7 = 777777, ExpandoMerge.p8 = !1, ExpandoMerge.p9 = !1, ExpandoMerge.p1, ExpandoMerge.p2, ExpandoMerge.p3, ExpandoMerge.p4, ExpandoMerge.p5, ExpandoMerge.p6, ExpandoMerge.p7, ExpandoMerge.p8, ExpandoMerge.p9, ExpandoMerge.m(12), ExpandoMerge(1001); +}, ExpandoMerge.p4 = 44444, ExpandoMerge.p5 = 555555, ExpandoMerge.p6 = 66666, ExpandoMerge.p7 = 777777, ExpandoMerge.p8 = !1, ExpandoMerge.p9 = !1, ExpandoMerge.p1, ExpandoMerge.p2, ExpandoMerge.p3, ExpandoMerge.p4, ExpandoMerge.p5, ExpandoMerge.p6, ExpandoMerge.p7, ExpandoMerge.p8, ExpandoMerge.p9, ExpandoMerge.m(12); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment34_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment34_es2015.2.minified.js index b116e6a03a0b..dca6716f4fce 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment34_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment34_es2015.2.minified.js @@ -1,2 +1,2 @@ -var N = {}; -N.commands = {}, N.commands.a = 111, N.commands.b = function() {}; +({}).commands = {}; +N.commands.a = 111, N.commands.b = function() {}; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment34_es5.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment34_es5.2.minified.js index b116e6a03a0b..dca6716f4fce 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment34_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment34_es5.2.minified.js @@ -1,2 +1,2 @@ -var N = {}; -N.commands = {}, N.commands.a = 111, N.commands.b = function() {}; +({}).commands = {}; +N.commands.a = 111, N.commands.b = function() {}; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment35_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment35_es2015.2.minified.js index 92c27e0ddfd3..c85f3d781281 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment35_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment35_es2015.2.minified.js @@ -3,5 +3,4 @@ Emu.D = class { this._model = 1; } }; -var Emu = {}; -Emu.D._wrapperInstance; +({}).D._wrapperInstance; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment35_es5.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment35_es5.2.minified.js index b2790c599b11..4fae47e1be8c 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment35_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment35_es5.2.minified.js @@ -3,5 +3,4 @@ Emu.D = function _class() { "use strict"; _class_call_check(this, _class), this._model = 1; }; -var Emu = {}; -Emu.D._wrapperInstance; +({}).D._wrapperInstance; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment37_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment37_es2015.2.minified.js index ab296a3bc0ab..1095a570d6cf 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment37_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment37_es2015.2.minified.js @@ -1,2 +1,3 @@ -const util = exports = module.exports = {}, util = require('./mod'); +exports = module.exports = {}; +const util = require('./mod'); util.existy; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment37_es5.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment37_es5.2.minified.js index 848fb87920f2..7f9fc23d5f2c 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment37_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment37_es5.2.minified.js @@ -1 +1,2 @@ -(exports = module.exports = {}, require("./mod")).existy; +exports = module.exports = {}; +require("./mod").existy; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment4_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment4_es2015.2.minified.js index 57c9b332ff31..46c87b147a39 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment4_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment4_es2015.2.minified.js @@ -1,6 +1,7 @@ -var local, x, Outer = {}; +var local; Outer.Inner = class { constructor(){ this.y = 12; } -}, local.y, new Outer.Inner().y, x.y, new Outer.Inner().y; +}, local.y, new Outer.Inner().y; +(void 0).y, new Outer.Inner().y; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment4_es5.1.normal.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment4_es5.1.normal.js index a911fee831f0..4131af89241b 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment4_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment4_es5.1.normal.js @@ -2,9 +2,9 @@ // @allowJs: true // @checkJs: true // @Filename: def.js -import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var Outer = {}; // @Filename: a.js +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; Outer.Inner = function _class() { "use strict"; _class_call_check(this, _class); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment4_es5.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment4_es5.2.minified.js index ee4a5240d5f3..e708d1303d6e 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment4_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment4_es5.2.minified.js @@ -1,6 +1,7 @@ +var local; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var local, x, Outer = {}; Outer.Inner = function _class() { "use strict"; _class_call_check(this, _class), this.y = 12; -}, local.y, new Outer.Inner().y, x.y, new Outer.Inner().y; +}, local.y, new Outer.Inner().y; +(void 0).y, new Outer.Inner().y; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment6_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment6_es2015.2.minified.js index dd47f3f0dc76..00540eb39105 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment6_es2015.2.minified.js @@ -1,7 +1,6 @@ -class Outer { -} Outer.Inner = class { messages() { return []; } -}, Outer.i, Outer.i.messages(); +}, Outer.i; +Outer.i.messages(); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment6_es5.1.normal.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment6_es5.1.normal.js index 4878eea8bb22..119a02be4554 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment6_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment6_es5.1.normal.js @@ -9,6 +9,7 @@ var Outer = function Outer() { _class_call_check(this, Outer); }; // @Filename: a.js +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; Outer.Inner = /*#__PURE__*/ function() { "use strict"; function I() { diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment6_es5.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment6_es5.2.minified.js index 93368d3cff97..6995b21cde7c 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment6_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment6_es5.2.minified.js @@ -3,6 +3,7 @@ var Outer = function() { "use strict"; _class_call_check(this, Outer); }; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; Outer.Inner = function() { "use strict"; function I() { @@ -11,4 +12,5 @@ Outer.Inner = function() { return I.prototype.messages = function() { return []; }, I; -}(), Outer.i, Outer.i.messages(); +}(), Outer.i; +Outer.i.messages(); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment8_1_es2015.1.normal.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment8_1_es2015.1.normal.js index 8c02f747714d..3d3e6aa6c665 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment8_1_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment8_1_es2015.1.normal.js @@ -14,11 +14,11 @@ my.app.Application = function() { return Application; }(); my.app.Application(); -var _min; // @Filename: b.js +var _min; var min = (_min = window.min) !== null && _min !== void 0 ? _min : {}; -var _app1; -min.app = (_app1 = min.app) !== null && _app1 !== void 0 ? _app1 : {}; +var _app; +min.app = (_app = min.app) !== null && _app !== void 0 ? _app : {}; min.app.Application = function() { var Application = function() { //... diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment8_1_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment8_1_es2015.2.minified.js index ca938d54433a..5ec567055a1f 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment8_1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment8_1_es2015.2.minified.js @@ -1,4 +1,4 @@ -var _app, _min, _app1, my = null != my ? my : {}; +var _app, my = null != my ? my : {}; my.app = null !== (_app = my.app) && void 0 !== _app ? _app : {}, my.app.Application = function() {}, my.app.Application(); -var min = null !== (_min = window.min) && void 0 !== _min ? _min : {}; -min.app = null !== (_app1 = min.app) && void 0 !== _app1 ? _app1 : {}, min.app.Application = function() {}, min.app.Application(); +var _min, _app, min = null !== (_min = window.min) && void 0 !== _min ? _min : {}; +min.app = null !== (_app = min.app) && void 0 !== _app ? _app : {}, min.app.Application = function() {}, min.app.Application(); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment8_1_es5.1.normal.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment8_1_es5.1.normal.js index dad8b47b38dd..4233d78cc082 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment8_1_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment8_1_es5.1.normal.js @@ -14,11 +14,11 @@ my.app.Application = function() { return Application; }(); my.app.Application(); -var _min; // @Filename: b.js +var _min; var min = (_min = window.min) !== null && _min !== void 0 ? _min : {}; -var _app1; -min.app = (_app1 = min.app) !== null && _app1 !== void 0 ? _app1 : {}; +var _app; +min.app = (_app = min.app) !== null && _app !== void 0 ? _app : {}; min.app.Application = function() { var Application = function Application() { //... diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment8_1_es5.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment8_1_es5.2.minified.js index ca938d54433a..5ec567055a1f 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment8_1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment8_1_es5.2.minified.js @@ -1,4 +1,4 @@ -var _app, _min, _app1, my = null != my ? my : {}; +var _app, my = null != my ? my : {}; my.app = null !== (_app = my.app) && void 0 !== _app ? _app : {}, my.app.Application = function() {}, my.app.Application(); -var min = null !== (_min = window.min) && void 0 !== _min ? _min : {}; -min.app = null !== (_app1 = min.app) && void 0 !== _app1 ? _app1 : {}, min.app.Application = function() {}, min.app.Application(); +var _min, _app, min = null !== (_min = window.min) && void 0 !== _min ? _min : {}; +min.app = null !== (_app = min.app) && void 0 !== _app ? _app : {}, min.app.Application = function() {}, min.app.Application(); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignmentOutOfOrder_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignmentOutOfOrder_es2015.2.minified.js index f40ab2603d89..fa489c579040 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignmentOutOfOrder_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignmentOutOfOrder_es2015.2.minified.js @@ -2,4 +2,3 @@ First.Item = class { }, Common.Object = class extends First.Item { }, Workspace.Object = class extends Common.Object { }; -var First = {}, Common = {}, Workspace = {}; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignmentOutOfOrder_es5.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignmentOutOfOrder_es5.2.minified.js index 6a5f33d8b63b..1bbf2b82e351 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignmentOutOfOrder_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignmentOutOfOrder_es5.2.minified.js @@ -21,4 +21,3 @@ First.Item = function I() { } return _class; }(Common.Object); -var First = {}, Common = {}, Workspace = {}; diff --git a/crates/swc/tests/tsc-references/typeQuery_es2015.1.normal.js b/crates/swc/tests/tsc-references/typeQuery_es2015.1.normal.js index 192be3f4d83d..f4c095e75b44 100644 --- a/crates/swc/tests/tsc-references/typeQuery_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/typeQuery_es2015.1.normal.js @@ -1,4 +1,6 @@ // @Filename: /a.ts export class A { } +// @Filename: /b.ts let AConstructor; +export { }; diff --git a/crates/swc/tests/tsc-references/typeQuery_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeQuery_es2015.2.minified.js index 4a17f4af9fc7..95b1242eacaa 100644 --- a/crates/swc/tests/tsc-references/typeQuery_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeQuery_es2015.2.minified.js @@ -1,2 +1,3 @@ export class A { } +export { }; diff --git a/crates/swc/tests/tsc-references/typeQuery_es5.1.normal.js b/crates/swc/tests/tsc-references/typeQuery_es5.1.normal.js index acee38b574f8..fc32289fd7e0 100644 --- a/crates/swc/tests/tsc-references/typeQuery_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/typeQuery_es5.1.normal.js @@ -4,4 +4,6 @@ export var A = function A() { "use strict"; _class_call_check(this, A); }; +// @Filename: /b.ts var AConstructor; +export { }; diff --git a/crates/swc/tests/tsc-references/typeQuery_es5.2.minified.js b/crates/swc/tests/tsc-references/typeQuery_es5.2.minified.js index eed7ca896ebd..6845732041ee 100644 --- a/crates/swc/tests/tsc-references/typeQuery_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeQuery_es5.2.minified.js @@ -3,3 +3,4 @@ export var A = function() { "use strict"; _class_call_check(this, A); }; +export { }; diff --git a/crates/swc/tests/tsc-references/typedefCrossModule2_es2015.2.minified.js b/crates/swc/tests/tsc-references/typedefCrossModule2_es2015.2.minified.js index a3d1c76bd8df..905c47fffedd 100644 --- a/crates/swc/tests/tsc-references/typedefCrossModule2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typedefCrossModule2_es2015.2.minified.js @@ -4,4 +4,5 @@ exports.Bar = class { } }, exports.Quid = 2, module.exports = { Quack: 2 -}, new (require('./mod1.js')).Baz(); +}; +new (require('./mod1.js')).Baz(); diff --git a/crates/swc/tests/tsc-references/typedefCrossModule2_es5.2.minified.js b/crates/swc/tests/tsc-references/typedefCrossModule2_es5.2.minified.js index 7c8d3dd0d315..9873ccdf84ba 100644 --- a/crates/swc/tests/tsc-references/typedefCrossModule2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typedefCrossModule2_es5.2.minified.js @@ -13,4 +13,5 @@ exports.Bar = function _class() { } }, exports.Quid = 2, module.exports = { Quack: 2 -}, new (require("./mod1.js")).Baz(); +}; +new (require("./mod1.js")).Baz(); diff --git a/crates/swc/tests/tsc-references/typedefCrossModule5_es5.1.normal.js b/crates/swc/tests/tsc-references/typedefCrossModule5_es5.1.normal.js index b153a31657c8..cb4617556a99 100644 --- a/crates/swc/tests/tsc-references/typedefCrossModule5_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/typedefCrossModule5_es5.1.normal.js @@ -9,6 +9,7 @@ var Bar = function Bar() { _class_call_check(this, Bar); }; // @Filename: mod2.js +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var Foo = function Foo() { "use strict"; _class_call_check(this, Foo); diff --git a/crates/swc/tests/tsc-references/typedefCrossModule5_es5.2.minified.js b/crates/swc/tests/tsc-references/typedefCrossModule5_es5.2.minified.js index e55855dcc566..037458d18602 100644 --- a/crates/swc/tests/tsc-references/typedefCrossModule5_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typedefCrossModule5_es5.2.minified.js @@ -1,4 +1,9 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; +var Bar = function() { + "use strict"; + _class_call_check(this, Bar); +}; +import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; var Foo = function() { "use strict"; _class_call_check(this, Foo); diff --git a/crates/swc/tests/tsc-references/typedefCrossModule_es2015.2.minified.js b/crates/swc/tests/tsc-references/typedefCrossModule_es2015.2.minified.js index 38d17eab90e3..c701c4797a1a 100644 --- a/crates/swc/tests/tsc-references/typedefCrossModule_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typedefCrossModule_es2015.2.minified.js @@ -1,7 +1,6 @@ -function C() { +module.exports = function() { this.p = 1; -} -module.exports = C; +}; export function C() { this.p = 1; } diff --git a/crates/swc/tests/tsc-references/typedefCrossModule_es5.2.minified.js b/crates/swc/tests/tsc-references/typedefCrossModule_es5.2.minified.js index 38d17eab90e3..c701c4797a1a 100644 --- a/crates/swc/tests/tsc-references/typedefCrossModule_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typedefCrossModule_es5.2.minified.js @@ -1,7 +1,6 @@ -function C() { +module.exports = function() { this.p = 1; -} -module.exports = C; +}; export function C() { this.p = 1; } diff --git a/crates/swc/tests/tsc-references/typedefMultipleTypeParameters_es2015.1.normal.js b/crates/swc/tests/tsc-references/typedefMultipleTypeParameters_es2015.1.normal.js index 16deb6854b72..db8b5c32292a 100644 --- a/crates/swc/tests/tsc-references/typedefMultipleTypeParameters_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/typedefMultipleTypeParameters_es2015.1.normal.js @@ -11,3 +11,4 @@ */ /** @type {Everything<{ a: number, b: 'hi', c: never }, undefined, { c: true, d: 1 }, number, string>} */ var tuvwx; /** @type {Everything<{ a: number }, undefined, { c: 1, d: 1 }, number, string>} */ var wrong; /** @type {Everything<{ a: number }>} */ var insufficient; +// @Filename: test.ts diff --git a/crates/swc/tests/tsc-references/typedefMultipleTypeParameters_es5.1.normal.js b/crates/swc/tests/tsc-references/typedefMultipleTypeParameters_es5.1.normal.js index 16deb6854b72..db8b5c32292a 100644 --- a/crates/swc/tests/tsc-references/typedefMultipleTypeParameters_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/typedefMultipleTypeParameters_es5.1.normal.js @@ -11,3 +11,4 @@ */ /** @type {Everything<{ a: number, b: 'hi', c: never }, undefined, { c: true, d: 1 }, number, string>} */ var tuvwx; /** @type {Everything<{ a: number }, undefined, { c: 1, d: 1 }, number, string>} */ var wrong; /** @type {Everything<{ a: number }>} */ var insufficient; +// @Filename: test.ts diff --git a/crates/swc/tests/tsc-references/typedefTagWrapping_es2015.1.normal.js b/crates/swc/tests/tsc-references/typedefTagWrapping_es2015.1.normal.js index 40628f3fb1a1..3ce251d682fe 100644 --- a/crates/swc/tests/tsc-references/typedefTagWrapping_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/typedefTagWrapping_es2015.1.normal.js @@ -92,8 +92,9 @@ * @returns {*} The return. */ function check6(obj) { return obj.foo; -} // @Filename: mod7.js - /** +} +// @Filename: mod7.js +/** Multiline type expressions in comments without leading * are not supported. @typedef {{ foo: diff --git a/crates/swc/tests/tsc-references/typedefTagWrapping_es5.1.normal.js b/crates/swc/tests/tsc-references/typedefTagWrapping_es5.1.normal.js index 40628f3fb1a1..3ce251d682fe 100644 --- a/crates/swc/tests/tsc-references/typedefTagWrapping_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/typedefTagWrapping_es5.1.normal.js @@ -92,8 +92,9 @@ * @returns {*} The return. */ function check6(obj) { return obj.foo; -} // @Filename: mod7.js - /** +} +// @Filename: mod7.js +/** Multiline type expressions in comments without leading * are not supported. @typedef {{ foo: diff --git a/crates/swc/tests/tsc-references/typesOnlyExternalModuleStillHasInstance_es2015.1.normal.js b/crates/swc/tests/tsc-references/typesOnlyExternalModuleStillHasInstance_es2015.1.normal.js index 4054df914666..4ae710e28db9 100644 --- a/crates/swc/tests/tsc-references/typesOnlyExternalModuleStillHasInstance_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/typesOnlyExternalModuleStillHasInstance_es2015.1.normal.js @@ -1,5 +1,6 @@ // @module: commonjs // @Filename: foo_0.ts +export { }; // @Filename: foo_1.ts const foo0 = require('./foo_0'); // Per 11.2.3, foo_0 should still be "instantiated", albeit with no members diff --git a/crates/swc/tests/tsc-references/typesOnlyExternalModuleStillHasInstance_es2015.2.minified.js b/crates/swc/tests/tsc-references/typesOnlyExternalModuleStillHasInstance_es2015.2.minified.js index 51979294a589..85609ef6e71d 100644 --- a/crates/swc/tests/tsc-references/typesOnlyExternalModuleStillHasInstance_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typesOnlyExternalModuleStillHasInstance_es2015.2.minified.js @@ -1,2 +1,3 @@ +export { }; require('./foo_0'); export { }; diff --git a/crates/swc/tests/tsc-references/typesOnlyExternalModuleStillHasInstance_es5.1.normal.js b/crates/swc/tests/tsc-references/typesOnlyExternalModuleStillHasInstance_es5.1.normal.js index d8b5fcd88cdb..bb0bdb05e89e 100644 --- a/crates/swc/tests/tsc-references/typesOnlyExternalModuleStillHasInstance_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/typesOnlyExternalModuleStillHasInstance_es5.1.normal.js @@ -1,5 +1,6 @@ // @module: commonjs // @Filename: foo_0.ts +export { }; // @Filename: foo_1.ts var foo0 = require("./foo_0"); // Per 11.2.3, foo_0 should still be "instantiated", albeit with no members diff --git a/crates/swc/tests/tsc-references/typesOnlyExternalModuleStillHasInstance_es5.2.minified.js b/crates/swc/tests/tsc-references/typesOnlyExternalModuleStillHasInstance_es5.2.minified.js index dbab3b947607..96afc15ca62b 100644 --- a/crates/swc/tests/tsc-references/typesOnlyExternalModuleStillHasInstance_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typesOnlyExternalModuleStillHasInstance_es5.2.minified.js @@ -1,2 +1,3 @@ +export { }; require("./foo_0"); export { }; diff --git a/crates/swc/tests/tsc-references/typingsLookupAmd_es2015.1.normal.js b/crates/swc/tests/tsc-references/typingsLookupAmd_es2015.1.normal.js index 94e262db9b72..1daa716fcf16 100644 --- a/crates/swc/tests/tsc-references/typingsLookupAmd_es2015.1.normal.js +++ b/crates/swc/tests/tsc-references/typingsLookupAmd_es2015.1.normal.js @@ -4,3 +4,7 @@ // @module: amd // @filename: /node_modules/@types/a/index.d.ts export { }; +// @filename: /x/node_modules/@types/b/index.d.ts +import { A } from "a"; +// @filename: /x/y/foo.ts +export { }; diff --git a/crates/swc/tests/tsc-references/typingsLookupAmd_es2015.2.minified.js b/crates/swc/tests/tsc-references/typingsLookupAmd_es2015.2.minified.js index 2234b9cae16d..a85d8324c074 100644 --- a/crates/swc/tests/tsc-references/typingsLookupAmd_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typingsLookupAmd_es2015.2.minified.js @@ -1 +1,3 @@ export { }; +import { A } from "a"; +export { }; diff --git a/crates/swc/tests/tsc-references/typingsLookupAmd_es5.1.normal.js b/crates/swc/tests/tsc-references/typingsLookupAmd_es5.1.normal.js index 94e262db9b72..1daa716fcf16 100644 --- a/crates/swc/tests/tsc-references/typingsLookupAmd_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/typingsLookupAmd_es5.1.normal.js @@ -4,3 +4,7 @@ // @module: amd // @filename: /node_modules/@types/a/index.d.ts export { }; +// @filename: /x/node_modules/@types/b/index.d.ts +import { A } from "a"; +// @filename: /x/y/foo.ts +export { }; diff --git a/crates/swc/tests/tsc-references/typingsLookupAmd_es5.2.minified.js b/crates/swc/tests/tsc-references/typingsLookupAmd_es5.2.minified.js index 2234b9cae16d..a85d8324c074 100644 --- a/crates/swc/tests/tsc-references/typingsLookupAmd_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typingsLookupAmd_es5.2.minified.js @@ -1 +1,3 @@ export { }; +import { A } from "a"; +export { }; diff --git a/crates/swc/tests/tsc-references/unicodeEscapesInJsxtags_es2015.1.normal.js b/crates/swc/tests/tsc-references/unicodeEscapesInJsxtags_es2015.1.normal.js new file mode 100644 index 000000000000..89aac3543261 --- /dev/null +++ b/crates/swc/tests/tsc-references/unicodeEscapesInJsxtags_es2015.1.normal.js @@ -0,0 +1,12 @@ +// @filename: file.tsx +//! +//! x Unexpected token `a`. Expected jsx identifier +//! ,---- +//! 19 | let a = <\u0061>; // works +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/unicodeEscapesInJsxtags_es2015.2.minified.js b/crates/swc/tests/tsc-references/unicodeEscapesInJsxtags_es2015.2.minified.js new file mode 100644 index 000000000000..89aac3543261 --- /dev/null +++ b/crates/swc/tests/tsc-references/unicodeEscapesInJsxtags_es2015.2.minified.js @@ -0,0 +1,12 @@ +// @filename: file.tsx +//! +//! x Unexpected token `a`. Expected jsx identifier +//! ,---- +//! 19 | let a = <\u0061>; // works +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/unicodeEscapesInJsxtags_es5.1.normal.js b/crates/swc/tests/tsc-references/unicodeEscapesInJsxtags_es5.1.normal.js new file mode 100644 index 000000000000..89aac3543261 --- /dev/null +++ b/crates/swc/tests/tsc-references/unicodeEscapesInJsxtags_es5.1.normal.js @@ -0,0 +1,12 @@ +// @filename: file.tsx +//! +//! x Unexpected token `a`. Expected jsx identifier +//! ,---- +//! 19 | let a = <\u0061>; // works +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/unicodeEscapesInJsxtags_es5.2.minified.js b/crates/swc/tests/tsc-references/unicodeEscapesInJsxtags_es5.2.minified.js new file mode 100644 index 000000000000..89aac3543261 --- /dev/null +++ b/crates/swc/tests/tsc-references/unicodeEscapesInJsxtags_es5.2.minified.js @@ -0,0 +1,12 @@ +// @filename: file.tsx +//! +//! x Unexpected token `a`. Expected jsx identifier +//! ,---- +//! 19 | let a = <\u0061>; // works +//! : ^^^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: Syntax Error diff --git a/crates/swc/tests/tsc-references/withStatements_es2015.1.normal.js b/crates/swc/tests/tsc-references/withStatements_es2015.1.normal.js new file mode 100644 index 000000000000..31b6b04f328f --- /dev/null +++ b/crates/swc/tests/tsc-references/withStatements_es2015.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. +//! ,---- +//! 2 | with (x) { +//! : ^^^^ +//! `---- +//! +//! x With statement are not allowed in strict mode +//! ,---- +//! 2 | with (x) { +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/withStatements_es2015.2.minified.js b/crates/swc/tests/tsc-references/withStatements_es2015.2.minified.js new file mode 100644 index 000000000000..31b6b04f328f --- /dev/null +++ b/crates/swc/tests/tsc-references/withStatements_es2015.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. +//! ,---- +//! 2 | with (x) { +//! : ^^^^ +//! `---- +//! +//! x With statement are not allowed in strict mode +//! ,---- +//! 2 | with (x) { +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/withStatements_es5.1.normal.js b/crates/swc/tests/tsc-references/withStatements_es5.1.normal.js new file mode 100644 index 000000000000..31b6b04f328f --- /dev/null +++ b/crates/swc/tests/tsc-references/withStatements_es5.1.normal.js @@ -0,0 +1,18 @@ +//! +//! x The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. +//! ,---- +//! 2 | with (x) { +//! : ^^^^ +//! `---- +//! +//! x With statement are not allowed in strict mode +//! ,---- +//! 2 | with (x) { +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/withStatements_es5.2.minified.js b/crates/swc/tests/tsc-references/withStatements_es5.2.minified.js new file mode 100644 index 000000000000..31b6b04f328f --- /dev/null +++ b/crates/swc/tests/tsc-references/withStatements_es5.2.minified.js @@ -0,0 +1,18 @@ +//! +//! x The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. +//! ,---- +//! 2 | with (x) { +//! : ^^^^ +//! `---- +//! +//! x With statement are not allowed in strict mode +//! ,---- +//! 2 | with (x) { +//! : ^^^^ +//! `---- +//! +//! +//!Caused by: +//! 0: failed to process input file +//! 1: error was recoverable, but proceeding would result in wrong codegen +//! 2: Syntax Error diff --git a/crates/swc/tests/tsc-references/yieldExpressionInControlFlow_es5.1.normal.js b/crates/swc/tests/tsc-references/yieldExpressionInControlFlow_es5.1.normal.js index 39e6e3863c4e..9d6e4f3b0e4d 100644 --- a/crates/swc/tests/tsc-references/yieldExpressionInControlFlow_es5.1.normal.js +++ b/crates/swc/tests/tsc-references/yieldExpressionInControlFlow_es5.1.normal.js @@ -5,8 +5,7 @@ // @lib: esnext // @Filename: bug25149.js import regeneratorRuntime from "regenerator-runtime"; -var _marked = regeneratorRuntime.mark(g); -var _marked1 = regeneratorRuntime.mark(f); +var _marked = regeneratorRuntime.mark(f); function f() { var o; return regeneratorRuntime.wrap(function f$(_ctx) { @@ -28,10 +27,12 @@ function f() { case "end": return _ctx.stop(); } - }, _marked1); + }, _marked); } // @Filename: alsoFails.ts // fails in Typescript too +import regeneratorRuntime from "regenerator-runtime"; +var _marked = regeneratorRuntime.mark(g); function g() { var o; return regeneratorRuntime.wrap(function g$(_ctx) { diff --git a/crates/swc/tests/tsc-references/yieldExpressionInControlFlow_es5.2.minified.js b/crates/swc/tests/tsc-references/yieldExpressionInControlFlow_es5.2.minified.js index 6bcfec9819e3..e98048bfe442 100644 --- a/crates/swc/tests/tsc-references/yieldExpressionInControlFlow_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/yieldExpressionInControlFlow_es5.2.minified.js @@ -4,30 +4,32 @@ var _marked = regeneratorRuntime.mark(function() { return regeneratorRuntime.wrap(function(_ctx) { for(;;)switch(_ctx.prev = _ctx.next){ case 0: - o = []; case 1: - return _ctx.delegateYield(o, "t0", 3); - case 3: - o = _ctx.t0, _ctx.next = 1; + return _ctx.next = 4, o; + case 4: + o = _ctx.sent, _ctx.next = 1; break; - case 6: + case 7: case "end": return _ctx.stop(); } }, _marked); -}), _marked1 = regeneratorRuntime.mark(function() { +}); +import regeneratorRuntime from "regenerator-runtime"; +var _marked = regeneratorRuntime.mark(function() { var o; return regeneratorRuntime.wrap(function(_ctx) { for(;;)switch(_ctx.prev = _ctx.next){ case 0: + o = []; case 1: - return _ctx.next = 4, o; - case 4: - o = _ctx.sent, _ctx.next = 1; + return _ctx.delegateYield(o, "t0", 3); + case 3: + o = _ctx.t0, _ctx.next = 1; break; - case 7: + case 6: case "end": return _ctx.stop(); } - }, _marked1); + }, _marked); }); diff --git a/crates/swc/tests/tsc.rs b/crates/swc/tests/tsc.rs index 8da4ba319a9f..e3f2ccf8b1b8 100644 --- a/crates/swc/tests/tsc.rs +++ b/crates/swc/tests/tsc.rs @@ -1,17 +1,20 @@ use std::{ fs::create_dir_all, + mem, panic::{catch_unwind, resume_unwind, AssertUnwindSafe}, path::{Path, PathBuf}, + sync::Arc, }; use serde::de::DeserializeOwned; use swc::{ config::{Config, IsModule, JscConfig, Options, SourceMapsConfig}, - Compiler, + try_with_handler, Compiler, }; +use swc_common::{errors::ColorConfig, SourceMap}; use swc_ecma_ast::EsVersion; use swc_ecma_parser::{Syntax, TsConfig}; -use testing::{NormalizedOutput, Tester}; +use testing::NormalizedOutput; #[testing::fixture( "../swc_ecma_parser/tests/tsc/**/*.ts", @@ -118,49 +121,108 @@ fn matrix() -> Vec<(String, Options)> { res } +fn is_filename_directives(line: &str) -> bool { + line.starts_with("// @Filename:") + || line.starts_with("// @filename:") + || line.starts_with("//@Filename:") + || line.starts_with("//@filename:") +} + fn compile(input: &Path, output: &Path, opts: Options) { - Tester::new() - .print_errors(|cm, handler| { - let c = Compiler::new(cm.clone()); - - let fm = cm.load_file(input).expect("failed to load file"); - - match c.process_js_file( - fm, - &handler, - &Options { - config: Config { - jsc: JscConfig { - syntax: Some(Syntax::Typescript(TsConfig { - tsx: input.to_string_lossy().ends_with(".tsx"), - decorators: true, - dts: false, - no_early_errors: false, - })), - external_helpers: true.into(), - ..opts.config.jsc - }, - source_maps: Some(SourceMapsConfig::Bool( - !input.to_string_lossy().contains("Unicode"), - )), - is_module: IsModule::Bool(true), - ..opts.config - }, - ..opts - }, - ) { - Ok(res) => { - NormalizedOutput::from(res.code) - .compare_to_file(output) - .unwrap(); + let cm = Arc::::default(); + + let c = Compiler::new(cm.clone()); + + let fm = cm.load_file(input).expect("failed to load file"); + + let mut files = vec![]; + + if fm.src.lines().any(is_filename_directives) { + let mut buffer = String::default(); + + let mut iter = fm.src.lines(); + + let mut meta_line = None; + + loop { + let line = iter.next(); + if line.map_or(true, is_filename_directives) { + if !buffer.is_empty() { + let mut source = String::default(); + mem::swap(&mut source, &mut buffer); + + files.push(( + meta_line, + cm.new_source_file(swc_common::FileName::Anon, source), + )); } - Err(ref err) if format!("{:?}", err).contains("Syntax Error") => {} - Err(ref err) if format!("{:?}", err).contains("not matched") => {} - Err(err) => panic!("Error: {:?}", err), + meta_line = line; } - Ok(()) - }) - .map(|_| ()) - .expect("failed"); + if let Some(line) = line { + buffer += line; + buffer.push('\n'); + } else { + break; + } + } + } else { + files = vec![(None, fm)]; + } + + let mut result = String::default(); + + let options = Options { + config: Config { + jsc: JscConfig { + syntax: Some(Syntax::Typescript(TsConfig { + tsx: input.to_string_lossy().ends_with(".tsx"), + decorators: true, + dts: false, + no_early_errors: false, + })), + external_helpers: true.into(), + ..opts.config.jsc + }, + source_maps: Some(SourceMapsConfig::Bool( + !input.to_string_lossy().contains("Unicode"), + )), + is_module: IsModule::Bool(true), + ..opts.config + }, + ..opts + }; + + for (meta_line, file) in files { + match try_with_handler( + cm.clone(), + swc::HandlerOpts { + color: ColorConfig::Never, + skip_filename: true, + }, + |handler| c.process_js_file(file, handler, &options), + ) { + Ok(res) => { + result += &res.code; + } + Err(ref err) => { + let error_text = format!("{:?}", err); + + if let Some(meta_line) = meta_line { + result += meta_line; + result.push('\n'); + } + + for line in error_text.lines() { + result.push_str("//!"); + result.push_str(line); + result.push('\n'); + } + } + } + } + + NormalizedOutput::from(result) + .compare_to_file(output) + .unwrap(); }