changeset 32257:112634c3f947

VM Don't compile anonymous functions An anonymous function could accidentally be compiled when invoked from feval in a cpp function. * libinterp/parse-tree/pt-bytecode-walk.cc: Abort compilation if return parameters are null * test/compile/bytecode_anon_handles.m: TODO note
author Petter T. <petter.vilhelm@gmail.com>
date Wed, 09 Aug 2023 22:23:13 +0200
parents d421df248d7c
children 58a78f3d29f6
files libinterp/parse-tree/pt-bytecode-walk.cc test/compile/bytecode_anon_handles.m
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-bytecode-walk.cc	Sun Aug 13 20:47:18 2023 +0200
+++ b/libinterp/parse-tree/pt-bytecode-walk.cc	Wed Aug 09 22:23:13 2023 +0200
@@ -2059,6 +2059,10 @@
         }
     }
 
+  // TODO: The return_list is a nullptr for anonymous functions.
+  if (!returns)
+    error ("Compiling anonymous functions is not supported by the VM yet");
+
   // Does the function output varargout?
   m_varargout = returns->takes_varargs ();
   // "varargout" is not in the 'returns' list (if in the proper last position)
--- a/test/compile/bytecode_anon_handles.m	Sun Aug 13 20:47:18 2023 +0200
+++ b/test/compile/bytecode_anon_handles.m	Wed Aug 09 22:23:13 2023 +0200
@@ -1,3 +1,5 @@
+% TODO: The anonymous functions bodies are not compiled
+
 function bytecode_anon_handles ()
   h1 = @(x) __printf_assert__ ("%d ", x);
   h1 (1);