Mercurial > octave
annotate libinterp/parse-tree/pt-classdef.cc @ 27919:1891570abac8
update Octave Project Developers copyright for the new year
In files that have the "Octave Project Developers" copyright notice,
update for 2020.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 06 Jan 2020 22:29:51 -0500 |
parents | b442ec6dda5c |
children | bd51beb6205e |
rev | line source |
---|---|
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1 /* |
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
2 |
27919
1891570abac8
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27918
diff
changeset
|
3 Copyright (C) 2012-2020 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27505
diff
changeset
|
4 |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27505
diff
changeset
|
5 See the file COPYRIGHT.md in the top-level directory of this distribution |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27505
diff
changeset
|
6 or <https://octave.org/COPYRIGHT.html/>. |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27505
diff
changeset
|
7 |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
8 |
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
9 This file is part of Octave. |
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
10 |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
11 Octave is free software: you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
12 under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
13 the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
14 (at your option) any later version. |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
15 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
16 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
17 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
19 GNU General Public License for more details. |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
20 |
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
21 You should have received a copy of the GNU General Public License |
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
22 along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
23 <https://www.gnu.org/licenses/>. |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
24 |
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 */ |
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
26 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
27 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21200
diff
changeset
|
28 # include "config.h" |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 #endif |
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 |
27371
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
31 #include "ov.h" |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 #include "ov-classdef.h" |
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 #include "pt-classdef.h" |
27371
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
34 #include "pt-eval.h" |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
36 namespace octave |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
37 { |
26686
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
38 tree_superclass_ref * |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
39 tree_superclass_ref::dup (symbol_scope&) const |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
40 { |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
41 tree_superclass_ref *new_scr |
26718
9b0335f4bc74
revise naming of the parts of a superclass reference
John W. Eaton <jwe@octave.org>
parents:
26686
diff
changeset
|
42 = new tree_superclass_ref (m_method_name, m_class_name, |
26686
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
43 line (), column ()); |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
44 |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
45 new_scr->copy_base (*this); |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
46 |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
47 return new_scr; |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
48 } |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
49 |
27371
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
50 octave_value_list |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
51 tree_superclass_ref::evaluate_n (tree_evaluator& tw, int nargout) |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
52 { |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
53 octave_value tmp |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
54 = octave_classdef::superclass_ref (m_method_name, m_class_name); |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
55 |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
56 if (! is_postfix_indexed ()) |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
57 { |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
58 // There was no index, so this superclass_ref object is not |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
59 // part of an index expression. It is also not an identifier in |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
60 // the syntax tree but we need to handle it as if it were. So |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
61 // call the function here. |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
62 |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
63 octave_function *f = tmp.function_value (true); |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
64 |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
65 assert (f); |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
66 |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
67 return f->call (tw, nargout); |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
68 } |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
69 |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
70 // The superclass_ref function object will be indexed as part of the |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
71 // enclosing index expression. |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
72 |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
73 return ovl (tmp); |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
74 } |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
75 |
26686
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
76 tree_metaclass_query * |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
77 tree_metaclass_query::dup (symbol_scope&) const |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
78 { |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
79 tree_metaclass_query *new_mcq |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
80 = new tree_metaclass_query (m_class_name, line (), column ()); |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
81 |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
82 new_mcq->copy_base (*this); |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
83 |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
84 return new_mcq; |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
85 } |
581d01526b34
eliminate unnecessary tree_funcall class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
86 |
27371
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
87 octave_value |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
88 tree_metaclass_query::evaluate (tree_evaluator&, int) |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
89 { |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
90 return octave_classdef::metaclass_query (m_class_name); |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
91 } |
fcaecdbc8d8a
don't use visitor pattern for expression evaluation (bug #56752)
John W. Eaton <jwe@octave.org>
parents:
26718
diff
changeset
|
92 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
93 // Classdef attribute |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
94 |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
95 // Classdef attribute_list |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
96 |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
97 tree_classdef_attribute_list::~tree_classdef_attribute_list (void) |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
98 { |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
99 while (! empty ()) |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
100 { |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
101 auto p = begin (); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
102 delete *p; |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
103 erase (p); |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
104 } |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
105 } |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
106 |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
107 // Classdef superclass |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
108 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
109 // Classdef superclass_list |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
110 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
111 tree_classdef_superclass_list::~tree_classdef_superclass_list (void) |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
112 { |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
113 while (! empty ()) |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
114 { |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
115 auto p = begin (); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
116 delete *p; |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
117 erase (p); |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
118 } |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
119 } |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
120 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
121 // Classdef property |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
122 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
123 // Classdef property_list |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
124 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
125 tree_classdef_property_list::~tree_classdef_property_list (void) |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
126 { |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
127 while (! empty ()) |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
128 { |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
129 auto p = begin (); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
130 delete *p; |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
131 erase (p); |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
132 } |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
133 } |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
134 |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
135 // Classdef properties_block |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
136 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
137 // Classdef methods_list |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
138 |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
139 // Classdef methods_block |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
140 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
141 // Classdef event |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
142 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
143 // Classdef events_list |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
144 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
145 tree_classdef_events_list::~tree_classdef_events_list (void) |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
146 { |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
147 while (! empty ()) |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
148 { |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
149 auto p = begin (); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
150 delete *p; |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
151 erase (p); |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
152 } |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
153 } |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
154 |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
155 // Classdef events_block |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
156 |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
157 // Classdef enum |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
158 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
159 // Classdef enum_list |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
160 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
161 tree_classdef_enum_list::~tree_classdef_enum_list (void) |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
162 { |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
163 while (! empty ()) |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
164 { |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
165 auto p = begin (); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
166 delete *p; |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
167 erase (p); |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
168 } |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
169 } |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
170 |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
171 // Classdef enum_block |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
172 |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
173 // Classdef body |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
174 |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
175 tree_classdef_body::~tree_classdef_body (void) |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
176 { |
24846
7620f1f5290d
use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
177 while (! m_properties_lst.empty ()) |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
178 { |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
179 auto p = m_properties_lst.begin (); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
180 delete *p; |
24846
7620f1f5290d
use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
181 m_properties_lst.erase (p); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
182 } |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
183 |
24846
7620f1f5290d
use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
184 while (! m_methods_lst.empty ()) |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
185 { |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
186 auto p = m_methods_lst.begin (); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
187 delete *p; |
24846
7620f1f5290d
use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
188 m_methods_lst.erase (p); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
189 } |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
190 |
24846
7620f1f5290d
use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
191 while (! m_events_lst.empty ()) |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
192 { |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
193 auto p = m_events_lst.begin (); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
194 delete *p; |
24846
7620f1f5290d
use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
195 m_events_lst.erase (p); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
196 } |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
197 |
24846
7620f1f5290d
use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
198 while (! m_enum_lst.empty ()) |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
199 { |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
200 auto p = m_enum_lst.begin (); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
201 delete *p; |
24846
7620f1f5290d
use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
202 m_enum_lst.erase (p); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
203 } |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
204 } |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
205 |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
206 // Classdef |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
207 |
27505
c409d16b7190
eliminate some uses of bare pointers to octave_function objects
John W. Eaton <jwe@octave.org>
parents:
27371
diff
changeset
|
208 octave_value |
23533
8edbc923a7dc
begin refactoring use of interpreter/evaluator in classdef objects
John W. Eaton <jwe@octave.org>
parents:
23435
diff
changeset
|
209 tree_classdef::make_meta_class (interpreter& interp, bool is_at_folder) |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
210 { |
23533
8edbc923a7dc
begin refactoring use of interpreter/evaluator in classdef objects
John W. Eaton <jwe@octave.org>
parents:
23435
diff
changeset
|
211 cdef_class cls = cdef_class::make_meta_class (interp, this, is_at_folder); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
212 |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
213 if (cls.ok ()) |
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
214 return cls.get_constructor_function (); |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
215 |
27505
c409d16b7190
eliminate some uses of bare pointers to octave_function objects
John W. Eaton <jwe@octave.org>
parents:
27371
diff
changeset
|
216 return octave_value (); |
23075
4e3d47dc7e25
move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
217 } |
15037
56b8eb7c9c04
improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
218 } |