Mercurial > hg > octave-lyh
annotate libinterp/parse-tree/pt-except.cc @ 17520:cdeadf62663f
doc: Fix recommendation on where to put spaces around parens
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Thu, 26 Sep 2013 10:05:22 -0400 |
parents | 923ce8b42db2 |
children |
rev | line source |
---|---|
2982 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
3 Copyright (C) 1996-2012 John W. Eaton |
2982 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
2982 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
2982 | 20 |
21 */ | |
22 | |
23 #ifdef HAVE_CONFIG_H | |
24 #include <config.h> | |
25 #endif | |
26 | |
4429 | 27 #include "quit.h" |
28 | |
2982 | 29 #include "error.h" |
30 #include "oct-lvalue.h" | |
31 #include "ov.h" | |
3770 | 32 #include "pt-bp.h" |
2982 | 33 #include "pt-cmd.h" |
34 #include "pt-except.h" | |
35 #include "pt-exp.h" | |
17257
923ce8b42db2
improve try-catch-statement to save exception to a variable (bug #33217)
Stefan Mahr <dac922@gmx.de>
parents:
15195
diff
changeset
|
36 #include "pt-id.h" |
2985 | 37 #include "pt-jump.h" |
2982 | 38 #include "pt-stmt.h" |
39 #include "pt-walk.h" | |
40 #include "unwind-prot.h" | |
41 #include "variables.h" | |
42 | |
43 // Simple exception handling. | |
44 | |
45 tree_try_catch_command::~tree_try_catch_command (void) | |
46 { | |
17257
923ce8b42db2
improve try-catch-statement to save exception to a variable (bug #33217)
Stefan Mahr <dac922@gmx.de>
parents:
15195
diff
changeset
|
47 delete expr_id; |
2982 | 48 delete try_code; |
49 delete catch_code; | |
3665 | 50 delete lead_comm; |
51 delete mid_comm; | |
52 delete trail_comm; | |
2982 | 53 } |
54 | |
5861 | 55 tree_command * |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7353
diff
changeset
|
56 tree_try_catch_command::dup (symbol_table::scope_id scope, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
57 symbol_table::context_id context) const |
5861 | 58 { |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7353
diff
changeset
|
59 return new |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7353
diff
changeset
|
60 tree_try_catch_command (try_code ? try_code->dup (scope, context) : 0, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
61 catch_code ? catch_code->dup (scope, context) : 0, |
17257
923ce8b42db2
improve try-catch-statement to save exception to a variable (bug #33217)
Stefan Mahr <dac922@gmx.de>
parents:
15195
diff
changeset
|
62 expr_id ? expr_id->dup (scope, context) : 0, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
63 lead_comm ? lead_comm->dup () : 0, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
64 mid_comm ? mid_comm->dup () : 0, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
65 trail_comm ? trail_comm->dup () : 0, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
66 line (), column ()); |
5861 | 67 } |
68 | |
2982 | 69 void |
70 tree_try_catch_command::accept (tree_walker& tw) | |
71 { | |
72 tw.visit_try_catch_command (*this); | |
73 } | |
74 | |
75 // Simple exception handling. | |
76 | |
77 tree_unwind_protect_command::~tree_unwind_protect_command (void) | |
78 { | |
79 delete unwind_protect_code; | |
80 delete cleanup_code; | |
3665 | 81 delete lead_comm; |
82 delete mid_comm; | |
83 delete trail_comm; | |
2982 | 84 } |
85 | |
5861 | 86 tree_command * |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7353
diff
changeset
|
87 tree_unwind_protect_command::dup (symbol_table::scope_id scope, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
88 symbol_table::context_id context) const |
5861 | 89 { |
90 return new tree_unwind_protect_command | |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7353
diff
changeset
|
91 (unwind_protect_code ? unwind_protect_code->dup (scope, context) : 0, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7353
diff
changeset
|
92 cleanup_code ? cleanup_code->dup (scope, context) : 0, |
5861 | 93 lead_comm ? lead_comm->dup () : 0, |
94 mid_comm ? mid_comm->dup () : 0, | |
95 trail_comm ? trail_comm->dup () : 0, | |
96 line (), column ()); | |
97 } | |
98 | |
2982 | 99 void |
100 tree_unwind_protect_command::accept (tree_walker& tw) | |
101 { | |
102 tw.visit_unwind_protect_command (*this); | |
103 } |