diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-07-26 06:12:39 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-07-26 06:12:39 +0000 |
commit | 7194b66fb24db63dc2a23d3141ce25ad85d89777 (patch) | |
tree | 6e4a442522711c87eb3fc61bf81efc90af356394 /eval.c | |
parent | 1d132e648dff057f0a5b42ddbc3704e7816213fc (diff) |
* random.c: replace with Mersenne Twister RNG.
* eval.c (jump_tag_but_local_jump): preserve retval in
LocalJumpError exceptions.
* parse.y (command): no more check for "super outside of method".
* eval.c (rb_mod_define_method): should set last_class and
last_func in the block->frame.
* eval.c (error_handle): should handle TAG_THROW as well.
* parse.y (yylex): new decimal notation '0d4567'.
* parse.y (yylex): new octal notation '0o777'.
* parse.y (string_content): every string_content node should
return string only. use NODE_EVSTR to coercing.
* eval.c (rb_eval): NODE_EVSTR support.
* re.c (rb_reg_quote): avoid unnecessary string allocation.
* string.c (get_pat): quote metachracters before compiling a
string into a regex.
* string.c (rb_str_split_m): special treatment of strings of size
1, but AWK emulation. now uses get_pat().
* string.c (rb_str_match_m): quote metacharacters.
* string.c (rb_str_match2): ditto.
* ext/socket/socket.c (sock_addrinfo): make all 3 versions of
getaddrinfo happy. [ruby-core:00184]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 32 |
1 files changed, 28 insertions, 4 deletions
@@ -1141,6 +1141,17 @@ error_handle(ex) fprintf(stderr, ": retry outside of rescue clause\n"); ex = 1; break; + case TAG_THROW: + if (prot_tag && prot_tag->frame && prot_tag->frame->file) { + fprintf(stderr, "%s:%d: uncaught throw\n", + prot_tag->frame->file, prot_tag->frame->line); + } + else { + error_pos(); + fprintf(stderr, ": unexpected throw\n"); + } + ex = 1; + break; case TAG_RAISE: case TAG_FATAL: if (rb_obj_is_kind_of(ruby_errinfo, rb_eSystemExit)) { @@ -1354,17 +1365,21 @@ static void jump_tag_but_local_jump(state) int state; { + VALUE val; + + if (prot_tag) val = prot_tag->retval; + else val = Qnil; switch (state) { case 0: break; case TAG_RETURN: - localjump_error("unexpected return", Qnil); + localjump_error("unexpected return", val); break; case TAG_NEXT: - localjump_error("unexpected next", Qnil); + localjump_error("unexpected next", val); break; case TAG_BREAK: - localjump_error("unexpected break", Qnil); + localjump_error("unexpected break", val); break; case TAG_REDO: localjump_error("unexpected redo", Qnil); @@ -1412,7 +1427,6 @@ rb_eval_cmd(cmd, arg, tcheck) if ((state = EXEC_TAG()) == 0) { val = eval(ruby_top_self, cmd, Qnil, 0, 0); } - if (ruby_scope->flags & SCOPE_DONT_RECYCLE) scope_dup(saved_scope); ruby_scope = saved_scope; @@ -3059,6 +3073,10 @@ rb_eval(self, n) result = rb_str_new3(node->nd_lit); break; + case NODE_EVSTR: + result = rb_obj_as_string(rb_eval(self, node->nd_body)); + break; + case NODE_DSTR: case NODE_DXSTR: case NODE_DREGX: @@ -7102,6 +7120,12 @@ rb_mod_define_method(argc, argv, mod) node = NEW_DMETHOD(method_unbind(body)); } else if (RDATA(body)->dmark == (RUBY_DATA_FUNC)blk_mark) { + struct BLOCK *block; + + body = bind_clone(body); + Data_Get_Struct(body, struct BLOCK, block); + block->frame.last_func = id; + block->frame.last_class = mod; node = NEW_BMETHOD(body); } else { |