diff libinterp/parse-tree/pt-bp.h @ 23469:2699c5974844

handle global and persistent in tree_decl_command, not as separate classes * pt-decl.h, pt-decl.cc (tree_decl_command::mark_as_global, tree_decl_command::mark_as_persistent, tree_decl_command::dup): New functions. (tree_global_command, tree_persistent_command): Delete classes. (tree_decl_elt::decl_type): New enum. Store command type in each initializer list element. (tree_decl_elt::mark_as_global, tree_decl_elt::is_global, tree_decl_elt::mark_as_persistent, tree_decl_elt::is_persistent): New functions. (tree_decl_init_list::mark_as_global, tree_decl_init_list::is_global, tree_decl_init_list::mark_as_persistent, tree_decl_init_list::is_persistent): New functions. * pt-walk.h (tree_walker::visit_decl_command): New function. (tree_walker::visit_global_command, tree_walker::visit_persistent_command): Delete. Update all derived classes. * oct-parse.in.yy (base_parser::make_decl_command): Tag initialization lists as global or persistent here. * pt-eval.cc (tree_evaluator::visit_decl_command): New function. Visit initialization list instead of looping here. (tree_evaluator::visit_decl_init_list): Loop and visit elements here. (tree_evaluator::visit_decl_elt): Handle evaluation of elements here.
author John W. Eaton <jwe@octave.org>
date Thu, 04 May 2017 15:02:46 -0400
parents 092078913d54
children be7b884ac589
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-bp.h	Thu May 04 10:29:51 2017 -0400
+++ b/libinterp/parse-tree/pt-bp.h	Thu May 04 15:02:46 2017 -0400
@@ -65,14 +65,12 @@
 
     void visit_continue_command (tree_continue_command&);
 
-    void visit_global_command (tree_global_command&);
+    void visit_decl_command (tree_decl_command&);
 
-    void visit_persistent_command (tree_persistent_command&);
+    void visit_decl_init_list (tree_decl_init_list&);
 
     void visit_decl_elt (tree_decl_elt&);
 
-    void visit_decl_init_list (tree_decl_init_list&);
-
     void visit_while_command (tree_while_command&);
 
     void visit_do_until_command (tree_do_until_command&);
@@ -150,8 +148,6 @@
 
   private:
 
-    void do_decl_command (tree_decl_command&);
-
     void take_action (tree& tr);
 
     void take_action (tree_statement& stmt);