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 18:41:13 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

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

The problem wasn't that hard to find.  The code is located in
libinterp/parse-tree/pt-pr-code.cc.  The function is
tree_print_code::visit_parameter_list shown below.o


  void
  tree_print_code::visit_parameter_list (tree_parameter_list& lst)
  {
    auto p = lst.begin ();

    while (p != lst.end ())
      {
        tree_decl_elt *elt = *p++;

        if (elt)
          {
            elt->accept (*this);

            if (p != lst.end () || lst.takes_varargs ())
              m_os << ", ";
          }
      }

    /*
    if (lst.takes_varargs ())
      m_os << "varargin";
      */
  }


I just commented out the addition of the string "varargin" and then it works
for the motivating example.  However, it will then fail for this declaration


function varargout = one_to_n (a,b, varargin)


where it will print


function [varargout] = one_to_n (a, b, )


I can see a couple of ways around this.  The most obvious is why is Octave
calling visit_parameter_list for the output list instead of visit_return_list?
 Or is visit_return_list for the "return" statement?

If it is correct that visit_parameter_list should be called, then it seems
that the list needs to have a member variable that tracks whether it is an
input or output parameter list and behave accordingly.  That would be a little
trick because it would require adding such a variable to the class definition
in pt-misc.h


    _______________________________________________________

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]