mirror of
https://github.com/swc-project/swc.git
synced 2024-11-23 09:38:16 +03:00
fix(es/compat): Don't add pure annotations to dummy spans (#8172)
**Related issue:** - Closes #8155. - Closes #8173.
This commit is contained in:
parent
7747dbd499
commit
9ceb57b4c7
@ -141,6 +141,8 @@ impl Comments for SwcComments {
|
||||
}
|
||||
|
||||
fn add_pure_comment(&self, pos: BytePos) {
|
||||
assert_ne!(pos, BytePos(0), "cannot add pure comment to zero position");
|
||||
|
||||
let mut leading = self.leading.entry(pos).or_default();
|
||||
let pure_comment = Comment {
|
||||
kind: CommentKind::Block,
|
||||
|
24
crates/swc/tests/exec/issues-8xxx/8155/.swcrc
Normal file
24
crates/swc/tests/exec/issues-8xxx/8155/.swcrc
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"decorators": true,
|
||||
"tsx": false
|
||||
},
|
||||
"transform": {
|
||||
"legacyDecorator": true
|
||||
},
|
||||
"target": "es5",
|
||||
// "loose": false,
|
||||
"minify": {
|
||||
"compress": false,
|
||||
"mangle": false
|
||||
},
|
||||
"loose": false
|
||||
},
|
||||
"module": {
|
||||
"type": "es6"
|
||||
},
|
||||
"minify": false,
|
||||
"isModule": true
|
||||
}
|
16
crates/swc/tests/exec/issues-8xxx/8155/exec.js
Normal file
16
crates/swc/tests/exec/issues-8xxx/8155/exec.js
Normal file
@ -0,0 +1,16 @@
|
||||
const someFn = (xx, x, y) => [x, y];
|
||||
|
||||
const getArray = () => [1, 2, 3];
|
||||
|
||||
const goodFunction = async () => {
|
||||
const rb = await getArray();
|
||||
const rc = await getArray();
|
||||
console.log(someFn(1, rb, rc));
|
||||
}
|
||||
|
||||
const badFunction = async () => {
|
||||
console.log(someFn(1, await getArray(), await getArray()))
|
||||
}
|
||||
|
||||
goodFunction();
|
||||
badFunction();
|
19
crates/swc/tests/fixture/issues-8xxx/8155/1/input/.swcrc
Normal file
19
crates/swc/tests/fixture/issues-8xxx/8155/1/input/.swcrc
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"decorators": true,
|
||||
"tsx": false
|
||||
},
|
||||
"transform": {
|
||||
"legacyDecorator": true
|
||||
},
|
||||
"target": "es2016",
|
||||
"minify": {
|
||||
"compress": true
|
||||
},
|
||||
"loose": false,
|
||||
"externalHelpers": false
|
||||
},
|
||||
"isModule": true
|
||||
}
|
16
crates/swc/tests/fixture/issues-8xxx/8155/1/input/1.js
Normal file
16
crates/swc/tests/fixture/issues-8xxx/8155/1/input/1.js
Normal file
@ -0,0 +1,16 @@
|
||||
const someFn = (xx, x, y) => [x, y];
|
||||
|
||||
const getArray = () => [1, 2, 3];
|
||||
|
||||
const goodFunction = async () => {
|
||||
const rb = await getArray();
|
||||
const rc = await getArray();
|
||||
console.log(someFn(1, rb, rc));
|
||||
}
|
||||
|
||||
const badFunction = async () => {
|
||||
console.log(someFn(1, await getArray(), await getArray()))
|
||||
}
|
||||
|
||||
goodFunction();
|
||||
badFunction();
|
20
crates/swc/tests/fixture/issues-8xxx/8155/1/output/1.js
Normal file
20
crates/swc/tests/fixture/issues-8xxx/8155/1/output/1.js
Normal file
@ -0,0 +1,20 @@
|
||||
var _ref, _ref1;
|
||||
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
||||
let someFn = (xx, x, y)=>[
|
||||
x,
|
||||
y
|
||||
], getArray = ()=>[
|
||||
1,
|
||||
2,
|
||||
3
|
||||
], goodFunction = (_ref = _async_to_generator(function*() {
|
||||
let rb = yield getArray(), rc = yield getArray();
|
||||
console.log(someFn(1, rb, rc));
|
||||
}), function() {
|
||||
return _ref.apply(this, arguments);
|
||||
}), badFunction = (_ref1 = _async_to_generator(function*() {
|
||||
console.log(someFn(1, (yield getArray()), (yield getArray())));
|
||||
}), function() {
|
||||
return _ref1.apply(this, arguments);
|
||||
});
|
||||
goodFunction(), badFunction();
|
16
crates/swc/tests/fixture/issues-8xxx/8155/2/input/.swcrc
Normal file
16
crates/swc/tests/fixture/issues-8xxx/8155/2/input/.swcrc
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"decorators": true,
|
||||
"tsx": false
|
||||
},
|
||||
"transform": {
|
||||
"legacyDecorator": true
|
||||
},
|
||||
"target": "es2016",
|
||||
"loose": false,
|
||||
"externalHelpers": false
|
||||
},
|
||||
"isModule": true
|
||||
}
|
16
crates/swc/tests/fixture/issues-8xxx/8155/2/input/1.js
Normal file
16
crates/swc/tests/fixture/issues-8xxx/8155/2/input/1.js
Normal file
@ -0,0 +1,16 @@
|
||||
const someFn = (xx, x, y) => [x, y];
|
||||
|
||||
const getArray = () => [1, 2, 3];
|
||||
|
||||
const goodFunction = async () => {
|
||||
const rb = await getArray();
|
||||
const rc = await getArray();
|
||||
console.log(someFn(1, rb, rc));
|
||||
}
|
||||
|
||||
const badFunction = async () => {
|
||||
console.log(someFn(1, await getArray(), await getArray()))
|
||||
}
|
||||
|
||||
goodFunction();
|
||||
badFunction();
|
30
crates/swc/tests/fixture/issues-8xxx/8155/2/output/1.js
Normal file
30
crates/swc/tests/fixture/issues-8xxx/8155/2/output/1.js
Normal file
@ -0,0 +1,30 @@
|
||||
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
||||
const someFn = (xx, x, y)=>[
|
||||
x,
|
||||
y
|
||||
];
|
||||
const getArray = ()=>[
|
||||
1,
|
||||
2,
|
||||
3
|
||||
];
|
||||
const goodFunction = function() {
|
||||
var _ref = _async_to_generator(function*() {
|
||||
const rb = yield getArray();
|
||||
const rc = yield getArray();
|
||||
console.log(someFn(1, rb, rc));
|
||||
});
|
||||
return function goodFunction() {
|
||||
return _ref.apply(this, arguments);
|
||||
};
|
||||
}();
|
||||
const badFunction = function() {
|
||||
var _ref = _async_to_generator(function*() {
|
||||
console.log(someFn(1, (yield getArray()), (yield getArray())));
|
||||
});
|
||||
return function badFunction() {
|
||||
return _ref.apply(this, arguments);
|
||||
};
|
||||
}();
|
||||
goodFunction();
|
||||
badFunction();
|
@ -1,3 +1,10 @@
|
||||
//// [asyncArrowFunction10_es5.ts]
|
||||
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
||||
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
||||
_async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2
|
||||
];
|
||||
});
|
||||
});
|
||||
|
@ -1,2 +1,3 @@
|
||||
//// [asyncArrowFunction10_es6.ts]
|
||||
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
||||
_async_to_generator(function*() {});
|
||||
|
@ -1,3 +1,10 @@
|
||||
//// [asyncArrowFunction1_es5.ts]
|
||||
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
||||
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
||||
_async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2
|
||||
];
|
||||
});
|
||||
});
|
||||
|
@ -1,2 +1,3 @@
|
||||
//// [asyncArrowFunction1_es6.ts]
|
||||
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
||||
_async_to_generator(function*() {});
|
||||
|
@ -3,4 +3,81 @@ var M;
|
||||
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
||||
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
|
||||
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
||||
M || (M = {});
|
||||
_async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2
|
||||
];
|
||||
});
|
||||
}), _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2
|
||||
];
|
||||
});
|
||||
}), _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2
|
||||
];
|
||||
});
|
||||
}), _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2
|
||||
];
|
||||
});
|
||||
}), _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2
|
||||
];
|
||||
});
|
||||
}), _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2
|
||||
];
|
||||
});
|
||||
}), _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2,
|
||||
p
|
||||
];
|
||||
});
|
||||
}), _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2,
|
||||
mp
|
||||
];
|
||||
});
|
||||
}), _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2,
|
||||
mp
|
||||
];
|
||||
});
|
||||
}), _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2,
|
||||
p
|
||||
];
|
||||
});
|
||||
}), function(M) {
|
||||
function _f1() {
|
||||
return (_f1 = _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2
|
||||
];
|
||||
});
|
||||
})).apply(this, arguments);
|
||||
}
|
||||
M.f1 = function() {
|
||||
return _f1.apply(this, arguments);
|
||||
};
|
||||
}(M || (M = {}));
|
||||
|
@ -1,4 +1,19 @@
|
||||
//// [asyncAwaitIsolatedModules_es6.ts]
|
||||
var M;
|
||||
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
||||
M || (M = {});
|
||||
_async_to_generator(function*() {}), _async_to_generator(function*() {}), _async_to_generator(function*() {}), _async_to_generator(function*() {}), _async_to_generator(function*() {}), _async_to_generator(function*() {}), _async_to_generator(function*() {
|
||||
return p;
|
||||
}), _async_to_generator(function*() {
|
||||
return mp;
|
||||
}), _async_to_generator(function*() {
|
||||
return mp;
|
||||
}), _async_to_generator(function*() {
|
||||
return p;
|
||||
}), function(M) {
|
||||
function _f1() {
|
||||
return (_f1 = _async_to_generator(function*() {})).apply(this, arguments);
|
||||
}
|
||||
M.f1 = function() {
|
||||
return _f1.apply(this, arguments);
|
||||
};
|
||||
}(M || (M = {}));
|
||||
|
@ -3,4 +3,81 @@ var M;
|
||||
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
||||
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
|
||||
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
||||
M || (M = {});
|
||||
_async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2
|
||||
];
|
||||
});
|
||||
}), _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2
|
||||
];
|
||||
});
|
||||
}), _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2
|
||||
];
|
||||
});
|
||||
}), _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2
|
||||
];
|
||||
});
|
||||
}), _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2
|
||||
];
|
||||
});
|
||||
}), _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2
|
||||
];
|
||||
});
|
||||
}), _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2,
|
||||
p
|
||||
];
|
||||
});
|
||||
}), _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2,
|
||||
mp
|
||||
];
|
||||
});
|
||||
}), _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2,
|
||||
mp
|
||||
];
|
||||
});
|
||||
}), _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2,
|
||||
p
|
||||
];
|
||||
});
|
||||
}), function(M) {
|
||||
function _f1() {
|
||||
return (_f1 = _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2
|
||||
];
|
||||
});
|
||||
})).apply(this, arguments);
|
||||
}
|
||||
M.f1 = function() {
|
||||
return _f1.apply(this, arguments);
|
||||
};
|
||||
}(M || (M = {}));
|
||||
|
@ -1,4 +1,19 @@
|
||||
//// [asyncAwait_es6.ts]
|
||||
var M;
|
||||
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
||||
M || (M = {});
|
||||
_async_to_generator(function*() {}), _async_to_generator(function*() {}), _async_to_generator(function*() {}), _async_to_generator(function*() {}), _async_to_generator(function*() {}), _async_to_generator(function*() {}), _async_to_generator(function*() {
|
||||
return p;
|
||||
}), _async_to_generator(function*() {
|
||||
return mp;
|
||||
}), _async_to_generator(function*() {
|
||||
return mp;
|
||||
}), _async_to_generator(function*() {
|
||||
return p;
|
||||
}), function(M) {
|
||||
function _f1() {
|
||||
return (_f1 = _async_to_generator(function*() {})).apply(this, arguments);
|
||||
}
|
||||
M.f1 = function() {
|
||||
return _f1.apply(this, arguments);
|
||||
};
|
||||
}(M || (M = {}));
|
||||
|
@ -1,3 +1,34 @@
|
||||
//// [asyncUnParenthesizedArrowFunction_es5.ts]
|
||||
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
||||
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
||||
_async_to_generator(function(i) {
|
||||
return _ts_generator(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
someOtherFunction(i)
|
||||
];
|
||||
case 1:
|
||||
return [
|
||||
2,
|
||||
_state.sent()
|
||||
];
|
||||
}
|
||||
});
|
||||
}), _async_to_generator(function(i) {
|
||||
return _ts_generator(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
someOtherFunction(i)
|
||||
];
|
||||
case 1:
|
||||
return [
|
||||
2,
|
||||
_state.sent()
|
||||
];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -1,2 +1,7 @@
|
||||
//// [asyncUnParenthesizedArrowFunction_es6.ts]
|
||||
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
||||
_async_to_generator(function*(i) {
|
||||
return yield someOtherFunction(i);
|
||||
}), _async_to_generator(function*(i) {
|
||||
return yield someOtherFunction(i);
|
||||
});
|
||||
|
@ -1,21 +1,44 @@
|
||||
//// [F1.ts]
|
||||
import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator";
|
||||
_wrap_async_generator(function*() {});
|
||||
//// [F2.ts]
|
||||
import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator";
|
||||
_wrap_async_generator(function*() {
|
||||
yield;
|
||||
});
|
||||
//// [F3.ts]
|
||||
import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator";
|
||||
_wrap_async_generator(function*() {
|
||||
yield 1;
|
||||
});
|
||||
//// [F4.ts]
|
||||
import { _ as _async_generator_delegate } from "@swc/helpers/_/_async_generator_delegate";
|
||||
import { _ as _async_iterator } from "@swc/helpers/_/_async_iterator";
|
||||
import { _ as _await_async_generator } from "@swc/helpers/_/_await_async_generator";
|
||||
import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator";
|
||||
_wrap_async_generator(function*() {
|
||||
yield* _async_generator_delegate(_async_iterator([
|
||||
1
|
||||
]), _await_async_generator);
|
||||
});
|
||||
//// [F5.ts]
|
||||
import { _ as _async_generator_delegate } from "@swc/helpers/_/_async_generator_delegate";
|
||||
import { _ as _async_iterator } from "@swc/helpers/_/_async_iterator";
|
||||
import { _ as _await_async_generator } from "@swc/helpers/_/_await_async_generator";
|
||||
import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator";
|
||||
_wrap_async_generator(function*() {
|
||||
yield* _async_generator_delegate(_async_iterator(_wrap_async_generator(function*() {
|
||||
yield 1;
|
||||
})()), _await_async_generator);
|
||||
});
|
||||
//// [F6.ts]
|
||||
import { _ as _await_async_generator } from "@swc/helpers/_/_await_async_generator";
|
||||
import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator";
|
||||
_wrap_async_generator(function*() {
|
||||
yield _await_async_generator(1);
|
||||
});
|
||||
//// [F7.ts]
|
||||
import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator";
|
||||
_wrap_async_generator(function*() {
|
||||
return 1;
|
||||
});
|
||||
|
@ -1,12 +1,48 @@
|
||||
//// [F1.ts]
|
||||
import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator";
|
||||
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
||||
_wrap_async_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2
|
||||
];
|
||||
});
|
||||
});
|
||||
//// [F2.ts]
|
||||
import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator";
|
||||
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
||||
_wrap_async_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
});
|
||||
//// [F3.ts]
|
||||
import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator";
|
||||
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
||||
_wrap_async_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
1
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
});
|
||||
//// [F4.ts]
|
||||
import { _ as _async_generator_delegate } from "@swc/helpers/_/_async_generator_delegate";
|
||||
import { _ as _async_iterator } from "@swc/helpers/_/_async_iterator";
|
||||
@ -14,6 +50,23 @@ import { _ as _await_async_generator } from "@swc/helpers/_/_await_async_generat
|
||||
import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator";
|
||||
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
||||
import { _ as _ts_values } from "@swc/helpers/_/_ts_values";
|
||||
_wrap_async_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
5,
|
||||
_ts_values(_async_generator_delegate(_async_iterator([
|
||||
1
|
||||
]), _await_async_generator))
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
});
|
||||
//// [F5.ts]
|
||||
import { _ as _async_generator_delegate } from "@swc/helpers/_/_async_generator_delegate";
|
||||
import { _ as _async_iterator } from "@swc/helpers/_/_async_iterator";
|
||||
@ -21,10 +74,62 @@ import { _ as _await_async_generator } from "@swc/helpers/_/_await_async_generat
|
||||
import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator";
|
||||
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
||||
import { _ as _ts_values } from "@swc/helpers/_/_ts_values";
|
||||
_wrap_async_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
5,
|
||||
_ts_values(_async_generator_delegate(_async_iterator(_wrap_async_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
1
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})()), _await_async_generator))
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
});
|
||||
//// [F6.ts]
|
||||
import { _ as _await_async_generator } from "@swc/helpers/_/_await_async_generator";
|
||||
import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator";
|
||||
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
||||
_wrap_async_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
_await_async_generator(1)
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
});
|
||||
//// [F7.ts]
|
||||
import { _ as _wrap_async_generator } from "@swc/helpers/_/_wrap_async_generator";
|
||||
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
||||
_wrap_async_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
return [
|
||||
2,
|
||||
1
|
||||
];
|
||||
});
|
||||
});
|
||||
|
@ -1 +1,156 @@
|
||||
//// [test.ts]
|
||||
define([
|
||||
"require",
|
||||
"exports",
|
||||
"@swc/helpers/_/_async_to_generator",
|
||||
"@swc/helpers/_/_class_call_check",
|
||||
"@swc/helpers/_/_interop_require_wildcard",
|
||||
"@swc/helpers/_/_ts_generator"
|
||||
], function(require, exports, _async_to_generator, _class_call_check, _interop_require_wildcard, _ts_generator) {
|
||||
function fn() {
|
||||
return _fn.apply(this, arguments);
|
||||
}
|
||||
function _fn() {
|
||||
return (_fn = _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
new Promise(function(resolve, reject) {
|
||||
return require([
|
||||
"./test"
|
||||
], function(m) {
|
||||
return resolve(/*#__PURE__*/ _interop_require_wildcard._(m));
|
||||
}, reject);
|
||||
}) // ONE
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})).apply(this, arguments);
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: !0
|
||||
}), function(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: !0,
|
||||
get: all[name]
|
||||
});
|
||||
}(exports, {
|
||||
cl1: function() {
|
||||
return cl1;
|
||||
},
|
||||
cl2: function() {
|
||||
return cl2;
|
||||
},
|
||||
fn: function() {
|
||||
return fn;
|
||||
},
|
||||
l: function() {
|
||||
return l;
|
||||
},
|
||||
obj: function() {
|
||||
return obj;
|
||||
}
|
||||
});
|
||||
var _ref, cl1 = function() {
|
||||
function cl1() {
|
||||
_class_call_check._(this, cl1);
|
||||
}
|
||||
return cl1.prototype.m = function() {
|
||||
return _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
new Promise(function(resolve, reject) {
|
||||
return require([
|
||||
"./test"
|
||||
], function(m) {
|
||||
return resolve(/*#__PURE__*/ _interop_require_wildcard._(m));
|
||||
}, reject);
|
||||
}) // TWO
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})();
|
||||
}, cl1;
|
||||
}(), obj = {
|
||||
m: /*#__PURE__*/ _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
new Promise(function(resolve, reject) {
|
||||
return require([
|
||||
"./test"
|
||||
], function(m) {
|
||||
return resolve(/*#__PURE__*/ _interop_require_wildcard._(m));
|
||||
}, reject);
|
||||
}) // THREE
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})
|
||||
}, cl2 = function cl2() {
|
||||
_class_call_check._(this, cl2), this.p = {
|
||||
m: /*#__PURE__*/ _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
new Promise(function(resolve, reject) {
|
||||
return require([
|
||||
"./test"
|
||||
], function(m) {
|
||||
return resolve(/*#__PURE__*/ _interop_require_wildcard._(m));
|
||||
}, reject);
|
||||
}) // FOUR
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})
|
||||
};
|
||||
}, l = (_ref = _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
new Promise(function(resolve, reject) {
|
||||
return require([
|
||||
"./test"
|
||||
], function(m) {
|
||||
return resolve(/*#__PURE__*/ _interop_require_wildcard._(m));
|
||||
}, reject);
|
||||
}) // FIVE
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
}), function() {
|
||||
return _ref.apply(this, arguments);
|
||||
});
|
||||
});
|
||||
|
@ -1,7 +1,113 @@
|
||||
//// [test.ts]
|
||||
exports, exports;
|
||||
var _async_to_generator = require("@swc/helpers/_/_async_to_generator"), _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard"), _ts_generator = require("@swc/helpers/_/_ts_generator");
|
||||
_async_to_generator._(function() {
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: !0
|
||||
}), function(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: !0,
|
||||
get: all[name]
|
||||
});
|
||||
}(exports, {
|
||||
cl1: function() {
|
||||
return cl1;
|
||||
},
|
||||
cl2: function() {
|
||||
return cl2;
|
||||
},
|
||||
fn: function() {
|
||||
return fn;
|
||||
},
|
||||
l: function() {
|
||||
return l;
|
||||
},
|
||||
obj: function() {
|
||||
return obj;
|
||||
}
|
||||
});
|
||||
var _ref, _async_to_generator = require("@swc/helpers/_/_async_to_generator"), _class_call_check = require("@swc/helpers/_/_class_call_check"), _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard"), _ts_generator = require("@swc/helpers/_/_ts_generator");
|
||||
function fn() {
|
||||
return _fn.apply(this, arguments);
|
||||
}
|
||||
function _fn() {
|
||||
return (_fn = _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
Promise.resolve().then(function() {
|
||||
return /*#__PURE__*/ _interop_require_wildcard._(require("./test"));
|
||||
}) // ONE
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})).apply(this, arguments);
|
||||
}
|
||||
var cl1 = function() {
|
||||
function cl1() {
|
||||
_class_call_check._(this, cl1);
|
||||
}
|
||||
return cl1.prototype.m = function() {
|
||||
return _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
Promise.resolve().then(function() {
|
||||
return /*#__PURE__*/ _interop_require_wildcard._(require("./test"));
|
||||
}) // TWO
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})();
|
||||
}, cl1;
|
||||
}(), obj = {
|
||||
m: /*#__PURE__*/ _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
Promise.resolve().then(function() {
|
||||
return /*#__PURE__*/ _interop_require_wildcard._(require("./test"));
|
||||
}) // THREE
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})
|
||||
}, cl2 = function cl2() {
|
||||
_class_call_check._(this, cl2), this.p = {
|
||||
m: /*#__PURE__*/ _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
Promise.resolve().then(function() {
|
||||
return /*#__PURE__*/ _interop_require_wildcard._(require("./test"));
|
||||
}) // FOUR
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})
|
||||
};
|
||||
}, l = (_ref = _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
@ -17,4 +123,6 @@ _async_to_generator._(function() {
|
||||
];
|
||||
}
|
||||
});
|
||||
}), function() {
|
||||
return _ref.apply(this, arguments);
|
||||
});
|
||||
|
@ -1 +1,115 @@
|
||||
//// [test.ts]
|
||||
System.register([
|
||||
"@swc/helpers/_/_async_to_generator",
|
||||
"@swc/helpers/_/_class_call_check",
|
||||
"@swc/helpers/_/_ts_generator"
|
||||
], function(_export, _context) {
|
||||
var _async_to_generator, _class_call_check, _ts_generator;
|
||||
function _fn() {
|
||||
return (_fn = _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
_context.import("./test") // ONE
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})).apply(this, arguments);
|
||||
}
|
||||
return _export("fn", function() {
|
||||
return _fn.apply(this, arguments);
|
||||
}), {
|
||||
setters: [
|
||||
function(_async_to_generator1) {
|
||||
_async_to_generator = _async_to_generator1._;
|
||||
},
|
||||
function(_class_call_check1) {
|
||||
_class_call_check = _class_call_check1._;
|
||||
},
|
||||
function(_ts_generator1) {
|
||||
_ts_generator = _ts_generator1._;
|
||||
}
|
||||
],
|
||||
execute: function() {
|
||||
var _ref;
|
||||
_export("cl1", function() {
|
||||
function cl1() {
|
||||
_class_call_check(this, cl1);
|
||||
}
|
||||
return cl1.prototype.m = function() {
|
||||
return _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
_context.import("./test") // TWO
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})();
|
||||
}, cl1;
|
||||
}()), _export("obj", {
|
||||
m: /*#__PURE__*/ _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
_context.import("./test") // THREE
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})
|
||||
}), _export("cl2", function cl2() {
|
||||
_class_call_check(this, cl2), this.p = {
|
||||
m: /*#__PURE__*/ _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
_context.import("./test") // FOUR
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})
|
||||
};
|
||||
}), _export("l", (_ref = _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
_context.import("./test") // FIVE
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
}), function() {
|
||||
return _ref.apply(this, arguments);
|
||||
}));
|
||||
}
|
||||
};
|
||||
});
|
||||
|
@ -1 +1,126 @@
|
||||
//// [test.ts]
|
||||
var global, factory;
|
||||
global = this, factory = function(exports1, _async_to_generator, _class_call_check, _interop_require_wildcard, _ts_generator) {
|
||||
function fn() {
|
||||
return _fn.apply(this, arguments);
|
||||
}
|
||||
function _fn() {
|
||||
return (_fn = _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
import("./test") // ONE
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})).apply(this, arguments);
|
||||
}
|
||||
Object.defineProperty(exports1, "__esModule", {
|
||||
value: !0
|
||||
}), function(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: !0,
|
||||
get: all[name]
|
||||
});
|
||||
}(exports1, {
|
||||
cl1: function() {
|
||||
return cl1;
|
||||
},
|
||||
cl2: function() {
|
||||
return cl2;
|
||||
},
|
||||
fn: function() {
|
||||
return fn;
|
||||
},
|
||||
l: function() {
|
||||
return l;
|
||||
},
|
||||
obj: function() {
|
||||
return obj;
|
||||
}
|
||||
});
|
||||
var _ref, cl1 = function() {
|
||||
function cl1() {
|
||||
_class_call_check._(this, cl1);
|
||||
}
|
||||
return cl1.prototype.m = function() {
|
||||
return _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
import("./test") // TWO
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})();
|
||||
}, cl1;
|
||||
}(), obj = {
|
||||
m: /*#__PURE__*/ _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
import("./test") // THREE
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})
|
||||
}, cl2 = function cl2() {
|
||||
_class_call_check._(this, cl2), this.p = {
|
||||
m: /*#__PURE__*/ _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
import("./test") // FOUR
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})
|
||||
};
|
||||
}, l = (_ref = _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
import("./test") // FIVE
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
}), function() {
|
||||
return _ref.apply(this, arguments);
|
||||
});
|
||||
}, "object" == typeof module && "object" == typeof module.exports ? factory(exports, require("@swc/helpers/_/_async_to_generator"), require("@swc/helpers/_/_class_call_check"), require("@swc/helpers/_/_interop_require_wildcard"), require("@swc/helpers/_/_ts_generator")) : "function" == typeof define && define.amd ? define([
|
||||
"exports",
|
||||
"@swc/helpers/_/_async_to_generator",
|
||||
"@swc/helpers/_/_class_call_check",
|
||||
"@swc/helpers/_/_interop_require_wildcard",
|
||||
"@swc/helpers/_/_ts_generator"
|
||||
], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.testTs = {}, global.asyncToGenerator, global.classCallCheck, global.interopRequireWildcard, global.tsGenerator);
|
||||
|
@ -1 +1,156 @@
|
||||
//// [test.ts]
|
||||
define([
|
||||
"require",
|
||||
"exports",
|
||||
"@swc/helpers/_/_async_to_generator",
|
||||
"@swc/helpers/_/_class_call_check",
|
||||
"@swc/helpers/_/_interop_require_wildcard",
|
||||
"@swc/helpers/_/_ts_generator"
|
||||
], function(require, exports, _async_to_generator, _class_call_check, _interop_require_wildcard, _ts_generator) {
|
||||
function fn() {
|
||||
return _fn.apply(this, arguments);
|
||||
}
|
||||
function _fn() {
|
||||
return (_fn = _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
new Promise(function(resolve, reject) {
|
||||
return require([
|
||||
"./test"
|
||||
], function(m) {
|
||||
return resolve(/*#__PURE__*/ _interop_require_wildcard._(m));
|
||||
}, reject);
|
||||
}) // ONE
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})).apply(this, arguments);
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: !0
|
||||
}), function(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: !0,
|
||||
get: all[name]
|
||||
});
|
||||
}(exports, {
|
||||
cl1: function() {
|
||||
return cl1;
|
||||
},
|
||||
cl2: function() {
|
||||
return cl2;
|
||||
},
|
||||
fn: function() {
|
||||
return fn;
|
||||
},
|
||||
l: function() {
|
||||
return l;
|
||||
},
|
||||
obj: function() {
|
||||
return obj;
|
||||
}
|
||||
});
|
||||
var _ref, cl1 = function() {
|
||||
function cl1() {
|
||||
_class_call_check._(this, cl1);
|
||||
}
|
||||
return cl1.prototype.m = function() {
|
||||
return _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
new Promise(function(resolve, reject) {
|
||||
return require([
|
||||
"./test"
|
||||
], function(m) {
|
||||
return resolve(/*#__PURE__*/ _interop_require_wildcard._(m));
|
||||
}, reject);
|
||||
}) // TWO
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})();
|
||||
}, cl1;
|
||||
}(), obj = {
|
||||
m: /*#__PURE__*/ _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
new Promise(function(resolve, reject) {
|
||||
return require([
|
||||
"./test"
|
||||
], function(m) {
|
||||
return resolve(/*#__PURE__*/ _interop_require_wildcard._(m));
|
||||
}, reject);
|
||||
}) // THREE
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})
|
||||
}, cl2 = function cl2() {
|
||||
_class_call_check._(this, cl2), this.p = {
|
||||
m: /*#__PURE__*/ _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
new Promise(function(resolve, reject) {
|
||||
return require([
|
||||
"./test"
|
||||
], function(m) {
|
||||
return resolve(/*#__PURE__*/ _interop_require_wildcard._(m));
|
||||
}, reject);
|
||||
}) // FOUR
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})
|
||||
};
|
||||
}, l = (_ref = _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
new Promise(function(resolve, reject) {
|
||||
return require([
|
||||
"./test"
|
||||
], function(m) {
|
||||
return resolve(/*#__PURE__*/ _interop_require_wildcard._(m));
|
||||
}, reject);
|
||||
}) // FIVE
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
}), function() {
|
||||
return _ref.apply(this, arguments);
|
||||
});
|
||||
});
|
||||
|
@ -1,7 +1,113 @@
|
||||
//// [test.ts]
|
||||
exports, exports;
|
||||
var _async_to_generator = require("@swc/helpers/_/_async_to_generator"), _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard"), _ts_generator = require("@swc/helpers/_/_ts_generator");
|
||||
_async_to_generator._(function() {
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: !0
|
||||
}), function(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: !0,
|
||||
get: all[name]
|
||||
});
|
||||
}(exports, {
|
||||
cl1: function() {
|
||||
return cl1;
|
||||
},
|
||||
cl2: function() {
|
||||
return cl2;
|
||||
},
|
||||
fn: function() {
|
||||
return fn;
|
||||
},
|
||||
l: function() {
|
||||
return l;
|
||||
},
|
||||
obj: function() {
|
||||
return obj;
|
||||
}
|
||||
});
|
||||
var _ref, _async_to_generator = require("@swc/helpers/_/_async_to_generator"), _class_call_check = require("@swc/helpers/_/_class_call_check"), _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard"), _ts_generator = require("@swc/helpers/_/_ts_generator");
|
||||
function fn() {
|
||||
return _fn.apply(this, arguments);
|
||||
}
|
||||
function _fn() {
|
||||
return (_fn = _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
Promise.resolve().then(function() {
|
||||
return /*#__PURE__*/ _interop_require_wildcard._(require("./test"));
|
||||
}) // ONE
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})).apply(this, arguments);
|
||||
}
|
||||
var cl1 = function() {
|
||||
function cl1() {
|
||||
_class_call_check._(this, cl1);
|
||||
}
|
||||
return cl1.prototype.m = function() {
|
||||
return _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
Promise.resolve().then(function() {
|
||||
return /*#__PURE__*/ _interop_require_wildcard._(require("./test"));
|
||||
}) // TWO
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})();
|
||||
}, cl1;
|
||||
}(), obj = {
|
||||
m: /*#__PURE__*/ _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
Promise.resolve().then(function() {
|
||||
return /*#__PURE__*/ _interop_require_wildcard._(require("./test"));
|
||||
}) // THREE
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})
|
||||
}, cl2 = function cl2() {
|
||||
_class_call_check._(this, cl2), this.p = {
|
||||
m: /*#__PURE__*/ _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
Promise.resolve().then(function() {
|
||||
return /*#__PURE__*/ _interop_require_wildcard._(require("./test"));
|
||||
}) // FOUR
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})
|
||||
};
|
||||
}, l = (_ref = _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
@ -17,4 +123,6 @@ _async_to_generator._(function() {
|
||||
];
|
||||
}
|
||||
});
|
||||
}), function() {
|
||||
return _ref.apply(this, arguments);
|
||||
});
|
||||
|
@ -1 +1,115 @@
|
||||
//// [test.ts]
|
||||
System.register([
|
||||
"@swc/helpers/_/_async_to_generator",
|
||||
"@swc/helpers/_/_class_call_check",
|
||||
"@swc/helpers/_/_ts_generator"
|
||||
], function(_export, _context) {
|
||||
var _async_to_generator, _class_call_check, _ts_generator;
|
||||
function _fn() {
|
||||
return (_fn = _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
_context.import("./test") // ONE
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})).apply(this, arguments);
|
||||
}
|
||||
return _export("fn", function() {
|
||||
return _fn.apply(this, arguments);
|
||||
}), {
|
||||
setters: [
|
||||
function(_async_to_generator1) {
|
||||
_async_to_generator = _async_to_generator1._;
|
||||
},
|
||||
function(_class_call_check1) {
|
||||
_class_call_check = _class_call_check1._;
|
||||
},
|
||||
function(_ts_generator1) {
|
||||
_ts_generator = _ts_generator1._;
|
||||
}
|
||||
],
|
||||
execute: function() {
|
||||
var _ref;
|
||||
_export("cl1", function() {
|
||||
function cl1() {
|
||||
_class_call_check(this, cl1);
|
||||
}
|
||||
return cl1.prototype.m = function() {
|
||||
return _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
_context.import("./test") // TWO
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})();
|
||||
}, cl1;
|
||||
}()), _export("obj", {
|
||||
m: /*#__PURE__*/ _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
_context.import("./test") // THREE
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})
|
||||
}), _export("cl2", function cl2() {
|
||||
_class_call_check(this, cl2), this.p = {
|
||||
m: /*#__PURE__*/ _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
_context.import("./test") // FOUR
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})
|
||||
};
|
||||
}), _export("l", (_ref = _async_to_generator(function() {
|
||||
return _ts_generator(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
_context.import("./test") // FIVE
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
}), function() {
|
||||
return _ref.apply(this, arguments);
|
||||
}));
|
||||
}
|
||||
};
|
||||
});
|
||||
|
@ -1 +1,126 @@
|
||||
//// [test.ts]
|
||||
var global, factory;
|
||||
global = this, factory = function(exports1, _async_to_generator, _class_call_check, _interop_require_wildcard, _ts_generator) {
|
||||
function fn() {
|
||||
return _fn.apply(this, arguments);
|
||||
}
|
||||
function _fn() {
|
||||
return (_fn = _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
import("./test") // ONE
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})).apply(this, arguments);
|
||||
}
|
||||
Object.defineProperty(exports1, "__esModule", {
|
||||
value: !0
|
||||
}), function(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: !0,
|
||||
get: all[name]
|
||||
});
|
||||
}(exports1, {
|
||||
cl1: function() {
|
||||
return cl1;
|
||||
},
|
||||
cl2: function() {
|
||||
return cl2;
|
||||
},
|
||||
fn: function() {
|
||||
return fn;
|
||||
},
|
||||
l: function() {
|
||||
return l;
|
||||
},
|
||||
obj: function() {
|
||||
return obj;
|
||||
}
|
||||
});
|
||||
var _ref, cl1 = function() {
|
||||
function cl1() {
|
||||
_class_call_check._(this, cl1);
|
||||
}
|
||||
return cl1.prototype.m = function() {
|
||||
return _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
import("./test") // TWO
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})();
|
||||
}, cl1;
|
||||
}(), obj = {
|
||||
m: /*#__PURE__*/ _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
import("./test") // THREE
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})
|
||||
}, cl2 = function cl2() {
|
||||
_class_call_check._(this, cl2), this.p = {
|
||||
m: /*#__PURE__*/ _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
import("./test") // FOUR
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
})
|
||||
};
|
||||
}, l = (_ref = _async_to_generator._(function() {
|
||||
return _ts_generator._(this, function(_state) {
|
||||
switch(_state.label){
|
||||
case 0:
|
||||
return [
|
||||
4,
|
||||
import("./test") // FIVE
|
||||
];
|
||||
case 1:
|
||||
return _state.sent(), [
|
||||
2
|
||||
];
|
||||
}
|
||||
});
|
||||
}), function() {
|
||||
return _ref.apply(this, arguments);
|
||||
});
|
||||
}, "object" == typeof module && "object" == typeof module.exports ? factory(exports, require("@swc/helpers/_/_async_to_generator"), require("@swc/helpers/_/_class_call_check"), require("@swc/helpers/_/_interop_require_wildcard"), require("@swc/helpers/_/_ts_generator")) : "function" == typeof define && define.amd ? define([
|
||||
"exports",
|
||||
"@swc/helpers/_/_async_to_generator",
|
||||
"@swc/helpers/_/_class_call_check",
|
||||
"@swc/helpers/_/_interop_require_wildcard",
|
||||
"@swc/helpers/_/_ts_generator"
|
||||
], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.testTs = {}, global.asyncToGenerator, global.classCallCheck, global.interopRequireWildcard, global.tsGenerator);
|
||||
|
@ -1 +1,82 @@
|
||||
//// [test.ts]
|
||||
define([
|
||||
"require",
|
||||
"exports",
|
||||
"@swc/helpers/_/_async_to_generator",
|
||||
"@swc/helpers/_/_interop_require_wildcard"
|
||||
], function(require, exports, _async_to_generator, _interop_require_wildcard) {
|
||||
var _ref;
|
||||
function fn() {
|
||||
return _fn.apply(this, arguments);
|
||||
}
|
||||
function _fn() {
|
||||
return (_fn = _async_to_generator._(function*() {
|
||||
yield new Promise((resolve, reject)=>require([
|
||||
"./test"
|
||||
], (m)=>resolve(/*#__PURE__*/ _interop_require_wildcard._(m)), reject)) // ONE
|
||||
;
|
||||
})).apply(this, arguments);
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: !0
|
||||
}), function(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: !0,
|
||||
get: all[name]
|
||||
});
|
||||
}(exports, {
|
||||
cl1: function() {
|
||||
return cl1;
|
||||
},
|
||||
cl2: function() {
|
||||
return cl2;
|
||||
},
|
||||
fn: function() {
|
||||
return fn;
|
||||
},
|
||||
l: function() {
|
||||
return l;
|
||||
},
|
||||
obj: function() {
|
||||
return obj;
|
||||
}
|
||||
});
|
||||
class cl1 {
|
||||
m() {
|
||||
return _async_to_generator._(function*() {
|
||||
yield new Promise((resolve, reject)=>require([
|
||||
"./test"
|
||||
], (m)=>resolve(/*#__PURE__*/ _interop_require_wildcard._(m)), reject)) // TWO
|
||||
;
|
||||
})();
|
||||
}
|
||||
}
|
||||
let obj = {
|
||||
m: /*#__PURE__*/ _async_to_generator._(function*() {
|
||||
yield new Promise((resolve, reject)=>require([
|
||||
"./test"
|
||||
], (m)=>resolve(/*#__PURE__*/ _interop_require_wildcard._(m)), reject)) // THREE
|
||||
;
|
||||
})
|
||||
};
|
||||
class cl2 {
|
||||
constructor(){
|
||||
this.p = {
|
||||
m: /*#__PURE__*/ _async_to_generator._(function*() {
|
||||
yield new Promise((resolve, reject)=>require([
|
||||
"./test"
|
||||
], (m)=>resolve(/*#__PURE__*/ _interop_require_wildcard._(m)), reject)) // FOUR
|
||||
;
|
||||
})
|
||||
};
|
||||
}
|
||||
}
|
||||
let l = (_ref = _async_to_generator._(function*() {
|
||||
yield new Promise((resolve, reject)=>require([
|
||||
"./test"
|
||||
], (m)=>resolve(/*#__PURE__*/ _interop_require_wildcard._(m)), reject)) // FIVE
|
||||
;
|
||||
}), function() {
|
||||
return _ref.apply(this, arguments);
|
||||
});
|
||||
});
|
||||
|
@ -1,7 +1,66 @@
|
||||
//// [test.ts]
|
||||
exports, exports;
|
||||
var _ref;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: !0
|
||||
}), function(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: !0,
|
||||
get: all[name]
|
||||
});
|
||||
}(exports, {
|
||||
cl1: function() {
|
||||
return cl1;
|
||||
},
|
||||
cl2: function() {
|
||||
return cl2;
|
||||
},
|
||||
fn: function() {
|
||||
return fn;
|
||||
},
|
||||
l: function() {
|
||||
return l;
|
||||
},
|
||||
obj: function() {
|
||||
return obj;
|
||||
}
|
||||
});
|
||||
const _async_to_generator = require("@swc/helpers/_/_async_to_generator"), _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
||||
_async_to_generator._(function*() {
|
||||
function fn() {
|
||||
return _fn.apply(this, arguments);
|
||||
}
|
||||
function _fn() {
|
||||
return (_fn = _async_to_generator._(function*() {
|
||||
yield Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard._(require("./test"))) // ONE
|
||||
;
|
||||
})).apply(this, arguments);
|
||||
}
|
||||
class cl1 {
|
||||
m() {
|
||||
return _async_to_generator._(function*() {
|
||||
yield Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard._(require("./test"))) // TWO
|
||||
;
|
||||
})();
|
||||
}
|
||||
}
|
||||
const obj = {
|
||||
m: /*#__PURE__*/ _async_to_generator._(function*() {
|
||||
yield Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard._(require("./test"))) // THREE
|
||||
;
|
||||
})
|
||||
};
|
||||
class cl2 {
|
||||
constructor(){
|
||||
this.p = {
|
||||
m: /*#__PURE__*/ _async_to_generator._(function*() {
|
||||
yield Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard._(require("./test"))) // FOUR
|
||||
;
|
||||
})
|
||||
};
|
||||
}
|
||||
}
|
||||
const l = (_ref = _async_to_generator._(function*() {
|
||||
yield Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard._(require("./test"))) // FIVE
|
||||
;
|
||||
}), function() {
|
||||
return _ref.apply(this, arguments);
|
||||
});
|
||||
|
@ -1 +1,55 @@
|
||||
//// [test.ts]
|
||||
System.register([
|
||||
"@swc/helpers/_/_async_to_generator"
|
||||
], function(_export, _context) {
|
||||
var _async_to_generator;
|
||||
function _fn() {
|
||||
return (_fn = _async_to_generator(function*() {
|
||||
yield _context.import('./test') // ONE
|
||||
;
|
||||
})).apply(this, arguments);
|
||||
}
|
||||
return _export({
|
||||
fn: function() {
|
||||
return _fn.apply(this, arguments);
|
||||
},
|
||||
cl1: void 0,
|
||||
cl2: void 0
|
||||
}), {
|
||||
setters: [
|
||||
function(_async_to_generator1) {
|
||||
_async_to_generator = _async_to_generator1._;
|
||||
}
|
||||
],
|
||||
execute: function() {
|
||||
var _ref;
|
||||
_export("cl1", class {
|
||||
m() {
|
||||
return _async_to_generator(function*() {
|
||||
yield _context.import('./test') // TWO
|
||||
;
|
||||
})();
|
||||
}
|
||||
}), _export("obj", {
|
||||
m: /*#__PURE__*/ _async_to_generator(function*() {
|
||||
yield _context.import('./test') // THREE
|
||||
;
|
||||
})
|
||||
}), _export("cl2", class {
|
||||
constructor(){
|
||||
this.p = {
|
||||
m: /*#__PURE__*/ _async_to_generator(function*() {
|
||||
yield _context.import('./test') // FOUR
|
||||
;
|
||||
})
|
||||
};
|
||||
}
|
||||
}), _export("l", (_ref = _async_to_generator(function*() {
|
||||
yield _context.import('./test') // FIVE
|
||||
;
|
||||
}), function() {
|
||||
return _ref.apply(this, arguments);
|
||||
}));
|
||||
}
|
||||
};
|
||||
});
|
||||
|
@ -1 +1,72 @@
|
||||
//// [test.ts]
|
||||
var global, factory;
|
||||
global = this, factory = function(exports1, _async_to_generator, _interop_require_wildcard) {
|
||||
var _ref;
|
||||
function fn() {
|
||||
return _fn.apply(this, arguments);
|
||||
}
|
||||
function _fn() {
|
||||
return (_fn = _async_to_generator._(function*() {
|
||||
yield import('./test') // ONE
|
||||
;
|
||||
})).apply(this, arguments);
|
||||
}
|
||||
Object.defineProperty(exports1, "__esModule", {
|
||||
value: !0
|
||||
}), function(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: !0,
|
||||
get: all[name]
|
||||
});
|
||||
}(exports1, {
|
||||
cl1: function() {
|
||||
return cl1;
|
||||
},
|
||||
cl2: function() {
|
||||
return cl2;
|
||||
},
|
||||
fn: function() {
|
||||
return fn;
|
||||
},
|
||||
l: function() {
|
||||
return l;
|
||||
},
|
||||
obj: function() {
|
||||
return obj;
|
||||
}
|
||||
});
|
||||
class cl1 {
|
||||
m() {
|
||||
return _async_to_generator._(function*() {
|
||||
yield import('./test') // TWO
|
||||
;
|
||||
})();
|
||||
}
|
||||
}
|
||||
let obj = {
|
||||
m: /*#__PURE__*/ _async_to_generator._(function*() {
|
||||
yield import('./test') // THREE
|
||||
;
|
||||
})
|
||||
};
|
||||
class cl2 {
|
||||
constructor(){
|
||||
this.p = {
|
||||
m: /*#__PURE__*/ _async_to_generator._(function*() {
|
||||
yield import('./test') // FOUR
|
||||
;
|
||||
})
|
||||
};
|
||||
}
|
||||
}
|
||||
let l = (_ref = _async_to_generator._(function*() {
|
||||
yield import('./test') // FIVE
|
||||
;
|
||||
}), function() {
|
||||
return _ref.apply(this, arguments);
|
||||
});
|
||||
}, "object" == typeof module && "object" == typeof module.exports ? factory(exports, require("@swc/helpers/_/_async_to_generator"), require("@swc/helpers/_/_interop_require_wildcard")) : "function" == typeof define && define.amd ? define([
|
||||
"exports",
|
||||
"@swc/helpers/_/_async_to_generator",
|
||||
"@swc/helpers/_/_interop_require_wildcard"
|
||||
], factory) : (global = "undefined" != typeof globalThis ? globalThis : global || self) && factory(global.testTs = {}, global.asyncToGenerator, global.interopRequireWildcard);
|
||||
|
@ -24,19 +24,19 @@ Promise.all(assignAll).then((r = e(function(r) {
|
||||
];
|
||||
}
|
||||
});
|
||||
}, s = 'DELETE FROM "TABLE" WHERE "UUID" IN ( ', i = [], r);
|
||||
}, s = 'DELETE FROM "TABLE" WHERE "UUID" IN ( ', i = [], r)i.push(c);
|
||||
o = 0, u.label = 1;
|
||||
case 1:
|
||||
if (!(o < i.length)) return [
|
||||
3,
|
||||
4
|
||||
];
|
||||
return(a = i[o], [
|
||||
return a = i[o], [
|
||||
5,
|
||||
n(e(a))
|
||||
]);
|
||||
];
|
||||
case 2:
|
||||
u.label = 3;
|
||||
u.sent(), u.label = 3;
|
||||
case 3:
|
||||
return o++, [
|
||||
3,
|
||||
|
@ -317,6 +317,8 @@ where
|
||||
}
|
||||
|
||||
fn add_pure_comment(&self, pos: BytePos) {
|
||||
assert_ne!(pos, BytePos(0), "cannot add pure comment to zero position");
|
||||
|
||||
if let Some(c) = self {
|
||||
c.add_pure_comment(pos)
|
||||
}
|
||||
@ -439,6 +441,8 @@ impl Comments for SingleThreadedComments {
|
||||
}
|
||||
|
||||
fn add_pure_comment(&self, pos: BytePos) {
|
||||
assert_ne!(pos, BytePos(0), "cannot add pure comment to zero position");
|
||||
|
||||
let mut leading_map = self.leading.borrow_mut();
|
||||
let leading = leading_map.entry(pos).or_default();
|
||||
let pure_comment = Comment {
|
||||
|
@ -1164,11 +1164,15 @@ impl Generator {
|
||||
.unwrap()
|
||||
.make_member(quote_ident!("concat"))
|
||||
.as_callee(),
|
||||
args: expressions
|
||||
.take()
|
||||
.into_iter()
|
||||
.map(|expr| ExprOrSpread { spread: None, expr })
|
||||
.collect(),
|
||||
args: vec![Box::new(Expr::Array(ArrayLit {
|
||||
span: DUMMY_SP,
|
||||
elems: expressions
|
||||
.take()
|
||||
.into_iter()
|
||||
.map(|expr| Some(ExprOrSpread { spread: None, expr }))
|
||||
.collect(),
|
||||
}))
|
||||
.as_arg()],
|
||||
type_args: Default::default(),
|
||||
}))
|
||||
} else {
|
||||
|
@ -1,7 +1,9 @@
|
||||
use std::iter;
|
||||
|
||||
use serde::Deserialize;
|
||||
use swc_common::{comments::Comments, util::take::Take, Mark, Spanned, SyntaxContext, DUMMY_SP};
|
||||
use swc_common::{
|
||||
comments::Comments, util::take::Take, Mark, Span, Spanned, SyntaxContext, DUMMY_SP,
|
||||
};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_transforms_base::{helper, helper_expr, perf::Check};
|
||||
use swc_ecma_transforms_macros::fast_path;
|
||||
@ -359,7 +361,11 @@ impl<C: Comments> Actual<C> {
|
||||
*expr = wrapper.into();
|
||||
if !in_iife {
|
||||
if let Some(c) = &mut self.comments {
|
||||
c.add_pure_comment(expr.span().lo)
|
||||
let mut lo = expr.span().lo;
|
||||
if lo.is_dummy() {
|
||||
lo = Span::dummy_with_cmt().lo;
|
||||
}
|
||||
c.add_pure_comment(lo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -377,7 +383,11 @@ impl<C: Comments> Actual<C> {
|
||||
*expr = wrapper.into();
|
||||
if !in_iife {
|
||||
if let Some(c) = &mut self.comments {
|
||||
c.add_pure_comment(expr.span().lo)
|
||||
let mut lo = expr.span().lo;
|
||||
if lo.is_dummy() {
|
||||
lo = Span::dummy_with_cmt().lo;
|
||||
}
|
||||
c.add_pure_comment(lo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,9 @@ impl VisitMut for InfoMarker<'_> {
|
||||
_ => false,
|
||||
}
|
||||
{
|
||||
n.span = n.span.apply_mark(self.marks.pure);
|
||||
if !n.span.is_dummy_ignoring_cmt() {
|
||||
n.span = n.span.apply_mark(self.marks.pure);
|
||||
}
|
||||
} else if let Some(pure_fns) = &self.pure_funcs {
|
||||
if let Callee::Expr(e) = &n.callee {
|
||||
// Check for pure_funcs
|
||||
@ -305,6 +307,10 @@ where
|
||||
}
|
||||
|
||||
fn has_flag(comments: Option<&dyn Comments>, span: Span, text: &'static str) -> bool {
|
||||
if span.is_dummy_ignoring_cmt() {
|
||||
return false;
|
||||
}
|
||||
|
||||
find_comment(comments, span, |c| {
|
||||
if c.kind == CommentKind::Block {
|
||||
for line in c.text.lines() {
|
||||
|
59
crates/swc_ecma_minifier/tests/fixture/issues/8173/input.js
Normal file
59
crates/swc_ecma_minifier/tests/fixture/issues/8173/input.js
Normal file
@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
||||
try {
|
||||
var info = gen[key](arg);
|
||||
var value = info.value;
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
if (info.done) {
|
||||
resolve(value);
|
||||
} else {
|
||||
Promise.resolve(value).then(_next, _throw);
|
||||
}
|
||||
}
|
||||
function _async_to_generator(fn) {
|
||||
return function () {
|
||||
var self = this, args = arguments;
|
||||
return new Promise(function (resolve, reject) {
|
||||
var gen = fn.apply(self, args);
|
||||
function _next(value) {
|
||||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
||||
}
|
||||
function _throw(err) {
|
||||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
||||
}
|
||||
_next(undefined);
|
||||
});
|
||||
};
|
||||
}
|
||||
const someFn = (xx, x, y) => [
|
||||
x,
|
||||
y
|
||||
];
|
||||
const getArray = () => [
|
||||
1,
|
||||
2,
|
||||
3
|
||||
];
|
||||
const goodFunction = function () {
|
||||
var _ref = _async_to_generator(function* () {
|
||||
const rb = yield getArray();
|
||||
const rc = yield getArray();
|
||||
console.log(someFn(1, rb, rc));
|
||||
});
|
||||
return function goodFunction() {
|
||||
return _ref.apply(this, arguments);
|
||||
};
|
||||
}();
|
||||
const badFunction = function () {
|
||||
var _ref = _async_to_generator(function* () {
|
||||
console.log(someFn(1, (yield getArray()), (yield getArray())));
|
||||
});
|
||||
return function badFunction() {
|
||||
return _ref.apply(this, arguments);
|
||||
};
|
||||
}();
|
||||
goodFunction();
|
||||
badFunction();
|
44
crates/swc_ecma_minifier/tests/fixture/issues/8173/output.js
Normal file
44
crates/swc_ecma_minifier/tests/fixture/issues/8173/output.js
Normal file
@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
var _ref, _ref1;
|
||||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
||||
try {
|
||||
var info = gen[key](arg), value = info.value;
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw);
|
||||
}
|
||||
function _async_to_generator(fn) {
|
||||
return function() {
|
||||
var self = this, args = arguments;
|
||||
return new Promise(function(resolve, reject) {
|
||||
var gen = fn.apply(self, args);
|
||||
function _next(value) {
|
||||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
||||
}
|
||||
function _throw(err) {
|
||||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
||||
}
|
||||
_next(void 0);
|
||||
});
|
||||
};
|
||||
}
|
||||
const someFn = (xx, x, y)=>[
|
||||
x,
|
||||
y
|
||||
], getArray = ()=>[
|
||||
1,
|
||||
2,
|
||||
3
|
||||
], goodFunction = (_ref = _async_to_generator(function*() {
|
||||
const rb = yield getArray(), rc = yield getArray();
|
||||
console.log(someFn(1, rb, rc));
|
||||
}), function() {
|
||||
return _ref.apply(this, arguments);
|
||||
}), badFunction = (_ref1 = _async_to_generator(function*() {
|
||||
console.log(someFn(1, (yield getArray()), (yield getArray())));
|
||||
}), function() {
|
||||
return _ref1.apply(this, arguments);
|
||||
});
|
||||
goodFunction(), badFunction();
|
@ -0,0 +1,16 @@
|
||||
const someFn = (xx, x, y) => [x, y];
|
||||
|
||||
const getArray = () => [1, 2, 3];
|
||||
|
||||
const goodFunction = async () => {
|
||||
const rb = await getArray();
|
||||
const rc = await getArray();
|
||||
console.log(someFn(1, rb, rc));
|
||||
}
|
||||
|
||||
const badFunction = async () => {
|
||||
console.log(someFn(1, await getArray(), await getArray()))
|
||||
}
|
||||
|
||||
goodFunction();
|
||||
badFunction();
|
Loading…
Reference in New Issue
Block a user