diff libinterp/parse-tree/pt-eval.cc @ 15606:fb9dffe5fbfb

The silent_functions flag no longer modifies the parse tree * pt-assign.cc (tree_simple_assignment::rvalue1, tree_multi_assignment::rvalue): Check tree_evaluator::statement_printing_enabled. * pt-eval.cc (tree_evaluator::statement_printing_enabled): New function. (tree_evaluator::visit_statement): Do not modify parse tree and check tree_evaluator::statement_printing_enabled. * pt-eval.h (tree_evaluator::statement_printing_enabled): New declaration. * pt-exp.h (tree_expression::print_result): Added comment. * pt-id.cc (tree_identifier::rvalue): Check tree_evaluator::statement_printing_enabled.
author Max Brister <max@2bass.com>
date Fri, 09 Nov 2012 20:29:21 -0700
parents 52df2e7baabe
children 009984ecf419 fb27f1e08297
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-eval.cc	Mon Nov 05 14:50:54 2012 -0800
+++ b/libinterp/parse-tree/pt-eval.cc	Fri Nov 09 20:29:21 2012 -0700
@@ -132,6 +132,13 @@
   dbstep_flag = 0;
 }
 
+bool
+tree_evaluator::statement_printing_enabled (void)
+{
+  return ! (Vsilent_functions && (statement_context == function
+                                  || statement_context == script));
+}
+
 static inline void
 do_global_init (tree_decl_elt& elt)
 {
@@ -717,10 +724,6 @@
               if (debug_mode)
                 do_breakpoint (expr->is_breakpoint ());
 
-              if ((statement_context == function || statement_context == script)
-                  && Vsilent_functions)
-                expr->set_print_flag (false);
-
               // FIXME -- maybe all of this should be packaged in
               // one virtual function that returns a flag saying whether
               // or not the expression will take care of binding ans and
@@ -744,7 +747,8 @@
               octave_value tmp_result = expr->rvalue1 (0);
 
               if (do_bind_ans && ! (error_state || tmp_result.is_undefined ()))
-                bind_ans (tmp_result, expr->print_result ());
+                bind_ans (tmp_result, expr->print_result ()
+                          && statement_printing_enabled ());
 
               //              if (tmp_result.is_defined ())
               //                result_values(0) = tmp_result;