@@ -219,7 +219,7 @@ class CompoundExpression(InfixOperator):
219219 """
220220
221221 attributes = A_HOLD_ALL | A_PROTECTED | A_READ_PROTECTED
222-
222+ has_side_effects = True
223223 summary_text = "execute expressions in sequence"
224224
225225 def eval (self , expr , evaluation ):
@@ -346,6 +346,7 @@ class For(Builtin):
346346 """
347347
348348 attributes = A_HOLD_REST | A_PROTECTED
349+ has_side_effects = True
349350 rules = {
350351 "For[start_, test_, incr_]" : "For[start, test, incr, Null]" ,
351352 }
@@ -486,6 +487,7 @@ class Interrupt(Builtin):
486487 | a
487488 = $Aborted
488489 """
490+ has_side_effects = True
489491
490492 # Set checking that the no arguments are allowed.
491493 # eval_error = Builtin.generic_argument_error
@@ -511,6 +513,7 @@ class Pause(Builtin):
511513 >> Pause[0.5]
512514 """
513515
516+ has_side_effects = True
514517 messages = {
515518 "numnm" : (
516519 "Non-negative machine-sized number expected at " "position 1 in `1`."
@@ -563,7 +566,7 @@ class Return(Builtin):
563566 rules = {
564567 "Return[]" : "Return[Null]" ,
565568 }
566-
569+ has_side_effects = True
567570 summary_text = "return from a function"
568571
569572 def eval (self , expr , evaluation : Evaluation ): # pylint: disable=unused-argument
@@ -604,7 +607,7 @@ class Switch(Builtin):
604607
605608 summary_text = "switch based on a value, with patterns allowed"
606609 attributes = A_HOLD_REST | A_PROTECTED
607-
610+ has_side_effects = True
608611 messages = {
609612 "argct" : (
610613 "Switch called with `2` arguments. "
@@ -659,7 +662,7 @@ class Throw(Builtin):
659662 # Set checking that the number of arguments required is one or two. WMA uses 1..3.
660663 eval_error = Builtin .generic_argument_error
661664 expected_args = (1 , 2 )
662-
665+ has_side_effects = True
663666 messages = {
664667 "nocatch" : "Uncaught `1` returned to top level." ,
665668 }
@@ -714,6 +717,7 @@ class Which(SympyFunction):
714717 """
715718
716719 attributes = A_HOLD_ALL | A_PROTECTED
720+ has_side_effects = True
717721 summary_text = "test which of a sequence of conditions are true"
718722
719723 def eval (self , items , evaluation ):
@@ -773,7 +777,7 @@ class While(Builtin):
773777 # Set checking that the number of arguments required is one.
774778 eval_error = Builtin .generic_argument_error
775779 expected_args = (1 , 2 )
776-
780+ has_side_effects = True
777781 rules = {
778782 "While[test_]" : "While[test, Null]" ,
779783 }
0 commit comments