changeset 32462:a3d5446b3e93

Replace public field with getter setter Follow coding guidelines for m_compilation_failed. * ov-usr_fcn.h: Def getter setter, hide field * pt-bytecode-vm.cc: Use getter setter * ov-fcn-handle.cc: Use setter
author Petter T. <petter.vilhelm@gmail.com>
date Sat, 04 Nov 2023 01:35:04 +0100
parents 09ee4030e927
children 5ab6885dc658
files libinterp/octave-value/ov-fcn-handle.cc libinterp/octave-value/ov-usr-fcn.h libinterp/parse-tree/pt-bytecode-vm.cc
diffstat 3 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-fcn-handle.cc	Sat Nov 04 01:35:04 2023 +0100
+++ b/libinterp/octave-value/ov-fcn-handle.cc	Sat Nov 04 01:35:04 2023 +0100
@@ -2997,7 +2997,7 @@
   catch (std::exception &e)
     {
       warning ("Auto-compilation of anonymous function failed with message %s", e.what ());
-      usr_code->m_compilation_failed = true;
+      usr_code->set_compilation_failed (true);
     }
 }
 
--- a/libinterp/octave-value/ov-usr-fcn.h	Sat Nov 04 01:35:04 2023 +0100
+++ b/libinterp/octave-value/ov-usr-fcn.h	Sat Nov 04 01:35:04 2023 +0100
@@ -131,10 +131,13 @@
 
   octave::bytecode &get_bytecode () { return m_bytecode; }
 
-  bool m_compilation_failed = false;
+  bool compilation_failed () { return m_compilation_failed; }
+  void set_compilation_failed (bool val) { m_compilation_failed = val; }
 
 protected:
 
+  bool m_compilation_failed = false;
+
   octave::bytecode m_bytecode;
 
   void get_file_info ();
--- a/libinterp/parse-tree/pt-bytecode-vm.cc	Sat Nov 04 01:35:04 2023 +0100
+++ b/libinterp/parse-tree/pt-bytecode-vm.cc	Sat Nov 04 01:35:04 2023 +0100
@@ -8048,7 +8048,7 @@
   if (fn->is_compiled ())
     return true;
 
-  if (V__vm_enable__ && !fn->m_compilation_failed)
+  if (V__vm_enable__ && !fn->compilation_failed ())
     {
       try
         {
@@ -8062,7 +8062,7 @@
       catch (std::exception &e)
         {
           warning ("auto-compilation of %s failed with message %s", fn->name().c_str (), e.what ());
-          fn->m_compilation_failed = true;
+          fn->set_compilation_failed(true);
           return false;
         }
     }