From f91b0dc811d709b260451809c5e35397e75f6d2d Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 17 May 2009 05:23:10 +0000 Subject: * compile.c (rb_parse_in_eval): returns true in true eval, not in main. [ruby-dev:38382] * parse.y (program): inherits dvars in eval or main. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'parse.y') diff --git a/parse.y b/parse.y index 7c11b7b2fc..8848145042 100644 --- a/parse.y +++ b/parse.y @@ -760,14 +760,15 @@ static void token_info_pop(struct parser_params*, const char *token); program : { lex_state = EXPR_BEG; /*%%%*/ - local_push(compile_for_eval); + $$ = compile_for_eval || rb_parse_in_main(); + local_push($$); /*% %*/ } compstmt { /*%%%*/ - if ($2 && !compile_for_eval) { + if ($2 && !$1) { /* last expression should not be void */ if (nd_type($2) != NODE_BLOCK) void_expr($2); else { @@ -4993,7 +4994,7 @@ yycompile0(VALUE arg, int tracing) NODE *tree; struct parser_params *parser = (struct parser_params *)arg; - if ((!compile_for_eval || rb_parse_in_main()) && rb_safe_level() == 0) { + if (!compile_for_eval && rb_safe_level() == 0) { ruby_debug_lines = debug_lines(ruby_sourcefile); if (ruby_debug_lines && ruby_sourceline > 0) { VALUE str = STR_NEW0(); -- cgit v1.2.3