changeset 25636:be45013e7794

maint: Merge stable to default.
author John W. Eaton <jwe@octave.org>
date Wed, 18 Jul 2018 12:59:57 -0400
parents 6ff900fd15cb (current diff) 7f6fd47712d0 (diff)
children e1c3d1c6e896
files libinterp/corefcn/ls-mat5.cc
diffstat 1 files changed, 39 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/ls-mat5.cc	Mon Jul 16 16:28:59 2018 -0400
+++ b/libinterp/corefcn/ls-mat5.cc	Wed Jul 18 12:59:57 2018 -0400
@@ -1190,38 +1190,49 @@
               }
             else
               {
-                octave_class *cls
-                  = new octave_class (m, classname,
-                                      std::list<std::string> ());
-
-                if (cls->reconstruct_exemplar ())
+                cdef_manager& cdm
+                  = octave::__get_cdef_manager__ ("read_mat5_binary_element");
+
+                if (cdm.find_class (classname, false, true).ok ())
                   {
-
-                    if (! cls->reconstruct_parents ())
-                      warning ("load: unable to reconstruct object inheritance");
-
-                    tc = cls;
-
-                    octave::load_path& lp = octave::__get_load_path__ ("read_mat5_binary_element");
-
-                    if (lp.find_method (classname, "loadobj") != "")
-                      {
-                        try
-                          {
-                            octave_value_list tmp = octave::feval ("loadobj", tc, 1);
-
-                            tc = tmp(0);
-                          }
-                        catch (const octave::execution_exception&)
-                          {
-                            goto data_read_error;
-                          }
-                      }
+                    tc = m;
+                    warning ("load: classdef element has been converted to a struct");
                   }
                 else
                   {
-                    tc = m;
-                    warning ("load: element has been converted to a structure");
+                    octave_class *cls
+                      = new octave_class (m, classname,
+                                          std::list<std::string> ());
+
+                    if (cls->reconstruct_exemplar ())
+                      {
+
+                        if (! cls->reconstruct_parents ())
+                          warning ("load: unable to reconstruct object inheritance");
+
+                        tc = cls;
+
+                        octave::load_path& lp = octave::__get_load_path__ ("read_mat5_binary_element");
+
+                        if (lp.find_method (classname, "loadobj") != "")
+                          {
+                            try
+                              {
+                                octave_value_list tmp = octave::feval ("loadobj", tc, 1);
+
+                                tc = tmp(0);
+                              }
+                            catch (const octave::execution_exception&)
+                              {
+                                goto data_read_error;
+                              }
+                          }
+                      }
+                    else
+                      {
+                        tc = m;
+                        warning ("load: element has been converted to a structure");
+                      }
                   }
               }
           }