diff --git a/libinterp/corefcn/symscope.cc b/libinterp/corefcn/symscope.cc --- a/libinterp/corefcn/symscope.cc +++ b/libinterp/corefcn/symscope.cc @@ -25,6 +25,8 @@ along with Octave; see the file COPYING. # include "config.h" #endif +#include + #include #include "fcn-info.h" @@ -235,6 +237,9 @@ namespace octave for (auto& scope_obj : m_children) scope_obj.update_nest (); + + for (auto& scope_obj : m_anon_children) + scope_obj.update_nest (); } bool symbol_scope_rep::look_nonlocal (const std::string& name, diff --git a/libinterp/corefcn/symscope.h b/libinterp/corefcn/symscope.h --- a/libinterp/corefcn/symscope.h +++ b/libinterp/corefcn/symscope.h @@ -66,8 +66,8 @@ namespace octave symbol_scope_rep (const std::string& name = "") : m_name (name), m_symbols (), m_subfunctions (), m_persistent_values (), m_fcn (nullptr), m_parent (), - m_primary_parent (), m_children (), m_nesting_depth (0), - m_is_static (false) + m_primary_parent (), m_children (), m_anon_children (), + m_nesting_depth (0), m_is_static (false) { // All scopes have ans as the first symbol, initially undefined. @@ -129,6 +129,7 @@ namespace octave new_sid->m_parent = m_parent; new_sid->m_primary_parent = m_primary_parent; new_sid->m_children = m_children; + new_sid->m_anon_children = m_anon_children; new_sid->m_nesting_depth = m_nesting_depth; new_sid->m_is_static = m_is_static; @@ -197,6 +198,11 @@ namespace octave m_children.push_back (fcn_scope); } + void install_anon_function (const symbol_scope& fcn_scope) + { + m_anon_children.push_back (fcn_scope); + } + octave_value find_subfunction (const std::string& name) const; void lock_subfunctions (void) @@ -313,6 +319,10 @@ namespace octave std::vector m_children; + //! Anonymous functions contained in this scope. + + std::vector m_anon_children; + //! If true, then this scope belongs to a nested function. size_t m_nesting_depth; @@ -459,6 +469,12 @@ namespace octave m_rep->install_nestfunction (name, fval, fcn_scope); } + void install_anon_function (const symbol_scope& fcn_scope) + { + if (m_rep) + m_rep->install_anon_function (fcn_scope); + } + octave_value find_subfunction (const std::string& name) const { return m_rep ? m_rep->find_subfunction (name) : octave_value (); diff --git a/libinterp/octave-value/ov-fcn-handle.cc b/libinterp/octave-value/ov-fcn-handle.cc --- a/libinterp/octave-value/ov-fcn-handle.cc +++ b/libinterp/octave-value/ov-fcn-handle.cc @@ -85,7 +85,7 @@ const std::string octave_fcn_handle::ano octave_fcn_handle::octave_fcn_handle (const octave_value& f, const std::string& n) : fcn (f), nm (n), has_overloads (false), overloads (), - m_is_nested (false), m_closure_frames (nullptr) + m_is_nested (false), m_is_anonymous (false), m_closure_frames (nullptr) { octave_user_function *uf = fcn.user_function_value (true); @@ -99,6 +99,9 @@ octave_fcn_handle::octave_fcn_handle (co if (uf && uf->is_nested_function () && ! uf->is_subfunction ()) m_is_nested = true; + + if (uf && nm == anonymous) + m_is_anonymous = true; } octave_fcn_handle::~octave_fcn_handle (void) @@ -280,21 +283,7 @@ octave_fcn_handle::push_closure_context octave_value octave_fcn_handle::workspace (void) const { - if (nm == anonymous) - { - octave_user_function *fu = fcn.user_function_value (); - - octave_scalar_map ws; - - if (fu) - { - for (const auto& nm_val : fu->local_var_init_vals ()) - ws.assign (nm_val.first, nm_val.second); - } - - return ws; - } - else if (m_closure_frames) + if (m_closure_frames) { octave_idx_type num_frames = m_closure_frames->size (); @@ -445,23 +434,30 @@ octave_fcn_handle::convert_to_str_intern bool octave_fcn_handle::save_ascii (std::ostream& os) { - if (nm == anonymous) + if (m_is_anonymous) { if (fcn.is_undefined ()) return false; +#if 0 + // FIXME: What is supposed to happen here? + octave_user_function *f = fcn.user_function_value (); octave_user_function::local_vars_map local_vars = f->local_var_init_vals (); size_t varlen = local_vars.size (); +#endif os << nm << "\n"; print_raw (os, true); os << "\n"; +#if 0 + // FIXME: What is supposed to happen here? + if (varlen > 0) { os << "# length: " << varlen << "\n"; @@ -472,6 +468,7 @@ octave_fcn_handle::save_ascii (std::ostr return ! os.fail (); } } +#endif } else { @@ -548,7 +545,7 @@ octave_fcn_handle::load_ascii (std::istr is >> nm; - if (nm == anonymous) + if (m_is_anonymous) { skip_preceeding_newline (is); @@ -620,13 +617,16 @@ octave_fcn_handle::load_ascii (std::istr bool octave_fcn_handle::save_binary (std::ostream& os, bool save_as_floats) { - if (nm == anonymous) + if (m_is_anonymous) { std::ostringstream nmbuf; if (fcn.is_undefined ()) return false; +#if 0 + // FIXME: What is supposed to happen here? + octave_user_function *f = fcn.user_function_value (); octave_user_function::local_vars_map local_vars @@ -638,6 +638,8 @@ octave_fcn_handle::save_binary (std::ost nmbuf << nm << ' ' << varlen; else nmbuf << nm; +#endif + nmbuf << nm; std::string buf_str = nmbuf.str (); int32_t tmp = buf_str.length (); @@ -651,6 +653,9 @@ octave_fcn_handle::save_binary (std::ost os.write (reinterpret_cast (&tmp), 4); os.write (stmp.c_str (), stmp.length ()); +#if 0 + // FIXME: What is supposed to happen here? + if (varlen > 0) { for (const auto& nm_val : local_vars) @@ -660,6 +665,7 @@ octave_fcn_handle::save_binary (std::ost return ! os.fail (); } } +#endif } else { @@ -877,6 +883,9 @@ octave_fcn_handle::save_hdf5 (octave_hdf H5Dclose (data_hid); +#if 0 + // FIXME: What is supposed to happen here? + octave_user_function *f = fcn.user_function_value (); octave_user_function::local_vars_map local_vars @@ -935,6 +944,7 @@ octave_fcn_handle::save_hdf5 (octave_hdf } H5Gclose (data_hid); } +#endif } else { @@ -1472,7 +1482,7 @@ octave_fcn_handle::print_raw (std::ostre { bool printed = false; - if (nm == anonymous) + if (m_is_anonymous) { octave::tree_print_code tpc (os); @@ -1730,6 +1740,15 @@ namespace octave return retval; } + + extern octave_value + make_anon_fcn_handle (interpreter& interp, const octave_value& fcn) + { + octave_fcn_handle *anon_fh + = new octave_fcn_handle (fcn, octave_fcn_handle::anonymous); + + return octave_value (anon_fh); + } } /* @@ -1831,7 +1850,7 @@ particular output format. std::string fh_nm = fh->fcn_name (); - if (fh_nm == octave_fcn_handle::anonymous) + if (fh->is_anonymous ()) { std::ostringstream buf; fh->print_raw (buf); @@ -1863,7 +1882,7 @@ particular output format. std::string nm = fcn->fcn_file_name (); - if (fh_nm == octave_fcn_handle::anonymous) + if (fh->is_anonymous ()) { m.setfield ("file", nm); @@ -1902,7 +1921,7 @@ function handle @var{fcn_handle}. std::string fh_nm = fh->fcn_name (); - if (fh_nm == octave_fcn_handle::anonymous) + if (fh->is_anonymous ()) { std::ostringstream buf; diff --git a/libinterp/octave-value/ov-fcn-handle.h b/libinterp/octave-value/ov-fcn-handle.h --- a/libinterp/octave-value/ov-fcn-handle.h +++ b/libinterp/octave-value/ov-fcn-handle.h @@ -57,20 +57,21 @@ public: octave_fcn_handle (void) : fcn (), nm (), has_overloads (false), overloads (), - m_is_nested (false), m_closure_frames (nullptr) + m_is_nested (false), m_is_anonymous (false), m_closure_frames (nullptr) { } octave_fcn_handle (const std::string& n) : fcn (), nm (n), has_overloads (false), overloads (), - m_is_nested (false), m_closure_frames (nullptr) + m_is_nested (false), m_is_anonymous (false), m_closure_frames (nullptr) { } - octave_fcn_handle (const octave_value& f, const std::string& n = anonymous); + octave_fcn_handle (const octave_value& f, const std::string& n = anonymous); octave_fcn_handle (const octave_fcn_handle& fh) : octave_base_value (fh), fcn (fh.fcn), nm (fh.nm), has_overloads (fh.has_overloads), overloads (), - m_is_nested (fh.m_is_nested), m_closure_frames (fh.m_closure_frames) + m_is_nested (fh.m_is_nested), m_is_anonymous (fh.m_is_anonymous), + m_closure_frames (fh.m_closure_frames) { for (int i = 0; i < btyp_num_types; i++) builtin_overloads[i] = fh.builtin_overloads[i]; @@ -106,6 +107,8 @@ public: bool is_nested (void) const { return m_is_nested; } + bool is_anonymous (void) const { return m_is_nested; } + dim_vector dims (void) const; octave_function * function_value (bool = false) @@ -167,7 +170,7 @@ public: void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; // Simple function handles are printed without a newline. - bool print_as_scalar (void) const { return nm != anonymous; } + bool print_as_scalar (void) const { return ! m_is_anonymous; } private: @@ -195,6 +198,9 @@ protected: // TRUE means this is a handle to a nested function. bool m_is_nested; + // TRUE means this is a handle to an anonymous function. + bool m_is_anonymous; + // Saved stack frames for handles to nested functions. This allows us // to access non-locals and other context info when calling nested // functions indirectly through handles. @@ -209,6 +215,9 @@ namespace octave { extern octave_value make_fcn_handle (interpreter& interp, const std::string& nm); + + extern octave_value + make_anon_fcn_handle (interpreter& interp, const octave_value& fcn); } #endif diff --git a/libinterp/octave-value/ov-usr-fcn.cc b/libinterp/octave-value/ov-usr-fcn.cc --- a/libinterp/octave-value/ov-usr-fcn.cc +++ b/libinterp/octave-value/ov-usr-fcn.cc @@ -188,7 +188,6 @@ octave_user_function::octave_user_functi const local_vars_map& lviv) : octave_user_code ("", "", scope, cl, ""), param_list (pl), ret_list (rl), - m_local_var_init_vals (lviv), lead_comm (), trail_comm (), location_line (0), location_column (0), parent_name (), system_fcn_file (false), diff --git a/libinterp/octave-value/ov-usr-fcn.h b/libinterp/octave-value/ov-usr-fcn.h --- a/libinterp/octave-value/ov-usr-fcn.h +++ b/libinterp/octave-value/ov-usr-fcn.h @@ -380,11 +380,6 @@ public: octave::comment_list * trailing_comment (void) { return trail_comm; } - const local_vars_map& local_var_init_vals (void) const - { - return m_local_var_init_vals; - } - // If is_special_expr is true, retrieve the sigular expression that forms the // body. May be null (even if is_special_expr is true). octave::tree_expression * special_expr (void); @@ -420,9 +415,6 @@ private: // this function. octave::tree_parameter_list *ret_list; - // For anonymous function values inherited from parent scope. - local_vars_map m_local_var_init_vals; - // The comments preceding the FUNCTION token. octave::comment_list *lead_comm; diff --git a/libinterp/parse-tree/oct-parse.yy b/libinterp/parse-tree/oct-parse.yy --- a/libinterp/parse-tree/oct-parse.yy +++ b/libinterp/parse-tree/oct-parse.yy @@ -231,7 +231,7 @@ static void yyerror (octave::base_parser %token '(' ')' '[' ']' '{' '}' '.' ',' ';' '@' '\n' // Nonterminals we construct. -%type indirect_ref_op decl_param_init +%type indirect_ref_op decl_param_init anon_fcn_beg %type push_fcn_symtab push_script_symtab begin_file %type param_list_beg param_list_end stmt_begin parse_error %type parsing_local_fcns @@ -608,14 +608,21 @@ fcn_handle : FCN_HANDLE { $$ = parser.make_fcn_handle ($1); } ; -anon_fcn_handle : '@' param_list stmt_begin expr_no_assign +anon_fcn_beg : push_fcn_symtab { - $$ = parser.make_anon_fcn_handle ($2, $4); + lexer.m_defining_func++; + lexer.m_parsed_function_name.push (true); + } + ; + +anon_fcn_handle : '@' anon_fcn_beg param_list stmt_begin expr_no_assign + { + $$ = parser.make_anon_fcn_handle ($3, $5); lexer.m_nesting_level.remove (); } - | '@' param_list stmt_begin error + | '@' anon_fcn_beg param_list stmt_begin error { - YYUSE ($2); + YYUSE ($3); $$ = nullptr; parser.bison_error ("anonymous function bodies must be single expressions"); @@ -1319,8 +1326,6 @@ param_list_beg : '(' if (lexer.m_looking_at_function_handle) { - // Will get a real name later. - lexer.m_symtab_context.push (octave::symbol_scope ("parser:param_lsit_beg")); lexer.m_looking_at_function_handle--; lexer.m_looking_at_anon_fcn_args = true; } @@ -2456,15 +2461,60 @@ namespace octave symbol_scope fcn_scope = m_lexer.m_symtab_context.curr_scope (); symbol_scope parent_scope = m_lexer.m_symtab_context.parent_scope (); - m_lexer.m_symtab_context.pop (); - expr->set_print_flag (false); fcn_scope.mark_static (); - tree_anon_fcn_handle *retval - = new tree_anon_fcn_handle (param_list, expr, fcn_scope, - parent_scope, l, c); + tree_statement_list *stmt_list = nullptr; + + if (expr) + { + tree_statement *stmt = new tree_statement (expr, nullptr); + stmt_list = new tree_statement_list (stmt); + } + + octave_user_function *af + = new octave_user_function (fcn_scope, param_list, nullptr, stmt_list); + + af->mark_as_anonymous_function (); + + if (m_lexer.m_reading_fcn_file || m_lexer.m_reading_script_file + || m_lexer.m_reading_classdef_file) + { + af->stash_parent_fcn_name (m_lexer.m_fcn_file_name); + af->stash_fcn_file_name (m_lexer.m_fcn_file_name); + af->stash_fcn_location (l, c); + af->stash_dir_name (m_lexer.m_dir_name); + } + + // The following is needed so that class method dispatch works + // properly for anonymous functions that wrap class methods. + + if (m_lexer.m_parsing_class_method) + af->stash_dispatch_class (m_curr_class_name); + + if (m_curr_fcn_depth > 0) + { + symbol_scope pscope = m_function_scopes.parent_scope (); + fcn_scope.set_parent (pscope); + fcn_scope.set_primary_parent (m_primary_fcn_scope); + pscope.install_anon_function (fcn_scope); + fcn_scope.set_nesting_depth (m_curr_fcn_depth); + } + else + { + tree_evaluator& tw + = __get_evaluator__ ("validate_matrix_for_assignment"); + + fcn_scope.set_nesting_depth (1); + symbol_scope pscope = tw.get_top_scope (); + fcn_scope.set_parent (pscope); + fcn_scope.update_nest (); + } + + octave_value ov_fcn (af); + + tree_anon_fcn_handle *retval = new tree_anon_fcn_handle (ov_fcn, l, c); std::ostringstream buf; @@ -2485,9 +2535,7 @@ namespace octave fcn_scope.cache_name (scope_name); - // FIXME: Stash the filename. This does not work and produces - // errors when executed. - //retval->stash_file_name (m_lexer.m_fcn_file_name); + recover_from_parsing_function (); return retval; } diff --git a/libinterp/parse-tree/pt-eval.cc b/libinterp/parse-tree/pt-eval.cc --- a/libinterp/parse-tree/pt-eval.cc +++ b/libinterp/parse-tree/pt-eval.cc @@ -295,85 +295,15 @@ namespace octave void tree_evaluator::visit_anon_fcn_handle (tree_anon_fcn_handle& anon_fh) { - // FIXME: should CMD_LIST be limited to a single expression? - // I think that is what Matlab does. - - tree_parameter_list *param_list = anon_fh.parameter_list (); - tree_expression *expr = anon_fh.expression (); - - symbol_scope af_scope = anon_fh.scope (); - - symbol_scope new_scope; - if (af_scope) - new_scope = af_scope.dup (); - - tree_parameter_list *param_list_dup - = param_list ? param_list->dup (new_scope) : nullptr; - - tree_parameter_list *ret_list = nullptr; - - tree_statement_list *stmt_list = nullptr; - - symbol_scope parent_scope = get_current_scope (); - - new_scope.set_parent (parent_scope); - new_scope.set_primary_parent (parent_scope); - - if (expr) - { - tree_expression *expr_dup = expr->dup (new_scope); - tree_statement *stmt = new tree_statement (expr_dup, nullptr); - stmt_list = new tree_statement_list (stmt); - } - - tree_anon_scopes anon_fcn_ctx (anon_fh); - - std::set free_vars = anon_fcn_ctx.free_variables (); - - octave_user_function::local_vars_map local_var_init_vals; - - stack_frame& frame = m_call_stack.get_current_stack_frame (); - - for (auto& name : free_vars) - { - octave_value val = frame.varval (name); - - if (val.is_defined ()) - local_var_init_vals[name] = val; - } - - octave_user_function *af - = new octave_user_function (new_scope, param_list_dup, ret_list, - stmt_list, local_var_init_vals); - - octave_function *curr_fcn = m_call_stack.current (); - - if (curr_fcn) - { - // FIXME: maybe it would be better to just stash curr_fcn - // instead of individual bits of info about it? - - af->stash_parent_fcn_name (curr_fcn->name ()); - af->stash_dir_name (curr_fcn->dir_name ()); - - // The following is needed so that class method dispatch works - // properly for anonymous functions that wrap class methods. - - if (curr_fcn->is_class_method () || curr_fcn->is_class_constructor ()) - af->stash_dispatch_class (curr_fcn->dispatch_class ()); - - af->stash_fcn_file_name (curr_fcn->fcn_file_name ()); - } - - af->mark_as_anonymous_function (); - - octave_value ov_fcn (af); - - // octave_value fh (octave_fcn_binder::maybe_binder (ov_fcn, m_interpreter)); - - octave_value fh (new octave_fcn_handle (ov_fcn, octave_fcn_handle::anonymous)); - - push_result (fh); + octave_value ov_fh + = make_anon_fcn_handle (m_interpreter, anon_fh.function ()); + + octave_fcn_handle *fh = ov_fh.fcn_handle_value (); + + if (fh) + fh->push_closure_context (*this); + + push_result (ov_fh); } void @@ -1804,9 +1734,6 @@ namespace octave // Save old and set current symbol table context, for // eval_undefined_error(). - // std::cerr << "eval: " << user_function.name () - // << " with closure_frames: " << closure_frames << std::endl; - m_call_stack.push (&user_function, &frame, closure_frames); frame.protect_var (Vtrack_line_num); @@ -1819,9 +1746,6 @@ namespace octave nargout, user_function.takes_varargs (), user_function.all_va_args (args)); - if (user_function.is_anonymous_function ()) - init_local_fcn_vars (user_function); - tree_parameter_list *param_list = user_function.parameter_list (); if (param_list && ! param_list->varargs_only ()) @@ -1931,10 +1855,7 @@ namespace octave octave_fcn_handle *fh = val.fcn_handle_value (); if (fh && fh->is_nested ()) - { - // std::cerr << "pushing closure context" << std::endl; - fh->push_closure_context (*this); - } + fh->push_closure_context (*this); } } } @@ -4006,17 +3927,6 @@ namespace octave if (takes_varargs) assign ("varargin", va_args.cell_value ()); } - - void tree_evaluator::init_local_fcn_vars (octave_user_function& user_fcn) - { - stack_frame& frame = m_call_stack.get_current_stack_frame (); - - const octave_user_function::local_vars_map& lviv - = user_fcn.local_var_init_vals (); - - for (const auto& nm_ov : lviv) - frame.assign (nm_ov.first, nm_ov.second); - } } DEFMETHOD (max_recursion_depth, interp, args, nargout, diff --git a/libinterp/parse-tree/pt-eval.h b/libinterp/parse-tree/pt-eval.h --- a/libinterp/parse-tree/pt-eval.h +++ b/libinterp/parse-tree/pt-eval.h @@ -661,8 +661,6 @@ namespace octave int nargout, bool takes_varargs, const octave_value_list& va_args); - void init_local_fcn_vars (octave_user_function& user_fcn); - interpreter& m_interpreter; // The context for the current evaluation. diff --git a/libinterp/parse-tree/pt-fcn-handle.cc b/libinterp/parse-tree/pt-fcn-handle.cc --- a/libinterp/parse-tree/pt-fcn-handle.cc +++ b/libinterp/parse-tree/pt-fcn-handle.cc @@ -55,32 +55,11 @@ namespace octave return new_fh; } - tree_anon_fcn_handle::~tree_anon_fcn_handle (void) - { - delete m_parameter_list; - delete m_expression; - } - tree_expression * tree_anon_fcn_handle::dup (symbol_scope&) const { - tree_parameter_list *param_list = parameter_list (); - tree_expression *expr = expression (); - - symbol_scope af_scope = m_scope; - symbol_scope af_parent_scope = m_parent_scope; - - symbol_scope new_scope; - - if (af_scope) - new_scope = af_scope.dup (); - - // FIXME: if new scope is nullptr, then we are in big trouble here... - - tree_anon_fcn_handle *new_afh = new - tree_anon_fcn_handle (param_list ? param_list->dup (new_scope) : nullptr, - expr ? expr->dup (new_scope) : nullptr, - new_scope, af_parent_scope, line (), column ()); + tree_anon_fcn_handle *new_afh + = new tree_anon_fcn_handle (m_fcn, line (), column ()); new_afh->copy_base (*this); diff --git a/libinterp/parse-tree/pt-fcn-handle.h b/libinterp/parse-tree/pt-fcn-handle.h --- a/libinterp/parse-tree/pt-fcn-handle.h +++ b/libinterp/parse-tree/pt-fcn-handle.h @@ -89,18 +89,9 @@ namespace octave { public: - tree_anon_fcn_handle (int l = -1, int c = -1) - : tree_expression (l, c), m_parameter_list (nullptr), - m_expression (nullptr), m_scope (), m_parent_scope (), - m_file_name () - { } - - tree_anon_fcn_handle (tree_parameter_list *pl, tree_expression *ex, - const symbol_scope& scope, - const symbol_scope& parent_scope, + tree_anon_fcn_handle (const octave_value& fcn = octave_value (), int l = -1, int c = -1) - : tree_expression (l, c), m_parameter_list (pl), m_expression (ex), - m_scope (scope), m_parent_scope (parent_scope), m_file_name () + : tree_expression (l, c), m_fcn (fcn) { } // No copying! @@ -109,49 +100,43 @@ namespace octave tree_anon_fcn_handle& operator = (const tree_anon_fcn_handle&) = delete; - ~tree_anon_fcn_handle (void); + ~tree_anon_fcn_handle (void) = default; bool has_magic_end (void) const { return false; } bool rvalue_ok (void) const { return true; } - tree_parameter_list * parameter_list (void) const - { - return m_parameter_list; - } + octave_value function (void) const { return m_fcn; } + + // OCTAVE_DEPRECATED (6, "foobar") + tree_parameter_list * parameter_list (void) const { return nullptr; } + + // OCTAVE_DEPRECATED (6, "foobar") + tree_expression * expression (void) const { return nullptr; } - tree_expression * expression (void) const { return m_expression; } - - symbol_scope scope (void) const { return m_scope; } + // OCTAVE_DEPRECATED (6, "foobar") + symbol_scope scope (void) const { return symbol_scope (); } - symbol_scope parent_scope (void) const { return m_parent_scope; } + // OCTAVE_DEPRECATED (6, "foobar") + symbol_scope parent_scope (void) const { return symbol_scope (); } - bool has_parent_scope (void) const { return m_parent_scope.is_valid (); } + // OCTAVE_DEPRECATED (6, "foobar") + bool has_parent_scope (void) const { return false; } tree_expression * dup (symbol_scope& scope) const; void accept (tree_walker& tw) { tw.visit_anon_fcn_handle (*this); } - void stash_file_name (const std::string& file) { m_file_name = file; } + // OCTAVE_DEPRECATED (6, "foobar") + void stash_file_name (const std::string&) { } - std::string file_name (void) const { return m_file_name; } + // OCTAVE_DEPRECATED (6, "foobar") + std::string file_name (void) const { return ""; } private: - // Inputs parameters. - tree_parameter_list *m_parameter_list; - - // Function body, limited to a single expression. - tree_expression *m_expression; - - // Function scope. - symbol_scope m_scope; - - // Parent scope, or an invalid scope if none. - symbol_scope m_parent_scope; - - // Filename where the handle was defined. - std::string m_file_name; + // The anonymous function. + octave_value m_fcn; }; } diff --git a/libinterp/parse-tree/pt-pr-code.cc b/libinterp/parse-tree/pt-pr-code.cc --- a/libinterp/parse-tree/pt-pr-code.cc +++ b/libinterp/parse-tree/pt-pr-code.cc @@ -41,16 +41,7 @@ namespace octave print_parens (afh, "("); - m_os << "@("; - - tree_parameter_list *param_list = afh.parameter_list (); - - if (param_list) - param_list->accept (*this); - - m_os << ") "; - - print_fcn_handle_body (afh.expression ()); + m_os << "@(ARGS) EXPR"; print_parens (afh, ")"); }