From c5851d1d6906e130bbb156d9ace962c59c8b0086 Mon Sep 17 00:00:00 2001 From: matz Date: Sat, 15 Dec 2007 06:03:22 +0000 Subject: * lib/e2mmap.rb (Exception2MessageMapper::E2MM.Raise): $! no longer modifiable in 1.9. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/e2mmap.rb | 29 ++++------------------------- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8ae8bd5fb0..3ccc556543 100644 --- a/ChangeLog +++ b/ChangeLog @@ -91,6 +91,11 @@ Fri Dec 14 12:36:35 2007 Nobuyoshi Nakada * ext/readline/extconf.rb: should use have_func for functions instead of have_var. +Fri Dec 14 10:25:56 2007 Yukihiro Matsumoto + + * lib/e2mmap.rb (Exception2MessageMapper::E2MM.Raise): $! no + longer modifiable in 1.9. + Fri Dec 14 08:17:24 2007 Tanaka Akira * eval.c (rb_protect): restore root_jmpbuf even if proc exits by diff --git a/lib/e2mmap.rb b/lib/e2mmap.rb index 00d4f83eb8..7d935b4c1f 100644 --- a/lib/e2mmap.rb +++ b/lib/e2mmap.rb @@ -55,15 +55,9 @@ module Exception2MessageMapper def E2MM.extend_object(cl) super - cl.bind(self) unless cl == E2MM + cl.bind(self) unless cl < E2MM end - # backward compatibility - def E2MM.extend_to(b) - c = eval("self", b) - c.extend(self) - end - def bind(cl) self.module_eval %[ def Raise(err = nil, *rest) @@ -86,20 +80,6 @@ module Exception2MessageMapper end alias Fail Raise - # backward compatibility - alias fail! fail - def fail(err = nil, *rest) - begin - E2MM.Fail(self, err, *rest) - rescue E2MM::ErrNotRegisteredException - super - end - end - class << self - public :fail - end - - # def_e2message(c, m) # c: exception # m: message_form @@ -157,12 +137,11 @@ module Exception2MessageMapper # def E2MM.Raise(klass = E2MM, err = nil, *rest) if form = e2mm_message(klass, err) - $! = err.new(sprintf(form, *rest)) - $@ = caller(1) if $@.nil? + b = $@.nil? ? caller(1) : $@ #p $@ #p __FILE__ - $@.shift if $@[0] =~ /^#{Regexp.quote(__FILE__)}:/ - raise + b.shift if b[0] =~ /^#{Regexp.quote(__FILE__)}:/ + raise err, sprintf(form, *rest), b else E2MM.Fail E2MM, ErrNotRegisteredException, err.inspect end -- cgit v1.2.3