File tree Expand file tree Collapse file tree 2 files changed +52
-2
lines changed Expand file tree Collapse file tree 2 files changed +52
-2
lines changed Original file line number Diff line number Diff line change @@ -2722,8 +2722,10 @@ Compressor.prototype.compress = function(node) {
2722
2722
if (sym instanceof AST_PropAccess) return true;
2723
2723
if (check_destructured(sym)) return true;
2724
2724
return sym.match_symbol(function(node) {
2725
- return node instanceof AST_SymbolRef
2726
- && (lvalues.has(node.name) || read_toplevel && compressor.exposed(node.definition()));
2725
+ if (node instanceof AST_PropAccess) return true;
2726
+ if (node instanceof AST_SymbolRef) {
2727
+ return lvalues.has(node.name) || read_toplevel && compressor.exposed(node.definition());
2728
+ }
2727
2729
}, true);
2728
2730
2729
2731
function reject(node) {
Original file line number Diff line number Diff line change @@ -3959,3 +3959,51 @@ issue_5844: {
3959
3959
expect_stdout: "PASS"
3960
3960
node_version: ">=6"
3961
3961
}
3962
+
3963
+ issue_5854_1: {
3964
+ options = {
3965
+ collapse_vars : true ,
3966
+ }
3967
+ input: {
3968
+ console . log ( function ( a ) {
3969
+ var b = a ;
3970
+ a ++ ;
3971
+ [ b [ 0 ] ] = [ "foo" ] ;
3972
+ return a ;
3973
+ } ( [ ] ) ? "PASS" : "FAIL" ) ;
3974
+ }
3975
+ expect: {
3976
+ console . log ( function ( a ) {
3977
+ var b = a ;
3978
+ a ++ ;
3979
+ [ b [ 0 ] ] = [ "foo" ] ;
3980
+ return a ;
3981
+ } ( [ ] ) ? "PASS" : "FAIL" ) ;
3982
+ }
3983
+ expect_stdout: "PASS"
3984
+ node_version: ">=6"
3985
+ }
3986
+
3987
+ issue_5854_2: {
3988
+ options = {
3989
+ collapse_vars : true ,
3990
+ }
3991
+ input: {
3992
+ console . log ( function ( a ) {
3993
+ var b = a ;
3994
+ a ++ ;
3995
+ ( { p : b [ 0 ] } = { p : "foo" } ) ;
3996
+ return a ;
3997
+ } ( [ ] ) ? "PASS" : "FAIL" ) ;
3998
+ }
3999
+ expect: {
4000
+ console . log ( function ( a ) {
4001
+ var b = a ;
4002
+ a ++ ;
4003
+ ( { p : b [ 0 ] } = { p : "foo" } ) ;
4004
+ return a ;
4005
+ } ( [ ] ) ? "PASS" : "FAIL" ) ;
4006
+ }
4007
+ expect_stdout: "PASS"
4008
+ node_version: ">=6"
4009
+ }
You can’t perform that action at this time.
0 commit comments