Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(es/minifier): Don't inline conditionally initialized vars (#6751)
- Loading branch information
Showing
10 changed files
with
124 additions
and
18 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
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
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
23 changes: 23 additions & 0 deletions
23
crates/swc_ecma_minifier/tests/fixture/issues/6751/1/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,23 @@ | ||
let current_component; | ||
|
||
function set_current_component(component) { | ||
current_component = component; | ||
} | ||
|
||
function f(component) { | ||
const parent = current_component | ||
set_current_component(component) | ||
parent.m() | ||
} | ||
|
||
const obj = { | ||
m() { | ||
console.log("call m()") | ||
} | ||
} | ||
|
||
try { | ||
f(obj) | ||
} catch (e) { | ||
console.log('PASS') | ||
} |
13 changes: 13 additions & 0 deletions
13
crates/swc_ecma_minifier/tests/fixture/issues/6751/1/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,13 @@ | ||
let current_component; | ||
try { | ||
!function(component) { | ||
const parent = current_component; | ||
current_component = component, parent.m(); | ||
}({ | ||
m () { | ||
console.log("call m()"); | ||
} | ||
}); | ||
} catch (e) { | ||
console.log('PASS'); | ||
} |
2 changes: 1 addition & 1 deletion
2
crates/swc_ecma_minifier/tests/full/feedback-mapbox/785-e1932cc99ac3bb67/output.js
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
crates/swc_ecma_minifier/tests/full/issue-5912-bigdecimal/output.js
Large diffs are not rendered by default.
Oops, something went wrong.