summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-09-16 09:40:33 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-09-16 09:40:33 +0000
commit9e3d9a2a009d2a0281802a84e1c5cc1c887edc71 (patch)
treeea994af7deeef43977f60a9ab26131e8cd90a9a0 /eval.c
parent69a3aaf154948d653fa3653cd2b3c3b3af979769 (diff)
1.4.1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/eval.c b/eval.c
index 579b3c54ae..98ae96c684 100644
--- a/eval.c
+++ b/eval.c
@@ -169,7 +169,7 @@ rb_get_method_body(klassp, idp, noexp)
struct cache_entry *ent;
if ((body = search_method(klass, id, &origin)) == 0 || !body->nd_body) {
- /* store in cache */
+ /* store empty info in cache */
ent = cache + EXPR1(klass, id);
ent->klass = klass;
ent->origin = klass;
@@ -1795,11 +1795,31 @@ rb_eval(self, node)
}
break;
- /* nodes for speed-up(top-level loop for -n/-p) */
+ /* node for speed-up(top-level loop for -n/-p) */
case NODE_OPT_N:
- while (!NIL_P(rb_gets())) {
- rb_eval(self, node->nd_body);
+ PUSH_TAG(PROT_NONE);
+ switch (state = EXEC_TAG()) {
+ case 0:
+ opt_n_next:
+ while (!NIL_P(rb_gets())) {
+ opt_n_redo:
+ rb_eval(self, node->nd_body);
+ }
+ break;
+
+ case TAG_REDO:
+ state = 0;
+ goto opt_n_redo;
+ case TAG_NEXT:
+ state = 0;
+ goto opt_n_next;
+ case TAG_BREAK:
+ state = 0;
+ default:
+ break;
}
+ POP_TAG();
+ if (state) JUMP_TAG(state);
RETURN(Qnil);
case NODE_SELF:
@@ -2371,10 +2391,8 @@ rb_eval(self, node)
/* check for static scope constants */
if (RTEST(ruby_verbose) &&
ev_const_defined((NODE*)ruby_frame->cbase, node->nd_vid)) {
- if (RTEST(ruby_verbose)) {
- rb_warning("already initialized constant %s",
- rb_id2name(node->nd_vid));
- }
+ rb_warn("already initialized constant %s",
+ rb_id2name(node->nd_vid));
}
rb_const_set(ruby_class, node->nd_vid, result);
break;