comparison src/pt-eval.cc @ 10210:752f349052a2

ensure correct backtraces after error in unwind_protect
author Jaroslav Hajek <highegg@gmail.com>
date Wed, 27 Jan 2010 18:24:39 +0100
parents d4f813c3f5ed
children 979fb2606c4f
comparison
equal deleted inserted replaced
10209:ea0d83b4470b 10210:752f349052a2
898 // in the first part of the unwind_protect are not completely 898 // in the first part of the unwind_protect are not completely
899 // ignored. 899 // ignored.
900 900
901 frame.protect_var (error_state); 901 frame.protect_var (error_state);
902 error_state = 0; 902 error_state = 0;
903
904 // We want to preserve the last statement indicator for possible
905 // backtracking.
906 frame.add_fcn (octave_call_stack::set_statement,
907 octave_call_stack::current_statement ());
903 908
904 // Similarly, if we have seen a return or break statement, allow all 909 // Similarly, if we have seen a return or break statement, allow all
905 // the cleanup code to run before returning or handling the break. 910 // the cleanup code to run before returning or handling the break.
906 // We don't have to worry about continue statements because they can 911 // We don't have to worry about continue statements because they can
907 // only occur in loops. 912 // only occur in loops.
954 // We don't want to ignore errors that occur in the cleanup code, so 959 // We don't want to ignore errors that occur in the cleanup code, so
955 // if an error is encountered there, leave error_state alone. 960 // if an error is encountered there, leave error_state alone.
956 // Otherwise, set it back to what it was before. 961 // Otherwise, set it back to what it was before.
957 962
958 if (error_state) 963 if (error_state)
959 frame.discard_top (); 964 frame.discard_top (2);
960 else 965 else
961 frame.run_top (); 966 frame.run_top (2);
962 967
963 frame.run (); 968 frame.run ();
964 } 969 }
965 970
966 void 971 void