changeset 24213:d2cfaaa57677 stable

tag global and persistent symbols as variables when parsing (bug #52363) * oct-parse.in.yy (base_parser::make_decl_command): Also tag variables in initializer list as pending local variables.
author John W. Eaton <jwe@octave.org>
date Wed, 08 Nov 2017 15:58:53 -0500
parents 7b74355c8e9d
children 2cc557b689d2 4283c4c2fcb6
files libinterp/parse-tree/oct-parse.in.yy
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/oct-parse.in.yy	Wed Nov 08 12:01:33 2017 -0800
+++ b/libinterp/parse-tree/oct-parse.in.yy	Wed Nov 08 15:58:53 2017 -0500
@@ -3718,6 +3718,18 @@
     int l = tok_val->line ();
     int c = tok_val->column ();
 
+    std::list<std::string> names;
+    for (tree_decl_init_list::iterator p = lst->begin ();
+         p != lst->end (); p++)
+      {
+        tree_decl_elt *elt = *p;
+
+        std::string nm = elt->name ();
+        if (! nm.empty ())
+          names.push_back (nm);
+      }
+    lexer.mark_as_variables (names);
+
     switch (tok)
       {
       case GLOBAL: