diff libinterp/parse-tree/pt-id.cc @ 27479:e8c417f6ef83

make unimplmented message an error and append to undefined identifier error * __unimplemented__.m: Throw error instead of issuing warning message. Update messages to be appropriate as additional info for another error instead of as an error by itself. * variables.h, variables.cc (Fmissing_function_hook): Update doc string. (maybe_missing_function_hook): Call missing_function_hook with nargout set to 1. If result is a string, return it, otherwise return an empty string. * pt-id.cc (tree_identifier::eval_undefined_error): If missing_function_hook returns a non-empty string, append it to the undefined symbol error message.
author John W. Eaton <jwe@octave.org>
date Mon, 07 Oct 2019 10:55:51 -0400
parents fcaecdbc8d8a
children b442ec6dda5c
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-id.cc	Sun Oct 06 22:25:36 2019 +0200
+++ b/libinterp/parse-tree/pt-id.cc	Mon Oct 07 10:55:51 2019 -0400
@@ -44,15 +44,22 @@
     int l = line ();
     int c = column ();
 
-    maybe_missing_function_hook (name ());
+    std::string msg = "'" + name () + "' undefined";
+
+    if (l > 0)
+      {
+        msg += " near line " + std::to_string (l);
 
-    if (l == -1 && c == -1)
-      error_with_id ("Octave:undefined-function",
-                     "'%s' undefined", name ().c_str ());
-    else
-      error_with_id ("Octave:undefined-function",
-                     "'%s' undefined near line %d column %d",
-                     name ().c_str (), l, c);
+        if (c > 0)
+          msg += ", column " + std::to_string (l);
+      }
+
+    std::string missing_msg = maybe_missing_function_hook (name ());
+
+    if (! missing_msg.empty ())
+      msg += "\n\n" + missing_msg;
+
+    error_with_id ("Octave:undefined-function", "%s", msg.c_str ());
   }
 
   octave_lvalue