# HG changeset patch # User John W. Eaton # Date 1235411732 18000 # Node ID c84a5b6377c41133a80389a3c7e573dbffd74856 # Parent b9ce57a309a306257c937314d0b3ff88511042ea better handling of end of script/function no-op command diff -r b9ce57a309a3 -r c84a5b6377c4 src/ChangeLog --- a/src/ChangeLog Mon Feb 23 12:44:57 2009 -0500 +++ b/src/ChangeLog Mon Feb 23 12:55:32 2009 -0500 @@ -1,5 +1,12 @@ 2009-02-23 John W. Eaton + * pt-cmd.h (tree_no_op_command::eof): New data member + (tree_no_op_command::tree_no_op_command): Initialize it. + (tree_no_op_command::is_end_of_fcn_or_script): New function. + * pt-stmt.cc (tree_statement::is_end_of_fcn_or_script): + Call is_end_of_fcn_or_script instead of looking at original text + of no-op command. + * pt-select.h, pt-select.cc (tree_if_command::set_breakpoint, tree_if_command::delete_breakpoint): New functions. (tree_switch_command::set_breakpoint, diff -r b9ce57a309a3 -r c84a5b6377c4 src/pt-cmd.h --- a/src/pt-cmd.h Mon Feb 23 12:44:57 2009 -0500 +++ b/src/pt-cmd.h Mon Feb 23 12:55:32 2009 -0500 @@ -65,7 +65,8 @@ public: tree_no_op_command (const std::string& cmd = "no_op", int l = -1, int c = -1) - : tree_command (l, c), orig_cmd (cmd) { } + : tree_command (l, c), eof (cmd == "endfunction" || cmd == "endscript"), + orig_cmd (cmd) { } ~tree_no_op_command (void) { } @@ -74,10 +75,14 @@ void accept (tree_walker& tw); + bool is_end_of_fcn_or_script (void) const { return eof; } + std::string original_command (void) { return orig_cmd; } private: + bool eof; + std::string orig_cmd; // No copying! diff -r b9ce57a309a3 -r c84a5b6377c4 src/pt-stmt.cc --- a/src/pt-stmt.cc Mon Feb 23 12:44:57 2009 -0500 +++ b/src/pt-stmt.cc Mon Feb 23 12:55:32 2009 -0500 @@ -125,11 +125,7 @@ = dynamic_cast (cmd); if (no_op_cmd) - { - std::string type = no_op_cmd->original_command (); - - retval = (type == "endfunction" || type == "endscript"); - } + retval = no_op_cmd->is_end_of_fcn_or_script (); } return retval;