diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | parse.y | 8 | ||||
-rw-r--r-- | ruby.c | 4 |
3 files changed, 16 insertions, 4 deletions
@@ -1,3 +1,11 @@ +Wed Jul 18 09:19:07 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * parse.y (rb_parser_append_print, rb_parser_while_loop): moved check + for node to the head. + + * ruby.c (proc_options): do nothing for -p/-n options if tree is null. + submitted by Yusuke ENDOH <mame AT tsg.ne.jp> at [ruby-dev:31243]. + Wed Jul 18 08:47:09 2007 Yukihiro Matsumoto <matz@ruby-lang.org> * time.c (time_succ): Time#succ should return a time object in the @@ -8110,11 +8110,13 @@ rb_parser_append_print(VALUE vparser, NODE *node) NODE *scope = node; struct parser_params *parser; + if (!node) return node; + Data_Get_Struct(vparser, struct parser_params, parser); node = node->nd_body; - if (node && (nd_type(node) == NODE_PRELUDE)) { + if (nd_type(node) == NODE_PRELUDE) { prelude = node; node = node->nd_body; } @@ -8140,11 +8142,13 @@ rb_parser_while_loop(VALUE vparser, NODE *node, int chop, int split) NODE *scope = node; struct parser_params *parser; + if (!node) return node; + Data_Get_Struct(vparser, struct parser_params, parser); node = node->nd_body; - if (node && (nd_type(node) == NODE_PRELUDE)) { + if (nd_type(node) == NODE_PRELUDE) { prelude = node; node = node->nd_body; } @@ -883,10 +883,10 @@ proc_options(int argc, char **argv) FL_UNSET(rb_load_path, FL_TAINT); } - if (do_print) { + if (tree && do_print) { tree = rb_parser_append_print(parser, tree); } - if (do_loop) { + if (tree && do_loop) { tree = rb_parser_while_loop(parser, tree, do_line, do_split); } |