octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #58279] vararginvarargout


From: Rik
Subject: [Octave-bug-tracker] [bug #58279] vararginvarargout
Date: Thu, 30 Apr 2020 19:00:31 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

Follow-up Comment #3, bug #58279 (project octave):

So, I was correct that there is a class for return lists in pt-misc.h and it
would suffice to use the correct class rather than the tree_parameter_list
class which is for input parameters.  The function is


  void
  tree_print_code::visit_octave_user_function_header (octave_user_function&
fcn)
  {
    comment_list *leading_comment = fcn.leading_comment ();

    if (leading_comment)
      {
        print_comment_list (leading_comment);
        newline ();
      }

    indent ();

    m_os << "function ";

    //tree_parameter_list *ret_list = fcn.return_list ();
    tree_return_list *ret_list = fcn.return_list ();

    if (ret_list)
      {
        bool takes_var_return = fcn.takes_var_return ();

        int len = ret_list->length ();

        if (len > 1 || takes_var_return)
          {
            m_os << '[';
            m_nesting.push ('[');
          }

        ret_list->accept (*this);

        if (takes_var_return)
          {
            if (len > 0)
              m_os << ", ";

            m_os << "varargout";
          }


You can see above where I tried that simple idea, but it fails to compile. 
This is because return_list returns a tree_parameter_list object.  I think
fixing this means going top to bottom through the parser and making sure that
tree_return_list is used consistently everywhere that an output parameter list
is being used.  But, this is not code I understand well.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58279>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]