Mercurial > hg > octave-avbm
changeset 1063:1a3121ebf088
[project @ 1995-01-24 03:25:37 by jwe]
author | jwe |
---|---|
date | Tue, 24 Jan 1995 03:26:02 +0000 |
parents | 1b3a87031641 |
children | 32ff7b6638a0 |
files | src/pt-misc.cc src/pt-misc.h |
diffstat | 2 files changed, 17 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/src/pt-misc.cc +++ b/src/pt-misc.cc @@ -495,6 +495,12 @@ // If. int +tree_if_clause::is_else_clause (void) +{ + return (! expr); +} + +int tree_if_clause::eval (void) { if (expr) @@ -554,23 +560,10 @@ tree_if_clause::print_code (ostream& os) { if (expr) - { - expr->print_code (os); - - print_code_new_line (os); + expr->print_code (os); - increment_indent_level (); - } - else - { - print_code_indent (os); - - os << "else"; - - print_code_new_line (os); - - increment_indent_level (); - } + print_code_new_line (os); + increment_indent_level (); if (list) { @@ -605,21 +598,23 @@ { tree_if_clause *elt = this->operator () (p); - next (p); - if (elt) { - if (p && ! first_elt) + if (! first_elt) { print_code_indent (os); - os << "elseif "; + if (elt->is_else_clause ()) + os << "else"; + else + os << "elseif "; } elt->print_code (os); } first_elt = 0; + next (p); } }