Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,41 +1,21 @@
//// [TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.ts]
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
(function(A) {
var Point = function Point() {
"use strict";
_class_call_check(this, Point);
};
A.Point = Point;
})(A || (A = {}));
(function(A) {
var Point = function Point() {
"use strict";
_class_call_check(this, Point);
};
// expected error
A.Point = Point;
})(A || (A = {}));
(function(X) {
(function(Y) {
(function(Z) {
var Line = function Line() {
"use strict";
_class_call_check(this, Line);
};
Z.Line = Line;
})(Y.Z || (Y.Z = {}));
})(X.Y || (X.Y = {}));
})(X || (X = {}));
(function(X) {
(function(Y) {
(function(Z) {
var Line = function Line() {
"use strict";
_class_call_check(this, Line);
};
// expected error
Z.Line = Line;
})(Y.Z || (Y.Z = {}));
})(X.Y || (X.Y = {}));
})(X || (X = {}));
var A, X;
//! x the name `Point` is defined multiple times
//! ,-[2:1]
//! 1 | module A {
//! 2 | export class Point {
//! : ^^|^^
//! : `-- previous definition of `Point` here
//! 3 | x: number;
//! 4 | y: number;
//! 5 | }
//! 6 | }
//! 7 |
//! 8 | module A{
//! 9 | // expected error
//! 10 | export class Point {
//! : ^^|^^
//! : `-- `Point` redefined here
//! 11 | origin: number;
//! 12 | angle: number;
//! 13 | }
//! `----
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
//// [TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.ts]
var A, X, X1, Y, X2, Y1;
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
(A || (A = {})).Point = function Point() {
_class_call_check(this, Point);
}, (A || (A = {})).Point = function Point() {
_class_call_check(this, Point);
}, ((Y = (X1 = X || (X = {})).Y || (X1.Y = {})).Z || (Y.Z = {})).Line = function Line() {
_class_call_check(this, Line);
}, ((Y1 = (X2 = X || (X = {})).Y || (X2.Y = {})).Z || (Y1.Z = {})).Line = function Line() {
_class_call_check(this, Line);
};
//! x the name `Point` is defined multiple times
//! ,-[2:1]
//! 1 | module A {
//! 2 | export class Point {
//! : ^^|^^
//! : `-- previous definition of `Point` here
//! 3 | x: number;
//! 4 | y: number;
//! 5 | }
//! 6 | }
//! 7 |
//! 8 | module A{
//! 9 | // expected error
//! 10 | export class Point {
//! : ^^|^^
//! : `-- `Point` redefined here
//! 11 | origin: number;
//! 12 | angle: number;
//! 13 | }
//! `----
20 changes: 10 additions & 10 deletions crates/swc/tests/tsc-references/enumMergingErrors.1.normal.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@
(function(M) {
(function(E1) {
E1[E1["B"] = 'foo'.length] = "B";
})(M.E1 || (M.E1 = {}));
})(M.E1);
(function(E2) {
E2[E2["B"] = 'foo'.length] = "B";
})(M.E2 || (M.E2 = {}));
})(M.E2);
(function(E3) {
E3[E3["C"] = 0] = "C";
})(M.E3 || (M.E3 = {}));
})(M.E3);
})(M || (M = {}));
(function(M) {
(function(E1) {
E1[E1["C"] = 0] = "C";
})(M.E1 || (M.E1 = {}));
})(M.E1);
(function(E2) {
E2[E2["A"] = 0] = "A";
})(M.E2 || (M.E2 = {}));
})(M.E2);
(function(E3) {
E3[E3["B"] = 'foo'.length] = "B";
})(M.E3 || (M.E3 = {}));
})(M.E3);
})(M || (M = {}));
// Enum with no initializer in either declaration with constant members with the same root module
(function(M1) {
Expand All @@ -42,12 +42,12 @@
(function(M1) {
(function(E1) {
E1[E1["B"] = 0] = "B";
})(M1.E1 || (M1.E1 = {}));
})(M1.E1);
})(M1 || (M1 = {}));
(function(M1) {
(function(E1) {
E1[E1["C"] = 0] = "C";
})(M1.E1 || (M1.E1 = {}));
})(M1.E1);
})(M1 || (M1 = {}));
// Enum with initializer in only one of three declarations with constant members with the same root module
(function(M2) {
Expand All @@ -58,11 +58,11 @@
(function(M2) {
(function(E1) {
E1[E1["B"] = 0] = "B";
})(M2.E1 || (M2.E1 = {}));
})(M2.E1);
})(M2 || (M2 = {}));
(function(M2) {
(function(E1) {
E1[E1["C"] = 0] = "C";
})(M2.E1 || (M2.E1 = {}));
})(M2.E1);
})(M2 || (M2 = {}));
var M, M1, M2;

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// module export
(function(m) {})(m || (m = {}));
(function(m) {
var z = x;
var z = m.x;
var y = {
a: x,
x: x
a: m.x,
x: m.x
};
})(m || (m = {}));
var m;
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
//// [objectLiteralShorthandPropertiesWithModule.ts]
var m;
m || (m = {}), m || (m = {}), x, x, x;
var m, m1;
m || (m = {}), (m1 = m || (m = {})).x, m1.x, m1.x;
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//// [objectLiteralShorthandPropertiesWithModuleES6.ts]
(function(m) {})(m || (m = {}));
(function(m) {
var z = x;
var z = m.x;
var y = {
a: x,
x
a: m.x,
x: m.x
};
})(m || (m = {}));
var m;
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
//// [objectLiteralShorthandPropertiesWithModuleES6.ts]
var m;
m || (m = {}), m || (m = {}), x, x, x;
var m, m1;
m || (m = {}), (m1 = m || (m = {})).x, m1.x, m1.x;
18 changes: 9 additions & 9 deletions crates/swc/tests/tsc-references/tsxEmit3.1.normal.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
//// [file.tsx]
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
(function(M) {
var Foo1 = function Foo1() {
var Foo = function Foo() {
"use strict";
_class_call_check(this, Foo1);
_class_call_check(this, Foo);
};
M.Foo = Foo1;
(function(S1) {
var Bar1 = function Bar1() {
M.Foo = Foo;
(function(S) {
var Bar = function Bar() {
"use strict";
_class_call_check(this, Bar1);
_class_call_check(this, Bar);
};
S1.Bar = Bar1;
S.Bar = Bar;
// Emit Foo
// Foo, <Foo />;
})(M.S || (M.S = {}));
})(M || (M = {}));
(function(M) {
// Emit M.Foo
Foo, /*#__PURE__*/ React.createElement(Foo, null);
(function(S1) {
(function(S) {
// Emit M.Foo
Foo, /*#__PURE__*/ React.createElement(Foo, null);
// Emit S.Bar
Expand All @@ -28,7 +28,7 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
})(M || (M = {}));
(function(M) {
// Emit M.S.Bar
S.Bar, /*#__PURE__*/ React.createElement(S.Bar, null);
M.S.Bar, /*#__PURE__*/ React.createElement(M.S.Bar, null);
})(M || (M = {}));
(function(M) {
var M1 = 100;
Expand Down
4 changes: 2 additions & 2 deletions crates/swc/tests/tsc-references/tsxEmit3.2.minified.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//// [file.tsx]
var M, M1, M2;
var M, M1, M2, M3;
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
(M1 = M || (M = {})).Foo = function Foo1() {
_class_call_check(this, Foo1);
}, (M1.S || (M1.S = {})).Bar = function Bar1() {
_class_call_check(this, Bar1);
}, Foo, Foo, (M2 = M || (M = {})).S || (M2.S = {}), Foo, Foo, Bar, Bar, M || (M = {}), S.Bar, S.Bar, M || (M = {}), Foo, Foo;
}, Foo, Foo, (M2 = M || (M = {})).S || (M2.S = {}), Foo, Foo, Bar, Bar, (M3 = M || (M = {})).S.Bar, M3.S.Bar, M || (M = {}), Foo, Foo;
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ define([
(function(M) {})(M || (M = {}));
(function(M) {
// Should emit 'M.X' in both opening and closing tags
var y = /*#__PURE__*/ _react.createElement(X, null);
var y = /*#__PURE__*/ _react.createElement(M.X, null);
})(M || (M = {}));
var M;
});
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ define([
var M;
Object.defineProperty(exports, "__esModule", {
value: !0
}), _reactrouter.Route, M || (M = {}), M || (M = {}), X;
}), _reactrouter.Route, M || (M = {}), (M || (M = {})).X;
});
Loading
Loading