changeset 25221:22ece7843499

Allow a single metaclass for Access property of classdef objects (bug #53601) * ov-classdef.cc (check_access): Add an additional elseif to input parsing to look for an object (metaclass) as input. If found, verify that the metaclass is either the same as the current class or is a superclass of the object.
author Rik <rik@octave.org>
date Wed, 11 Apr 2018 16:45:53 -0700
parents e98c6d393abb
children 2a6e9a3386fa
files libinterp/octave-value/ov-classdef.cc
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-classdef.cc	Wed Apr 11 15:23:44 2018 -0400
+++ b/libinterp/octave-value/ov-classdef.cc	Wed Apr 11 16:45:53 2018 -0700
@@ -364,6 +364,22 @@
             panic_impossible ();
         }
     }
+  else if (acc.isobject ())
+    {
+      cdef_class ctx = get_class_context ();
+
+      // At this point, a class context is always required.
+      if (ctx.ok ())
+        {
+          if (ctx == cls)
+            return true;
+
+          cdef_class acc_cls (to_cdef (acc));
+
+          if (is_superclass (acc_cls, ctx))
+            return true;
+        }
+    }
   else if (acc.iscell ())
     {
       Cell acc_c = acc.cell_value ();