pt-except.cc

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 1996-2012 John W. Eaton
00004 
00005 This file is part of Octave.
00006 
00007 Octave is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 3 of the License, or (at your
00010 option) any later version.
00011 
00012 Octave is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Octave; see the file COPYING.  If not, see
00019 <http://www.gnu.org/licenses/>.
00020 
00021 */
00022 
00023 #ifdef HAVE_CONFIG_H
00024 #include <config.h>
00025 #endif
00026 
00027 #include "quit.h"
00028 
00029 #include "error.h"
00030 #include "oct-lvalue.h"
00031 #include "ov.h"
00032 #include "pt-bp.h"
00033 #include "pt-cmd.h"
00034 #include "pt-except.h"
00035 #include "pt-exp.h"
00036 #include "pt-jump.h"
00037 #include "pt-stmt.h"
00038 #include "pt-walk.h"
00039 #include "unwind-prot.h"
00040 #include "variables.h"
00041 
00042 // Simple exception handling.
00043 
00044 tree_try_catch_command::~tree_try_catch_command (void)
00045 {
00046   delete try_code;
00047   delete catch_code;
00048   delete lead_comm;
00049   delete mid_comm;
00050   delete trail_comm;
00051 }
00052 
00053 tree_command *
00054 tree_try_catch_command::dup (symbol_table::scope_id scope,
00055                              symbol_table::context_id context) const
00056 {
00057   return new
00058     tree_try_catch_command (try_code ? try_code->dup (scope, context) : 0,
00059                             catch_code ? catch_code->dup (scope, context) : 0,
00060                             lead_comm ? lead_comm->dup () : 0,
00061                             mid_comm ? mid_comm->dup () : 0,
00062                             trail_comm ? trail_comm->dup () : 0,
00063                             line (), column ());
00064 }
00065 
00066 void
00067 tree_try_catch_command::accept (tree_walker& tw)
00068 {
00069   tw.visit_try_catch_command (*this);
00070 }
00071 
00072 // Simple exception handling.
00073 
00074 tree_unwind_protect_command::~tree_unwind_protect_command (void)
00075 {
00076   delete unwind_protect_code;
00077   delete cleanup_code;
00078   delete lead_comm;
00079   delete mid_comm;
00080   delete trail_comm;
00081 }
00082 
00083 tree_command *
00084 tree_unwind_protect_command::dup (symbol_table::scope_id scope,
00085                                   symbol_table::context_id context) const
00086 {
00087   return new tree_unwind_protect_command
00088     (unwind_protect_code ? unwind_protect_code->dup (scope, context) : 0,
00089      cleanup_code ? cleanup_code->dup (scope, context) : 0,
00090      lead_comm ? lead_comm->dup () : 0,
00091      mid_comm ? mid_comm->dup () : 0,
00092      trail_comm ? trail_comm->dup () : 0,
00093      line (), column ());
00094 }
00095 
00096 void
00097 tree_unwind_protect_command::accept (tree_walker& tw)
00098 {
00099   tw.visit_unwind_protect_command (*this);
00100 }
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines