Skip to content
Closed
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
1 change: 1 addition & 0 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions crates/swc/tests/fixture/issues-10xxx/10877/output/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
for(var value in function() {
for(var value in (function() {
var property = foo.property, rest = _object_without_properties(foo, [
"property"
]);
return rest;
}()){
})()){
console.log(value);
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function func1() {
case 1:
resource = _state.sent();
_resource = _to_array(resource), firstName = _resource[0], tmp = _resource[1], middleName = tmp === void 0 ? "N/A" : tmp, age = _resource[2], rest = _resource.slice(3);
result = function() {
result = (function() {
if (firstName) {
return {
firstName: firstName,
Expand All @@ -58,7 +58,7 @@ function func1() {
error: "Failed to fetch resource"
};
}
}();
})();
resolve(result);
return [
2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ var MyClass = function MyClass() {
_class_call_check(this, MyClass);
};
export var fn = function() {
return /*#__PURE__*/ function(MyClass) {
return /*#__PURE__*/ (function(MyClass) {
"use strict";
_inherits(_class, MyClass);
function _class() {
_class_call_check(this, _class);
return _call_super(this, _class, arguments);
}
return _class;
}(MyClass);
})(MyClass);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ var MyClass = function MyClass() {
_class_call_check(this, MyClass);
};
export var fn = function() {
return /*#__PURE__*/ function(MyClass) {
return /*#__PURE__*/ (function(MyClass) {
"use strict";
_inherits(_class, MyClass);
function _class() {
_class_call_check(this, _class);
return _call_super(this, _class, arguments);
}
return _class;
}(MyClass);
})(MyClass);
};
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var _ts_generator = require("@swc/helpers/_/_ts_generator");
}
};
});
res = function() {
res = (function() {
return _async_to_generator._(function() {
var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, value, err;
return _ts_generator._(this, function(_state) {
Expand Down Expand Up @@ -118,7 +118,7 @@ var _ts_generator = require("@swc/helpers/_/_ts_generator");
}
});
})();
}();
})();
_i = 0, _iter = [
0,
1
Expand Down
4 changes: 2 additions & 2 deletions crates/swc/tests/fixture/issues-9xxx/9930/output/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ try {
})``;
} catch {}
try {
1 + {
1 + ({
0: 0
}``;
})``;
} catch {}
4 changes: 2 additions & 2 deletions crates/swc/tests/fixture/next.js/40399/3/output/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ _define_property(Foo, "klass", function _class(v) {
return _ts_generator(this, function(_state) {
switch(_state.label){
case 0:
Bar = /*#__PURE__*/ function(Foo1) {
Bar = /*#__PURE__*/ (function(Foo1) {
"use strict";
_inherits(Bar, Foo1);
function Bar() {
Expand Down Expand Up @@ -69,7 +69,7 @@ _define_property(Foo, "klass", function _class(v) {
}
]);
return Bar;
}(Foo);
})(Foo);
return [
4,
new Bar().bar()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//// [ExportClassWhichExtendsInterfaceWithInaccessibleType.ts]
var A;
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
(A || (A = {})).Point2d = /*#__PURE__*/ function() {
(A || (A = {})).Point2d = /*#__PURE__*/ (function() {
function Point2d(x, y) {
_class_call_check(this, Point2d), this.x = x, this.y = y;
}
return Point2d.prototype.fromOrigin = function(p) {
return 1;
}, Point2d;
}();
})();
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//// [bug24252.js]
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
var A = {};
A.B = /*#__PURE__*/ function() {
A.B = /*#__PURE__*/ (function() {
"use strict";
function _class() {
_class_call_check(this, _class);
Expand All @@ -13,4 +13,4 @@ A.B = /*#__PURE__*/ function() {
y = x;
};
return _class;
}();
})();
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ NonGeneric || (NonGeneric = {}), new (C = function C(x) {
_class_call_check(this, C);
})(), new C(''), new (C2 = function C2(x) {
_class_call_check(this, C2);
})(), new C2(''), new C2(1), new (D = /*#__PURE__*/ function(C2) {
})(), new C2(''), new C2(1), new (D = (/*#__PURE__*/ function(C2) {
function D() {
return _class_call_check(this, D), _call_super(this, D, arguments);
}
return _inherits(D, C2), D;
}(C2))(), new D(1), new D(''), Generics || (Generics = {}), new (C1 = function C(x) {
}(C2)))(), new D(1), new D(''), Generics || (Generics = {}), new (C1 = function C(x) {
_class_call_check(this, C);
})(), new C1(''), new (C21 = function C2(x) {
_class_call_check(this, C2);
})(), new C21(''), new C21(1, 2), new (D1 = /*#__PURE__*/ function(C2) {
})(), new C21(''), new C21(1, 2), new (D1 = (/*#__PURE__*/ function(C2) {
function D() {
return _class_call_check(this, D), _call_super(this, D, arguments);
}
return _inherits(D, C2), D;
}(C21))(), new D1(1), new D1('');
}(C21)))(), new D1(1), new D1('');
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ var K = require("./mod1").K;
}
//// [mod1.js]
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
exports.K = /*#__PURE__*/ function() {
exports.K = /*#__PURE__*/ (function() {
"use strict";
function K() {
_class_call_check(this, K);
}
var _proto = K.prototype;
_proto.values = function values() {};
return K;
}();
})();
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
require("./mod1").K;
//// [mod1.js]
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
exports.K = /*#__PURE__*/ function() {
exports.K = /*#__PURE__*/ (function() {
function K() {
_class_call_check(this, K);
}
return K.prototype.values = function() {}, K;
}();
})();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var K = require("./mod1").K;
//// [mod1.js]
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
var NS = {};
NS.K = /*#__PURE__*/ function() {
NS.K = /*#__PURE__*/ (function() {
"use strict";
function _class() {
_class_call_check(this, _class);
Expand All @@ -17,5 +17,5 @@ NS.K = /*#__PURE__*/ function() {
return new NS.K();
};
return _class;
}();
})();
exports.K = NS.K;
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//// [contextuallyTypeLogicalAnd03.ts]
var x;
var y = true;
x = function(a) {
x = (function(a) {
return a;
} && function(b) {
}) && function(b) {
return b;
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//// [contextuallyTypedClassExpressionMethodDeclaration01.ts]
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
function getFoo1() {
return /*#__PURE__*/ function() {
return /*#__PURE__*/ (function() {
"use strict";
function _class() {
_class_call_check(this, _class);
Expand All @@ -13,7 +13,7 @@ function getFoo1() {
arg.strProp = "hello";
};
return _class;
}();
})();
}
function getFoo2() {
var _class;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//// [contextuallyTypedClassExpressionMethodDeclaration02.ts]
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
function getFoo1() {
return /*#__PURE__*/ function() {
return /*#__PURE__*/ (function() {
"use strict";
function _class() {
_class_call_check(this, _class);
Expand All @@ -14,7 +14,7 @@ function getFoo1() {
arg.strProp = "hello";
};
return _class;
}();
})();
}
function getFoo2() {
return function _class() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function area(s) {
}
function areaWrapped(s) {
var area;
area = function() {
area = (function() {
switch(s.kind){
case "square":
return s.size * s.size;
Expand All @@ -89,7 +89,7 @@ function areaWrapped(s) {
case "triangle":
return Math.sqrt(3) / 4 * s.side * s.side;
}
}();
})();
return area;
}
// Repro from #13241
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,38 @@ var A = function A() {
};
function B1() {
// class expression can use T
return /*#__PURE__*/ function(A) {
return /*#__PURE__*/ (function(A) {
"use strict";
_inherits(_class, A);
function _class() {
_class_call_check(this, _class);
return _call_super(this, _class, arguments);
}
return _class;
}(A);
})(A);
}
var B2 = function B2() {
"use strict";
_class_call_check(this, B2);
this.anon = /*#__PURE__*/ function(A) {
this.anon = /*#__PURE__*/ (function(A) {
_inherits(_class, A);
function _class() {
_class_call_check(this, _class);
return _call_super(this, _class, arguments);
}
return _class;
}(A);
})(A);
};
function B3() {
return /*#__PURE__*/ function(A) {
return /*#__PURE__*/ (function(A) {
"use strict";
_inherits(Inner, A);
function Inner() {
_class_call_check(this, Inner);
return _call_super(this, Inner, arguments);
}
return Inner;
}(A);
})(A);
}
// extends can call B
var K = /*#__PURE__*/ function(_B1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ System.register([
return zero.foo();
});
_export("p2", p2 = _context.import("./0"));
C = /*#__PURE__*/ function() {
C = /*#__PURE__*/ (function() {
"use strict";
function C() {
_class_call_check(this, C);
Expand All @@ -42,7 +42,7 @@ System.register([
var loadAsync = _context.import("./0");
};
return C;
}();
})();
_export("D", D = /*#__PURE__*/ function() {
"use strict";
function D() {
Expand Down
4 changes: 2 additions & 2 deletions crates/swc/tests/tsc-references/localTypes5.1.normal.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ function foo() {
}
var _proto = X.prototype;
_proto.m = function m() {
return function() {
return (function() {
var Y = function Y() {
_class_call_check(this, Y);
};
return new Y();
}();
})();
};
return X;
}();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ var Thing3 = /*#__PURE__*/ function(Thing2) {
}(Thing2);
// Repro from #13805
var Timestamped = function(Base) {
return /*#__PURE__*/ function(Base) {
return /*#__PURE__*/ (function(Base) {
"use strict";
_inherits(_class, Base);
function _class() {
Expand All @@ -104,5 +104,5 @@ var Timestamped = function(Base) {
return _this;
}
return _class;
}(Base);
})(Base);
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//// [parserindenter.ts]
var Formatting;
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
(Formatting || (Formatting = {})).Indenter = /*#__PURE__*/ function() {
(Formatting || (Formatting = {})).Indenter = /*#__PURE__*/ (function() {
function Indenter(logger, tree, snapshot, languageHostIndentation, editorOptions, firstToken, smartIndent) {
_class_call_check(this, Indenter), this.logger = logger, this.tree = tree, this.snapshot = snapshot, this.languageHostIndentation = languageHostIndentation, this.editorOptions = editorOptions, this.firstToken = firstToken, this.smartIndent = smartIndent, this.indentationBag = new IndentationBag(this.snapshot), this.scriptBlockBeginLineNumber = -1, this.offsetIndentationDeltas = new Dictionary_int_int(), this.tree.Root.SetIndentationOverride(""), this.ApplyScriptBlockIndentation(this.languageHostIndentation, this.tree), this.FillInheritedIndentation(this.tree);
}
Expand Down Expand Up @@ -234,4 +234,4 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
}
return indentSize;
}, Indenter;
}();
})();
Loading
Loading