comparison libinterp/parse-tree/oct-parse.yy @ 28545:3dae50cf0bc5 stable

don't allow function return_list objects to be null * oct-parse.yy (base_parser::finish_function, base_parser::finish_classdef_external_method): Ensure that return list is always defined, even if it is empty.
author John W. Eaton <jwe@octave.org>
date Thu, 09 Jul 2020 09:15:58 -0400
parents 59dfd9ed72a3
children 605b9e811bf3 d45d1b4bb919
comparison
equal deleted inserted replaced
28544:dc53b7b7af8b 28545:3dae50cf0bc5
3718 comment_list *lc, 3718 comment_list *lc,
3719 int l, int c) 3719 int l, int c)
3720 { 3720 {
3721 tree_function_def *retval = nullptr; 3721 tree_function_def *retval = nullptr;
3722 3722
3723 if (ret_list) 3723 if (! ret_list)
3724 ret_list->mark_as_formal_parameters (); 3724 ret_list = new tree_parameter_list (tree_parameter_list::out);
3725
3726 ret_list->mark_as_formal_parameters ();
3725 3727
3726 if (fcn) 3728 if (fcn)
3727 { 3729 {
3728 std::string fcn_nm = fcn->name (); 3730 std::string fcn_nm = fcn->name ();
3729 std::string file = fcn->fcn_file_name (); 3731 std::string file = fcn->fcn_file_name ();
4144 tree_function_def * 4146 tree_function_def *
4145 base_parser::finish_classdef_external_method (octave_user_function *fcn, 4147 base_parser::finish_classdef_external_method (octave_user_function *fcn,
4146 tree_parameter_list *ret_list, 4148 tree_parameter_list *ret_list,
4147 comment_list *cl) 4149 comment_list *cl)
4148 { 4150 {
4149 if (ret_list) 4151 if (! ret_list)
4150 fcn->define_ret_list (ret_list); 4152 ret_list = new tree_parameter_list (tree_parameter_list::out);
4153
4154 fcn->define_ret_list (ret_list);
4151 4155
4152 if (cl) 4156 if (cl)
4153 fcn->stash_leading_comment (cl); 4157 fcn->stash_leading_comment (cl);
4154 4158
4155 int l = fcn->beginning_line (); 4159 int l = fcn->beginning_line ();