-
-
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.
- Loading branch information
Showing
8 changed files
with
185 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
{ | ||
"jsc": { | ||
"parser": { | ||
"syntax": "ecmascript", | ||
"jsx": false | ||
}, | ||
"target": "es2022", | ||
"loose": false, | ||
"minify": { | ||
"compress": { | ||
"arguments": false, | ||
"arrows": false, | ||
"booleans": false, | ||
"booleans_as_integers": false, | ||
"collapse_vars": false, | ||
"comparisons": false, | ||
"computed_props": false, | ||
"conditionals": false, | ||
"dead_code": false, | ||
"directives": false, | ||
"drop_console": false, | ||
"drop_debugger": false, | ||
"evaluate": false, | ||
"expression": false, | ||
"hoist_funs": false, | ||
"hoist_props": false, | ||
"hoist_vars": false, | ||
"if_return": true, | ||
"join_vars": false, | ||
"keep_classnames": false, | ||
"keep_fargs": false, | ||
"keep_fnames": false, | ||
"keep_infinity": false, | ||
"loops": false, | ||
"negate_iife": false, | ||
"properties": false, | ||
"reduce_funcs": false, | ||
"reduce_vars": false, | ||
"side_effects": false, | ||
"switches": false, | ||
"typeofs": false, | ||
"unsafe": false, | ||
"unsafe_arrows": false, | ||
"unsafe_comps": false, | ||
"unsafe_Function": false, | ||
"unsafe_math": false, | ||
"unsafe_symbols": false, | ||
"unsafe_methods": false, | ||
"unsafe_proto": false, | ||
"unsafe_regexp": false, | ||
"unsafe_undefined": false, | ||
"unused": false, | ||
"const_to_let": false, | ||
"pristine_globals": false, | ||
"passes": 3 | ||
}, | ||
"mangle": 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,24 @@ | ||
function Deferred() { | ||
const deferred = this; | ||
deferred.promise = new Promise(function (resolve, reject) { | ||
deferred.resolve = resolve; | ||
deferred.reject = reject; | ||
}); | ||
} | ||
|
||
export async function bug() { | ||
const s = `next`; | ||
if (!window[s]) { | ||
for (window[s] = new Deferred(); ;) | ||
if (window.current) await window.current.promise; | ||
else { | ||
window.current = window[s]; | ||
try { | ||
return await window[s].promise // This line compressed to 'break'. I guess compressor intended jump to 23 line which is looks like same code. | ||
} finally { | ||
delete window.current // Above 'break' makes unintended delete | ||
} | ||
} | ||
} | ||
return await window[s].promise | ||
} |
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 @@ | ||
function Deferred() { | ||
const deferred = this; | ||
deferred.promise = new Promise(function(resolve, reject) { | ||
deferred.resolve = resolve, deferred.reject = reject; | ||
}); | ||
} | ||
export async function bug() { | ||
const s = "next"; | ||
if (!window[s]) for(window[s] = new Deferred();;)if (window.current) await window.current.promise; | ||
else { | ||
window.current = window[s]; | ||
try { | ||
return await window[s].promise; | ||
} finally{ | ||
delete window.current; | ||
} | ||
} | ||
return await window[s].promise; | ||
} |
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
5 changes: 5 additions & 0 deletions
5
crates/swc_ecma_minifier/tests/fixture/issues/8324/config.json
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,5 @@ | ||
{ | ||
"defaults": false, | ||
"if_return": true, | ||
"passes": 3 | ||
} |
24 changes: 24 additions & 0 deletions
24
crates/swc_ecma_minifier/tests/fixture/issues/8324/input.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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
function Deferred() { | ||
const deferred = this; | ||
deferred.promise = new Promise(function (resolve, reject) { | ||
deferred.resolve = resolve; | ||
deferred.reject = reject; | ||
}); | ||
} | ||
|
||
export async function bug() { | ||
const s = `next`; | ||
if (!window[s]) { | ||
for (window[s] = new Deferred(); ;) | ||
if (window.current) await window.current.promise; | ||
else { | ||
window.current = window[s]; | ||
try { | ||
return await window[s].promise // This line compressed to 'break'. I guess compressor intended jump to 23 line which is looks like same code. | ||
} finally { | ||
delete window.current // Above 'break' makes unintended delete | ||
} | ||
} | ||
} | ||
return await window[s].promise | ||
} |
22 changes: 22 additions & 0 deletions
22
crates/swc_ecma_minifier/tests/fixture/issues/8324/output.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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
function Deferred() { | ||
const deferred = this; | ||
deferred.promise = new Promise(function(resolve, reject) { | ||
deferred.resolve = resolve; | ||
deferred.reject = reject; | ||
}); | ||
} | ||
export async function bug() { | ||
const s = "next"; | ||
if (!window[s]) { | ||
for(window[s] = new Deferred();;)if (window.current) await window.current.promise; | ||
else { | ||
window.current = window[s]; | ||
try { | ||
return await window[s].promise; | ||
} finally{ | ||
delete window.current; | ||
} | ||
} | ||
} | ||
return await window[s].promise; | ||
} |