-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(es/compat): Don't add pure annotations to dummy spans (#8172)
- Loading branch information
Showing
41 changed files
with
1,960 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"jsc": { | ||
"parser": { | ||
"syntax": "typescript", | ||
"decorators": true, | ||
"tsx": false | ||
}, | ||
"transform": { | ||
"legacyDecorator": true | ||
}, | ||
"target": "es2016", | ||
"loose": false, | ||
"externalHelpers": false | ||
}, | ||
"isModule": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); |
7 changes: 7 additions & 0 deletions
7
crates/swc/tests/tsc-references/asyncArrowFunction10_es5.2.minified.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 change: 1 addition & 0 deletions
1
crates/swc/tests/tsc-references/asyncArrowFunction10_es6.2.minified.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
//// [asyncArrowFunction10_es6.ts] | ||
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; | ||
_async_to_generator(function*() {}); |
7 changes: 7 additions & 0 deletions
7
crates/swc/tests/tsc-references/asyncArrowFunction1_es5.2.minified.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 change: 1 addition & 0 deletions
1
crates/swc/tests/tsc-references/asyncArrowFunction1_es6.2.minified.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
//// [asyncArrowFunction1_es6.ts] | ||
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; | ||
_async_to_generator(function*() {}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 16 additions & 1 deletion
17
crates/swc/tests/tsc-references/asyncAwaitIsolatedModules_es6.2.minified.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = {})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
9ceb57b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark
es/full/bugs-1
297970
ns/iter (± 7243
)297591
ns/iter (± 15876
)1.00
es/full/minify/libraries/antd
1427398240
ns/iter (± 16026126
)1418868535
ns/iter (± 19210989
)1.01
es/full/minify/libraries/d3
296284197
ns/iter (± 5188108
)293681257
ns/iter (± 947857
)1.01
es/full/minify/libraries/echarts
1142581354
ns/iter (± 18205769
)1125468958
ns/iter (± 9821259
)1.02
es/full/minify/libraries/jquery
89644058
ns/iter (± 238689
)89100441
ns/iter (± 364942
)1.01
es/full/minify/libraries/lodash
105349051
ns/iter (± 923866
)105560679
ns/iter (± 366341
)1.00
es/full/minify/libraries/moment
52882032
ns/iter (± 278327
)52471867
ns/iter (± 79387
)1.01
es/full/minify/libraries/react
19108447
ns/iter (± 639183
)18905262
ns/iter (± 187544
)1.01
es/full/minify/libraries/terser
233008526
ns/iter (± 1725639
)233453084
ns/iter (± 2025616
)1.00
es/full/minify/libraries/three
419360918
ns/iter (± 8984638
)414839760
ns/iter (± 2630087
)1.01
es/full/minify/libraries/typescript
2839524316
ns/iter (± 9903501
)2813695612
ns/iter (± 10647686
)1.01
es/full/minify/libraries/victory
627274999
ns/iter (± 11036912
)609167287
ns/iter (± 11730707
)1.03
es/full/minify/libraries/vue
127432693
ns/iter (± 243308
)127190271
ns/iter (± 496240
)1.00
es/full/codegen/es3
35188
ns/iter (± 409
)33369
ns/iter (± 75
)1.05
es/full/codegen/es5
35176
ns/iter (± 120
)33389
ns/iter (± 281
)1.05
es/full/codegen/es2015
35176
ns/iter (± 66
)33319
ns/iter (± 90
)1.06
es/full/codegen/es2016
35165
ns/iter (± 74
)33329
ns/iter (± 102
)1.06
es/full/codegen/es2017
35137
ns/iter (± 35
)33341
ns/iter (± 113
)1.05
es/full/codegen/es2018
35141
ns/iter (± 57
)33447
ns/iter (± 128
)1.05
es/full/codegen/es2019
35278
ns/iter (± 67
)33332
ns/iter (± 53
)1.06
es/full/codegen/es2020
35276
ns/iter (± 53
)33385
ns/iter (± 89
)1.06
es/full/all/es3
179778422
ns/iter (± 1090071
)176851152
ns/iter (± 1655263
)1.02
es/full/all/es5
172410368
ns/iter (± 1024060
)170574306
ns/iter (± 1166089
)1.01
es/full/all/es2015
130018732
ns/iter (± 1057600
)129207422
ns/iter (± 1533857
)1.01
es/full/all/es2016
128708929
ns/iter (± 1945213
)128333484
ns/iter (± 923435
)1.00
es/full/all/es2017
128164224
ns/iter (± 540931
)127794822
ns/iter (± 1129992
)1.00
es/full/all/es2018
126167606
ns/iter (± 835959
)125382985
ns/iter (± 698973
)1.01
es/full/all/es2019
125274437
ns/iter (± 803543
)125013938
ns/iter (± 1202019
)1.00
es/full/all/es2020
120825084
ns/iter (± 1319743
)121063117
ns/iter (± 1272673
)1.00
es/full/parser
558546
ns/iter (± 3304
)562074
ns/iter (± 3452
)0.99
es/full/base/fixer
19117
ns/iter (± 95
)17785
ns/iter (± 49
)1.07
es/full/base/resolver_and_hygiene
86604
ns/iter (± 129
)82619
ns/iter (± 623
)1.05
This comment was automatically generated by workflow using github-action-benchmark.