diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-09-01 09:48:03 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-09-01 09:48:03 +0000 |
commit | 69a3aaf154948d653fa3653cd2b3c3b3af979769 (patch) | |
tree | f83116ebca291337b9948831c617217c18f6a317 /eval.c | |
parent | a1b57d0add85a248666fb55c58aa8c0c772136fc (diff) | |
download | ruby-69a3aaf154948d653fa3653cd2b3c3b3af979769.tar.gz |
regexp literal (e.g. \202) match, etc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 28 |
1 files changed, 25 insertions, 3 deletions
@@ -168,10 +168,17 @@ rb_get_method_body(klassp, idp, noexp) NODE * volatile body; struct cache_entry *ent; - if ((body = search_method(klass, id, &origin)) == 0) { + if ((body = search_method(klass, id, &origin)) == 0 || !body->nd_body) { + /* store in cache */ + ent = cache + EXPR1(klass, id); + ent->klass = klass; + ent->origin = klass; + ent->mid = ent->mid0 = id; + ent->noex = 0; + ent->method = 0; + return 0; } - if (!body->nd_body) return 0; /* store in cache */ ent = cache + EXPR1(klass, id); @@ -327,8 +334,17 @@ rb_method_boundp(klass, id, ex) ID id; int ex; { + struct cache_entry *ent; int noex; + /* is it in the method cache? */ + ent = cache + EXPR1(klass, id); + if (ent->mid == id && ent->klass == klass) { + if (ex && (ent->noex & NOEX_PRIVATE)) + return Qfalse; + if (!ent->method) return Qfalse; + return Qtrue; + } if (rb_get_method_body(&klass, &id, &noex)) { if (ex && (noex & NOEX_PRIVATE)) return Qfalse; @@ -2140,8 +2156,12 @@ rb_eval(self, node) case NODE_RETURN: if (node->nd_stts) { - return_value(rb_eval(self, node->nd_stts)); + return_value(rb_eval(self, node->nd_stts)); + } + else { + return_value(Qnil); } + return_value(rb_eval(self, node->nd_stts)); return_check(); JUMP_TAG(TAG_RETURN); break; @@ -3976,6 +3996,8 @@ rb_call(klass, recv, mid, argc, argv, scope) /* is it in the method cache? */ ent = cache + EXPR1(klass, mid); if (ent->mid == mid && ent->klass == klass) { + if (!ent->method) + return rb_undefined(recv, mid, argc, argv, scope==2?CSTAT_VCALL:0); klass = ent->origin; id = ent->mid0; noex = ent->noex; |