ruby-changes:11868
From: yugui <ko1@a...>
Date: Fri, 22 May 2009 18:48:23 +0900 (JST)
Subject: [ruby-changes:11868] Ruby:r23526 (ruby_1_9_1): merges r23431 from trunk into ruby_1_9_1.
yugui 2009-05-22 18:48:05 +0900 (Fri, 22 May 2009) New Revision: 23526 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23526 Log: merges r23431 from trunk into ruby_1_9_1. -- * variable.c (rb_autoload_load): checks if iv_tbl is valid. [ruby-dev:38456] Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/bootstraptest/test_class.rb branches/ruby_1_9_1/variable.c branches/ruby_1_9_1/version.h Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 23525) +++ ruby_1_9_1/ChangeLog (revision 23526) @@ -1,3 +1,8 @@ +Fri May 15 15:15:12 2009 Nobuyoshi Nakada <nobu@r...> + + * variable.c (rb_autoload_load): checks if iv_tbl is valid. + [ruby-dev:38456] + Sat May 16 09:19:16 2009 Nobuyoshi Nakada <nobu@r...> * parse.y (magic_comment_encoding): use rb_compile_warning() to Index: ruby_1_9_1/variable.c =================================================================== --- ruby_1_9_1/variable.c (revision 23525) +++ ruby_1_9_1/variable.c (revision 23526) @@ -1430,11 +1430,23 @@ return 0; } +static NODE * +autoload_node_ptr(VALUE mod, ID id) +{ + struct st_table *tbl = RCLASS_IV_TBL(mod); + st_data_t val; + + if (!tbl || !st_lookup(tbl, id, &val) || val != Qundef) { + return 0; + } + return autoload_node(mod, id, 0); +} + VALUE rb_autoload_load(VALUE klass, ID id) { VALUE file; - NODE *load = autoload_node(klass, id, 0); + NODE *load = autoload_node_ptr(klass, id); if (!load) return Qfalse; file = load->nd_lit; @@ -1444,15 +1456,10 @@ VALUE rb_autoload_p(VALUE mod, ID id) { - struct st_table *tbl = RCLASS_IV_TBL(mod); - st_data_t val; - NODE *load; VALUE file; + NODE *load = autoload_node_ptr(mod, id); - if (!tbl || !st_lookup(tbl, id, &val) || val != Qundef) { - return Qnil; - } - load = autoload_node(mod, id, 0); + if (!load) return Qnil; return load && (file = load->nd_lit) ? file : Qnil; } Index: ruby_1_9_1/bootstraptest/test_class.rb =================================================================== --- ruby_1_9_1/bootstraptest/test_class.rb (revision 23525) +++ ruby_1_9_1/bootstraptest/test_class.rb (revision 23526) @@ -144,3 +144,9 @@ } $i } + +assert_match /::C\z/, %q{ + c = nil + Module.new{|m| c = class m::C; name; end} + c +}, '[ruby-dev:38456]' Index: ruby_1_9_1/version.h =================================================================== --- ruby_1_9_1/version.h (revision 23525) +++ ruby_1_9_1/version.h (revision 23526) @@ -1,6 +1,6 @@ #define RUBY_VERSION "1.9.1" #define RUBY_RELEASE_DATE "2009-05-12" -#define RUBY_PATCHLEVEL 140 +#define RUBY_PATCHLEVEL 141 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/