diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-12-16 07:36:14 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-12-16 07:36:14 +0000 |
commit | ecaa1d3508b518cbdda5bd1250e709fa58c3a794 (patch) | |
tree | 712be48169e34575d0534bc23bb25685a8c0ad0f /variable.c | |
parent | 19c542ae021e9625b42123ee01c088c452996a44 (diff) |
* dir.c (dir_set_pos): Dir#pos= should return the new position.
* variable.c (generic_ivar_get): should always warn for
uninitialized instance variables.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@3157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
-rw-r--r-- | variable.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/variable.c b/variable.c index 95c03cd3fc..34789f479c 100644 --- a/variable.c +++ b/variable.c @@ -782,11 +782,15 @@ generic_ivar_get(obj, id) st_table *tbl; VALUE val; - if (!generic_iv_tbl) return Qnil; - if (!st_lookup(generic_iv_tbl, obj, &tbl)) return Qnil; - if (st_lookup(tbl, id, &val)) { - return val; + if (generic_iv_tbl) { + if (st_lookup(generic_iv_tbl, obj, &tbl)) { + if (st_lookup(tbl, id, &val)) { + return val; + } + } } + + rb_warning("instance variable %s not initialized", rb_id2name(id)); return Qnil; } |