changeset 32625:b60af3354ac3

maint: Deprecate mark_as_variable, unmark_as_variable methods for code clarity. * NEWS.10.md: Announce deprecations of symbol_record_rep:mark_as_variable, symbol_record_rep:unmark_as_variable, symbol_record:mark_as_variable, symbol_record:unmark_as_variable. * symrec.h (symbol_record_rep::mark_as_variable, symbol_record_rep::unmark_as_variable, symbol_record::mark_as_variable, symbol_record::unmark_as_variable): Add OCTAVE_DEPRECATED macro decorator on method declarations. * symrec.h (symbol_record_rep::mark_variable, symbol_record_rep::unmark_variable, symbol_record::mark_variable, symbol_record::unmark_variable): New methods. * symscope.cc (symbol_scope_rep::mark_as_variable): Change code to call symbol_record::mark_variable().
author Rik <rik@octave.org>
date Wed, 20 Dec 2023 18:24:41 -0800
parents 7cbef4817f32
children 395ab2ffb0c2
files etc/NEWS.10.md libinterp/corefcn/symrec.h libinterp/corefcn/symscope.cc
diffstat 3 files changed, 29 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS.10.md	Wed Dec 20 08:11:27 2023 -0800
+++ b/etc/NEWS.10.md	Wed Dec 20 18:24:41 2023 -0800
@@ -12,8 +12,6 @@
 to 'rtick' by the function `rticks` will only include the center tick mark
 value if it is specified.
 
-- `
-
 ### Matlab compatibility
 
 - `height` and `width` are now aliases for the `rows` and `columns` functions.
@@ -34,6 +32,15 @@
         Function               | Replacement
         -----------------------|------------------
 
+- Core
+
+        Function                              | Replacement
+        --------------------------------------|------------------
+        symbol_record_rep::mark_as_variable   | symbol_record_rep::mark_variable
+        symbol_record_rep::unmark_as_variable | symbol_record_rep::unmark_variable
+        symbol_record::mark_as_variable       | symbol_record::mark_variable
+        symbol_record::unmark_as_variable     | symbol_record::unmark_variable
+
 The following features were deprecated in Octave 8 and have been removed
 from Octave 10.
 
--- a/libinterp/corefcn/symrec.h	Wed Dec 20 08:11:27 2023 -0800
+++ b/libinterp/corefcn/symrec.h	Wed Dec 20 18:24:41 2023 -0800
@@ -125,11 +125,18 @@
                         | ADDED_STATIC);
     }
 
+    void mark_variable ()
+    {
+      m_storage_class = static_cast<symrec_t> (m_storage_class | VARIABLE);
+    }
+
+    OCTAVE_DEPRECATED (10, "symbol_record_rep::mark_as_variable is obsolete, use mark_variable")
     void mark_as_variable ()
     {
       m_storage_class = static_cast<symrec_t> (m_storage_class | VARIABLE);
     }
 
+
     void unmark_local ()
     {
       m_storage_class = static_cast<symrec_t> (m_storage_class & ~LOCAL);
@@ -146,6 +153,12 @@
                         & ~ADDED_STATIC);
     }
 
+    void unmark_variable ()
+    {
+      m_storage_class = static_cast<symrec_t> (m_storage_class & ~VARIABLE);
+    }
+
+    OCTAVE_DEPRECATED (10, "symbol_record_rep::unmark_as_variable is obsolete, use unmark_variable")
     void unmark_as_variable ()
     {
       m_storage_class = static_cast<symrec_t> (m_storage_class & ~VARIABLE);
@@ -216,12 +229,16 @@
   void mark_local () { m_rep->mark_local (); }
   void mark_formal () { m_rep->mark_formal (); }
   void mark_added_static () { m_rep->mark_added_static (); }
-  void mark_as_variable () { m_rep->mark_as_variable (); }
+  void mark_variable () { m_rep->mark_variable (); }
+  OCTAVE_DEPRECATED (10, "symbol_record::mark_as_variable is obsolete, use mark_variable")
+  void mark_as_variable () { m_rep->mark_variable (); }
 
   void unmark_local () { m_rep->unmark_local (); }
   void unmark_formal () { m_rep->unmark_formal (); }
   void unmark_added_static () { m_rep->unmark_added_static (); }
-  void unmark_as_variable () { m_rep->unmark_as_variable (); }
+  void unmark_variable () { m_rep->unmark_variable (); }
+  OCTAVE_DEPRECATED (10, "symbol_record::unmark_as_variable is obsolete, use unmark_variable")
+  void unmark_as_variable () { m_rep->unmark_variable (); }
 
   unsigned int storage_class () const { return m_rep->storage_class (); }
 
--- a/libinterp/corefcn/symscope.cc	Wed Dec 20 08:11:27 2023 -0800
+++ b/libinterp/corefcn/symscope.cc	Wed Dec 20 18:24:41 2023 -0800
@@ -281,7 +281,7 @@
   table_iterator p = m_symbols.find (nm);
 
   if (p != m_symbols.end ())
-    p->second.mark_as_variable ();
+    p->second.mark_variable ();
 }
 
 void