Mercurial > hg > octave-lyh
annotate src/pt-jump.cc @ 7767:71f068b22fcc
scope and context fixes for function handles
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 07 May 2008 13:45:30 -0400 |
parents | 745a8299c2b5 |
children | 4976f66d469b |
rev | line source |
---|---|
2982 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1996, 1997, 2001, 2002, 2004, 2005, 2006, 2007 |
4 John W. Eaton | |
2982 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
2982 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
2982 | 21 |
22 */ | |
23 | |
24 #ifdef HAVE_CONFIG_H | |
25 #include <config.h> | |
26 #endif | |
27 | |
28 #include "error.h" | |
3770 | 29 #include "oct-obj.h" |
30 #include "pt-bp.h" | |
2982 | 31 #include "pt-jump.h" |
32 #include "pt-walk.h" | |
33 | |
3770 | 34 class octave_value_list; |
35 | |
2982 | 36 // Break. |
37 | |
2985 | 38 // Nonzero means we're breaking out of a loop or function body. |
4207 | 39 int tree_break_command::breaking = 0; |
2985 | 40 |
4207 | 41 void |
42 tree_break_command::eval (void) | |
2982 | 43 { |
3770 | 44 // Even if we have an error we should still enter debug mode. |
45 MAYBE_DO_BREAKPOINT; | |
46 | |
2982 | 47 if (! error_state) |
48 breaking = 1; | |
49 } | |
50 | |
5861 | 51 tree_command * |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
52 tree_break_command::dup (symbol_table::scope_id, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
53 symbol_table::context_id context) |
5861 | 54 { |
55 return new tree_break_command (line (), column ()); | |
56 } | |
57 | |
2982 | 58 void |
4207 | 59 tree_break_command::accept (tree_walker& tw) |
2982 | 60 { |
4207 | 61 tw.visit_break_command (*this); |
2982 | 62 } |
63 | |
64 // Continue. | |
65 | |
2985 | 66 // Nonzero means we're jumping to the end of a loop. |
4207 | 67 int tree_continue_command::continuing = 0; |
2985 | 68 |
4207 | 69 void |
70 tree_continue_command::eval (void) | |
2982 | 71 { |
3770 | 72 MAYBE_DO_BREAKPOINT; |
73 | |
2982 | 74 if (! error_state) |
75 continuing = 1; | |
76 } | |
77 | |
5861 | 78 tree_command * |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
79 tree_continue_command::dup (symbol_table::scope_id, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
80 symbol_table::context_id context) |
5861 | 81 { |
82 return new tree_continue_command (line (), column ()); | |
83 } | |
84 | |
2982 | 85 void |
4207 | 86 tree_continue_command::accept (tree_walker& tw) |
2982 | 87 { |
4207 | 88 tw.visit_continue_command (*this); |
2982 | 89 } |
90 | |
91 // Return. | |
92 | |
5501 | 93 // Nonzero means we're returning from a function. |
4207 | 94 int tree_return_command::returning = 0; |
2985 | 95 |
4207 | 96 void |
97 tree_return_command::eval (void) | |
2982 | 98 { |
3770 | 99 MAYBE_DO_BREAKPOINT; |
100 | |
2982 | 101 if (! error_state) |
102 returning = 1; | |
103 } | |
104 | |
5861 | 105 tree_command * |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
106 tree_return_command::dup (symbol_table::scope_id, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
107 symbol_table::context_id context) |
5861 | 108 { |
109 return new tree_return_command (line (), column ()); | |
110 } | |
111 | |
2982 | 112 void |
4207 | 113 tree_return_command::accept (tree_walker& tw) |
2982 | 114 { |
4207 | 115 tw.visit_return_command (*this); |
2982 | 116 } |
117 | |
118 /* | |
119 ;;; Local Variables: *** | |
120 ;;; mode: C++ *** | |
121 ;;; End: *** | |
122 */ |