diff libinterp/parse-tree/pt-decl.h @ 24216:81d723f0cdfe

clean up change merged from stable * pt-decl.h (tree_decl_elt::name): Now const. (tree_decl_init_list::variable_names): New function. * oct-parse.in.yy (base_parser::make_decl_command): Call tree_decl_init_list::variable_names instead of looping here.
author John W. Eaton <jwe@octave.org>
date Wed, 08 Nov 2017 16:30:07 -0500
parents 980f39c3ab90
children bc3819b7cca1
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-decl.h	Wed Nov 08 16:32:48 2017 -0500
+++ b/libinterp/parse-tree/pt-decl.h	Wed Nov 08 16:30:07 2017 -0500
@@ -25,6 +25,7 @@
 
 #include "octave-config.h"
 
+#include <list>
 #include <string>
 
 #include "base-list.h"
@@ -89,7 +90,7 @@
 
     tree_identifier * ident (void) { return id; }
 
-    std::string name (void) { return id ? id->name () : ""; }
+    std::string name (void) const { return id ? id->name () : ""; }
 
     tree_expression * expression (void) { return expr; }
 
@@ -147,6 +148,21 @@
         elt->mark_persistent ();
     }
 
+    std::list<std::string> variable_names (void) const
+    {
+      std::list<std::string> retval;
+
+      for (const tree_decl_elt *elt : *this)
+      {
+        std::string nm = elt->name ();
+
+        if (! nm.empty ())
+          retval.push_back (nm);
+      }
+
+      return retval;
+    }
+
     void accept (tree_walker& tw)
     {
       tw.visit_decl_init_list (*this);