Mercurial > hg > octave-lojdl
comparison src/pt-fcn-handle.cc @ 10315:57a59eae83cc
untabify src C++ source files
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 11 Feb 2010 12:41:46 -0500 |
parents | a4fb4675accb |
children | 409ceee18acc |
comparison
equal
deleted
inserted
replaced
10314:07ebe522dac2 | 10315:57a59eae83cc |
---|---|
35 #include "pt-walk.h" | 35 #include "pt-walk.h" |
36 #include "variables.h" | 36 #include "variables.h" |
37 | 37 |
38 void | 38 void |
39 tree_fcn_handle::print (std::ostream& os, bool pr_as_read_syntax, | 39 tree_fcn_handle::print (std::ostream& os, bool pr_as_read_syntax, |
40 bool pr_orig_text) | 40 bool pr_orig_text) |
41 { | 41 { |
42 print_raw (os, pr_as_read_syntax, pr_orig_text); | 42 print_raw (os, pr_as_read_syntax, pr_orig_text); |
43 } | 43 } |
44 | 44 |
45 void | 45 void |
46 tree_fcn_handle::print_raw (std::ostream& os, bool pr_as_read_syntax, | 46 tree_fcn_handle::print_raw (std::ostream& os, bool pr_as_read_syntax, |
47 bool pr_orig_text) | 47 bool pr_orig_text) |
48 { | 48 { |
49 os << ((pr_as_read_syntax || pr_orig_text) ? "@" : "") << nm; | 49 os << ((pr_as_read_syntax || pr_orig_text) ? "@" : "") << nm; |
50 } | 50 } |
51 | 51 |
52 octave_value | 52 octave_value |
68 return retval; | 68 return retval; |
69 } | 69 } |
70 | 70 |
71 tree_expression * | 71 tree_expression * |
72 tree_fcn_handle::dup (symbol_table::scope_id, | 72 tree_fcn_handle::dup (symbol_table::scope_id, |
73 symbol_table::context_id) const | 73 symbol_table::context_id) const |
74 { | 74 { |
75 tree_fcn_handle *new_fh = new tree_fcn_handle (nm, line (), column ()); | 75 tree_fcn_handle *new_fh = new tree_fcn_handle (nm, line (), column ()); |
76 | 76 |
77 new_fh->copy_base (*this); | 77 new_fh->copy_base (*this); |
78 | 78 |
98 | 98 |
99 symbol_table::scope_id new_scope = symbol_table::dup_scope (this_scope); | 99 symbol_table::scope_id new_scope = symbol_table::dup_scope (this_scope); |
100 | 100 |
101 if (new_scope > 0) | 101 if (new_scope > 0) |
102 symbol_table::inherit (new_scope, symbol_table::current_scope (), | 102 symbol_table::inherit (new_scope, symbol_table::current_scope (), |
103 symbol_table::current_context ()); | 103 symbol_table::current_context ()); |
104 | 104 |
105 octave_user_function *uf | 105 octave_user_function *uf |
106 = new octave_user_function (new_scope, | 106 = new octave_user_function (new_scope, |
107 param_list ? param_list->dup (new_scope, 0) : 0, | 107 param_list ? param_list->dup (new_scope, 0) : 0, |
108 ret_list ? ret_list->dup (new_scope, 0) : 0, | 108 ret_list ? ret_list->dup (new_scope, 0) : 0, |
109 cmd_list ? cmd_list->dup (new_scope, 0) : 0); | 109 cmd_list ? cmd_list->dup (new_scope, 0) : 0); |
110 | 110 |
111 octave_function *curr_fcn = octave_call_stack::current (); | 111 octave_function *curr_fcn = octave_call_stack::current (); |
112 | 112 |
113 if (curr_fcn) | 113 if (curr_fcn) |
114 { | 114 { |
115 uf->stash_parent_fcn_name (curr_fcn->name ()); | 115 uf->stash_parent_fcn_name (curr_fcn->name ()); |
116 | 116 |
117 symbol_table::scope_id parent_scope = curr_fcn->parent_fcn_scope (); | 117 symbol_table::scope_id parent_scope = curr_fcn->parent_fcn_scope (); |
118 | 118 |
119 if (parent_scope < 0) | 119 if (parent_scope < 0) |
120 parent_scope = curr_fcn->scope (); | 120 parent_scope = curr_fcn->scope (); |
121 | 121 |
122 uf->stash_parent_fcn_scope (parent_scope); | 122 uf->stash_parent_fcn_scope (parent_scope); |
123 } | 123 } |
124 | 124 |
125 uf->mark_as_inline_function (); | 125 uf->mark_as_inline_function (); |
126 | 126 |
163 return retval; | 163 return retval; |
164 } | 164 } |
165 | 165 |
166 tree_expression * | 166 tree_expression * |
167 tree_anon_fcn_handle::dup (symbol_table::scope_id, | 167 tree_anon_fcn_handle::dup (symbol_table::scope_id, |
168 symbol_table::context_id) const | 168 symbol_table::context_id) const |
169 { | 169 { |
170 tree_parameter_list *param_list = parameter_list (); | 170 tree_parameter_list *param_list = parameter_list (); |
171 tree_parameter_list *ret_list = return_list (); | 171 tree_parameter_list *ret_list = return_list (); |
172 tree_statement_list *cmd_list = body (); | 172 tree_statement_list *cmd_list = body (); |
173 symbol_table::scope_id this_scope = scope (); | 173 symbol_table::scope_id this_scope = scope (); |
174 | 174 |
175 symbol_table::scope_id new_scope = symbol_table::dup_scope (this_scope); | 175 symbol_table::scope_id new_scope = symbol_table::dup_scope (this_scope); |
176 | 176 |
177 if (new_scope > 0) | 177 if (new_scope > 0) |
178 symbol_table::inherit (new_scope, symbol_table::current_scope (), | 178 symbol_table::inherit (new_scope, symbol_table::current_scope (), |
179 symbol_table::current_context ()); | 179 symbol_table::current_context ()); |
180 | 180 |
181 tree_anon_fcn_handle *new_afh = new | 181 tree_anon_fcn_handle *new_afh = new |
182 tree_anon_fcn_handle (param_list ? param_list->dup (new_scope, 0) : 0, | 182 tree_anon_fcn_handle (param_list ? param_list->dup (new_scope, 0) : 0, |
183 ret_list ? ret_list->dup (new_scope, 0) : 0, | 183 ret_list ? ret_list->dup (new_scope, 0) : 0, |
184 cmd_list ? cmd_list->dup (new_scope, 0) : 0, | 184 cmd_list ? cmd_list->dup (new_scope, 0) : 0, |
185 new_scope, line (), column ()); | 185 new_scope, line (), column ()); |
186 | 186 |
187 new_afh->copy_base (*this); | 187 new_afh->copy_base (*this); |
188 | 188 |
189 return new_afh; | 189 return new_afh; |
190 } | 190 } |