view libinterp/parse-tree/pt-exp.cc @ 20893:384ff5aa9437

2015 Code Sprint: Eliminate useless return statements after error (). * data.cc, graphics.cc, graphics.in.h, ls-mat4.cc, ls-mat5.cc, oct-fstrm.cc, oct-stream.cc, oct-strstrm.cc, __delaunayn__.cc, ov-base-int.cc, ov-classdef.h, ov-complex.cc, ov-cx-sparse.cc, ov-fcn-inline.cc, ov-float.cc, ov-flt-complex.cc, ov-java.cc, ov-range.cc, ov-re-sparse.cc, ov-scalar.cc, ov-struct.cc, ov-usr-fcn.cc, ov.cc, op-cm-cm.cc, op-cm-m.cc, op-cm-scm.cc, op-cm-sm.cc, op-fcm-fcm.cc, op-fcm-fm.cc, op-fm-fcm.cc, op-fm-fm.cc, op-m-cm.cc, op-m-m.cc, op-m-scm.cc, op-m-sm.cc, op-scm-cm.cc, op-scm-m.cc, op-scm-scm.cc, op-scm-sm.cc, op-sm-cm.cc, op-sm-m.cc, op-sm-scm.cc, op-sm-sm.cc, pt-exp.cc: Eliminate useless return statements after error ().
author Rik <rik@octave.org>
date Mon, 14 Dec 2015 12:59:29 -0800
parents f90c8372b7ba
children 3aa293be0e8d
line wrap: on
line source

/*

Copyright (C) 1996-2015 John W. Eaton

This file is part of Octave.

Octave is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.

Octave is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with Octave; see the file COPYING.  If not, see
<http://www.gnu.org/licenses/>.

*/

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <iostream>
#include <string>

#include "error.h"
#include "pager.h"
#include "oct-lvalue.h"
#include "ov.h"
#include "pt-exp.h"

// Expressions.

bool
tree_expression::is_logically_true (const char *warn_for)
{
  bool expr_value = false;

  octave_value t1 = rvalue1 ();

  if (t1.is_defined ())
    return t1.is_true ();
  else
    error ("%s: undefined value used in conditional expression",
           warn_for);

  return expr_value;
}

octave_value
tree_expression::rvalue1 (int)
{
  error ("invalid rvalue function called in expression");
}

octave_value_list
tree_expression::rvalue (int)
{
  error ("invalid rvalue function called in expression");
}

octave_value_list
tree_expression::rvalue (int nargout, const std::list<octave_lvalue> *)
{
  return rvalue (nargout);
}

octave_lvalue
tree_expression::lvalue (void)
{
  error ("invalid lvalue function called in expression");
}

std::string
tree_expression::original_text (void) const
{
  return std::string ();
}