diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-07-22 08:42:47 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-07-22 08:42:47 +0000 |
commit | 0d1df1cd7dde2396d1b81379b47e65e98b1b60f2 (patch) | |
tree | fa4c6633759cb9eb87ca7435a3bad901075c855f /variable.c | |
parent | 27daa53c544d2654a8fe05fad95df6bce18cdf7a (diff) | |
download | ruby-0d1df1cd7dde2396d1b81379b47e65e98b1b60f2.tar.gz |
* variable.c (rb_mod_const_missing): new method. [ruby-core:00441]
* variable.c (rb_const_get_at): allow "const_missing" hook.
* variable.c (rb_const_get_0): ditto.
* eval.c (method_missing): rename from rb_undefined to clarify.
* eval.c (ruby_finalize_0): update exit status if any of END proc
raises SystemExit. [ruby-core:01256]
* eval.c (rb_exec_end_proc): reduce rb_protect().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
-rw-r--r-- | variable.c | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/variable.c b/variable.c index 6aa98035f1..77c1c37240 100644 --- a/variable.c +++ b/variable.c @@ -1116,6 +1116,22 @@ uninitialized_constant(klass, id) } } +static VALUE +const_missing(klass, id) + VALUE klass; + ID id; +{ + return rb_funcall(klass, rb_intern("const_missing"), 1, ID2SYM(id)); +} + +VALUE +rb_mod_const_missing(klass, name) + VALUE klass, name; +{ + uninitialized_constant(klass, rb_to_id(name)); + return Qnil; /* not reached */ +} + static struct st_table * check_autoload_table(av) VALUE av; @@ -1268,8 +1284,7 @@ rb_const_get_at(klass, id) } return value; } - uninitialized_constant(klass, id); - return Qnil; /* not reached */ + return const_missing(klass, id); } static VALUE @@ -1303,8 +1318,7 @@ rb_const_get_0(klass, id, exclude) goto retry; } - uninitialized_constant(klass, id); - return Qnil; /* not reached */ + return const_missing(klass, id); } VALUE @@ -1527,25 +1541,6 @@ rb_const_set(klass, id, val) } void -rb_const_assign(klass, id, val) - VALUE klass; - ID id; - VALUE val; -{ - VALUE tmp = klass; - - while (tmp) { - if (RCLASS(tmp)->iv_tbl && st_lookup(RCLASS(tmp)->iv_tbl,id,0)) { - st_insert(RCLASS(tmp)->iv_tbl, id, val); - return; - } - tmp = RCLASS(tmp)->super; - } - - uninitialized_constant(klass, id); -} - -void rb_define_const(klass, name, val) VALUE klass; const char *name; |