@@ -733,8 +733,8 @@ mod test {
733
733
use crate :: {
734
734
CompressOptions , TreeShakeOptions ,
735
735
tester:: {
736
- default_options, test, test_options, test_same , test_same_options ,
737
- test_same_options_source_type,
736
+ default_options, test, test_options, test_options_source_type , test_same ,
737
+ test_same_options , test_same_options_source_type,
738
738
} ,
739
739
} ;
740
740
@@ -1040,13 +1040,16 @@ mod test {
1040
1040
fn remove_unused_assignment_expression ( ) {
1041
1041
use oxc_span:: SourceType ;
1042
1042
let options = CompressOptions :: smallest ( ) ;
1043
- // Vars are not handled yet due to TDZ.
1044
- test_same_options ( "var x = 1; x = 2;" , & options) ;
1045
- test_same_options ( "var x = 1; x = foo();" , & options) ;
1043
+ test_options ( "var x = 1; x = 2;" , "" , & options) ;
1044
+ test_options ( "var x = 1; x = foo();" , "foo()" , & options) ;
1046
1045
test_same_options ( "export var foo; foo = 0;" , & options) ;
1047
1046
test_same_options ( "var x = 1; x = 2, foo(x)" , & options) ;
1048
1047
test_same_options ( "function foo() { return t = x(); } foo();" , & options) ;
1049
- test_same_options ( "function foo() { var t; return t = x(); } foo();" , & options) ;
1048
+ test_options (
1049
+ "function foo() { var t; return t = x(); } foo();" ,
1050
+ "function foo() { return x(); } foo();" ,
1051
+ & options,
1052
+ ) ;
1050
1053
test_same_options ( "function foo(t) { return t = x(); } foo();" , & options) ;
1051
1054
1052
1055
test_options ( "let x = 1; x = 2;" , "" , & options) ;
@@ -1081,8 +1084,9 @@ mod test {
1081
1084
let source_type = SourceType :: cjs ( ) ;
1082
1085
test_same_options_source_type ( "var x = 1; x = 2;" , source_type, & options) ;
1083
1086
test_same_options_source_type ( "var x = 1; x = 2, foo(x)" , source_type, & options) ;
1084
- test_same_options_source_type (
1087
+ test_options_source_type (
1085
1088
"function foo() { var x = 1; x = 2, bar() } foo()" ,
1089
+ "function foo() { bar() } foo()" ,
1086
1090
source_type,
1087
1091
& options,
1088
1092
) ;
0 commit comments