Mercurial > hg > octave-nkf
diff src/pt-decl.h @ 8658:73c4516fae10
New evaluator and debugger derived from tree-walker class
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 04 Feb 2009 00:47:53 -0500 |
parents | ad3afaaa19c1 |
children | 35cd375d4bb3 |
line wrap: on
line diff
--- a/src/pt-decl.h +++ b/src/pt-decl.h @@ -44,8 +44,6 @@ { public: - typedef void (*eval_fcn) (tree_decl_elt &); - tree_decl_elt (tree_identifier *i = 0, tree_expression *e = 0) : id (i), expr (e) { } @@ -65,12 +63,22 @@ bool lvalue_ok (void) { return id ? id->lvalue_ok () : false; } - // Do not allow functions return null values - octave_value rvalue (void) { return id ? id->rvalue ().storable_value () : octave_value (); } + // Do not allow functions to return null values. + octave_value rvalue1 (int nargout = 1) + { + return id ? id->rvalue1 (nargout).storable_value () : octave_value (); + } octave_value_list rvalue (int nargout) { - return id ? id->rvalue (nargout) : octave_value_list (); + octave_value_list retval; + + if (nargout > 1) + error ("invalid number of output arguments in declaration list"); + else + retval = rvalue1 (nargout); + + return retval; } octave_lvalue lvalue (void) { return id ? id->lvalue () : octave_lvalue (); } @@ -118,8 +126,6 @@ } } - void eval (tree_decl_elt::eval_fcn); - tree_decl_init_list *dup (symbol_table::scope_id scope, symbol_table::context_id context); @@ -152,8 +158,6 @@ tree_decl_init_list *initializer_list (void) { return init_list; } - void accept (tree_walker& tw); - std::string name (void) { return cmd_name; } protected: @@ -188,11 +192,11 @@ ~tree_global_command (void) { } - void eval (void); - tree_command *dup (symbol_table::scope_id scope, symbol_table::context_id context); + void accept (tree_walker& tw); + private: static void do_init (tree_decl_elt& elt); @@ -219,11 +223,11 @@ ~tree_static_command (void) { } - void eval (void); - tree_command *dup (symbol_table::scope_id scope, symbol_table::context_id context); + void accept (tree_walker& tw); + private: static void do_init (tree_decl_elt& elt);