Mercurial > hg > octave-lyh
comparison 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 |
comparison
equal
deleted
inserted
replaced
15605:80a4ded6b89c | 15606:fb9dffe5fbfb |
---|---|
128 tree_evaluator::reset_debug_state (void) | 128 tree_evaluator::reset_debug_state (void) |
129 { | 129 { |
130 debug_mode = bp_table::have_breakpoints () || Vdebugging; | 130 debug_mode = bp_table::have_breakpoints () || Vdebugging; |
131 | 131 |
132 dbstep_flag = 0; | 132 dbstep_flag = 0; |
133 } | |
134 | |
135 bool | |
136 tree_evaluator::statement_printing_enabled (void) | |
137 { | |
138 return ! (Vsilent_functions && (statement_context == function | |
139 || statement_context == script)); | |
133 } | 140 } |
134 | 141 |
135 static inline void | 142 static inline void |
136 do_global_init (tree_decl_elt& elt) | 143 do_global_init (tree_decl_elt& elt) |
137 { | 144 { |
715 else | 722 else |
716 { | 723 { |
717 if (debug_mode) | 724 if (debug_mode) |
718 do_breakpoint (expr->is_breakpoint ()); | 725 do_breakpoint (expr->is_breakpoint ()); |
719 | 726 |
720 if ((statement_context == function || statement_context == script) | |
721 && Vsilent_functions) | |
722 expr->set_print_flag (false); | |
723 | |
724 // FIXME -- maybe all of this should be packaged in | 727 // FIXME -- maybe all of this should be packaged in |
725 // one virtual function that returns a flag saying whether | 728 // one virtual function that returns a flag saying whether |
726 // or not the expression will take care of binding ans and | 729 // or not the expression will take care of binding ans and |
727 // printing the result. | 730 // printing the result. |
728 | 731 |
742 do_bind_ans = (! expr->is_assignment_expression ()); | 745 do_bind_ans = (! expr->is_assignment_expression ()); |
743 | 746 |
744 octave_value tmp_result = expr->rvalue1 (0); | 747 octave_value tmp_result = expr->rvalue1 (0); |
745 | 748 |
746 if (do_bind_ans && ! (error_state || tmp_result.is_undefined ())) | 749 if (do_bind_ans && ! (error_state || tmp_result.is_undefined ())) |
747 bind_ans (tmp_result, expr->print_result ()); | 750 bind_ans (tmp_result, expr->print_result () |
751 && statement_printing_enabled ()); | |
748 | 752 |
749 // if (tmp_result.is_defined ()) | 753 // if (tmp_result.is_defined ()) |
750 // result_values(0) = tmp_result; | 754 // result_values(0) = tmp_result; |
751 } | 755 } |
752 } | 756 } |