From c2e4f4f6bdd3e7f44f10399b235c013f7b5516cc Mon Sep 17 00:00:00 2001 From: yugui Date: Fri, 22 May 2009 09:49:28 +0000 Subject: merges r23474 from trunk into ruby_1_9_1. -- * 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: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@23535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ compile.c | 2 +- parse.y | 7 ++++--- version.h | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index caa329f4c..8057aefb5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Sun May 17 14:23:08 2009 Nobuyoshi Nakada + + * 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. + Sun May 17 13:15:32 2009 Nobuyoshi Nakada * vm.c (rb_vm_get_sourceline): should not access out of bound. diff --git a/compile.c b/compile.c index d9f3731c3..4b99e2a68 100644 --- a/compile.c +++ b/compile.c @@ -5413,7 +5413,7 @@ rb_local_defined(ID id) int rb_parse_in_eval(void) { - return GET_THREAD()->parse_in_eval != 0; + return GET_THREAD()->parse_in_eval > 0; } int diff --git a/parse.y b/parse.y index 7be492a69..6596bf8af 100644 --- a/parse.y +++ b/parse.y @@ -765,14 +765,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($$); /*% %*/ } top_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 { @@ -5024,7 +5025,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(); diff --git a/version.h b/version.h index 05a94cefa..d93c0bf31 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "1.9.1" #define RUBY_RELEASE_DATE "2009-05-12" -#define RUBY_PATCHLEVEL 149 +#define RUBY_PATCHLEVEL 150 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 -- cgit