File tree Expand file tree Collapse file tree 2 files changed +59
-4
lines changed Expand file tree Collapse file tree 2 files changed +59
-4
lines changed Original file line number Diff line number Diff line change @@ -1400,22 +1400,23 @@ Compressor.prototype.compress = function(node) {
1400
1400
pop_scope(tw, fn);
1401
1401
return true;
1402
1402
});
1403
- def(AST_Sub, function(tw, descend ) {
1403
+ def(AST_Sub, function(tw) {
1404
1404
var node = this;
1405
1405
var expr = node.expression;
1406
+ var prop = node.property;
1407
+ expr.walk(tw);
1406
1408
if (node.optional) {
1407
- expr.walk(tw);
1408
1409
push(tw, true, true);
1409
- node.property .walk(tw);
1410
+ prop .walk(tw);
1410
1411
pop(tw);
1411
1412
} else {
1412
- descend();
1413
1413
while (expr instanceof AST_Assign && expr.operator == "=") {
1414
1414
var lhs = expr.left;
1415
1415
if (lhs instanceof AST_SymbolRef) access(tw, lhs.definition());
1416
1416
expr = expr.right;
1417
1417
}
1418
1418
if (expr instanceof AST_SymbolRef) access(tw, expr.definition());
1419
+ prop.walk(tw);
1419
1420
}
1420
1421
return true;
1421
1422
});
Original file line number Diff line number Diff line change @@ -1992,3 +1992,57 @@ issue_5927: {
1992
1992
}
1993
1993
expect_stdout: "PASS"
1994
1994
}
1995
+
1996
+ issue_5949_1: {
1997
+ options = {
1998
+ pure_getters : "strict" ,
1999
+ reduce_vars : true ,
2000
+ side_effects : true ,
2001
+ }
2002
+ input: {
2003
+ var a = 42 ;
2004
+ a [ a = null ] ;
2005
+ try {
2006
+ a . p ;
2007
+ console . log ( "FAIL" ) ;
2008
+ } catch ( e ) {
2009
+ console . log ( "PASS" ) ;
2010
+ }
2011
+ }
2012
+ expect: {
2013
+ var a = 42 ;
2014
+ a [ a = null ] ;
2015
+ try {
2016
+ a . p ;
2017
+ console . log ( "FAIL" ) ;
2018
+ } catch ( e ) {
2019
+ console . log ( "PASS" ) ;
2020
+ }
2021
+ }
2022
+ expect_stdout: "PASS"
2023
+ }
2024
+
2025
+ issue_5949_2: {
2026
+ options = {
2027
+ pure_getters : "strict" ,
2028
+ reduce_vars : true ,
2029
+ side_effects : true ,
2030
+ }
2031
+ input: {
2032
+ try {
2033
+ a [ 42 ] ;
2034
+ console . log ( "FAIL" ) ;
2035
+ } catch ( e ) {
2036
+ console . log ( "PASS" ) ;
2037
+ }
2038
+ }
2039
+ expect: {
2040
+ try {
2041
+ a [ 42 ] ;
2042
+ console . log ( "FAIL" ) ;
2043
+ } catch ( e ) {
2044
+ console . log ( "PASS" ) ;
2045
+ }
2046
+ }
2047
+ expect_stdout: "PASS"
2048
+ }
You can’t perform that action at this time.
0 commit comments