diff libinterp/octave-value/ov-classdef.cc @ 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 6652d3823428
children 2ad00275b79b
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 ();