File tree Expand file tree Collapse file tree
tests/fixture/issues/10918 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ swc_ecma_minifier : patch
3+ swc_core : patch
4+ ---
5+
6+ Draft: fix: remove last break in the 2nd case when turning 2 cases switch in…
Original file line number Diff line number Diff line change @@ -524,6 +524,7 @@ impl Pure<'_> {
524524
525525 if terminate {
526526 remove_last_break ( & mut first. cons ) ;
527+ remove_last_break ( & mut second. cons ) ;
527528 // they cannot both be default as that's syntax error
528529 let ( def, case) = if first. test . is_none ( ) {
529530 ( first, second)
Original file line number Diff line number Diff line change 1+ import { useState } from "react" ;
2+ import { getCondition , doSomething } from "./utils" ;
3+
4+ export default function useMeow ( ) {
5+ const [ state , setState ] = useState ( "init" ) ;
6+ const onMeow = async ( ) => {
7+ switch ( state ) {
8+ case "init" : {
9+ const innerCondition = getCondition ( ) ;
10+ switch ( innerCondition ) {
11+ case "a" :
12+ break ;
13+ case "b" :
14+ break ;
15+ default :
16+ await doSomething ( ) ;
17+ }
18+ break ;
19+ }
20+ default : {
21+ await doSomething ( ) ;
22+ break ;
23+ }
24+ }
25+ } ;
26+ return {
27+ onMeow,
28+ } ;
29+ }
Original file line number Diff line number Diff line change 1+ import { useState } from "react" ;
2+ import { getCondition , doSomething } from "./utils" ;
3+ export default function useMeow ( ) {
4+ const [ state , setState ] = useState ( "init" ) ;
5+ return {
6+ onMeow : async ( ) => {
7+ if ( "init" === state ) switch ( getCondition ( ) ) {
8+ case "a" :
9+ case "b" :
10+ break ;
11+ default :
12+ await doSomething ( ) ;
13+ }
14+ else await doSomething ( ) ;
15+ }
16+ } ;
17+ }
You can’t perform that action at this time.
0 commit comments