mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
f2b0dba1cf
commit
c5851d1d69
2 changed files with 9 additions and 25 deletions
|
@ -91,6 +91,11 @@ Fri Dec 14 12:36:35 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|||
* ext/readline/extconf.rb: should use have_func for functions instead
|
||||
of have_var.
|
||||
|
||||
Fri Dec 14 10:25:56 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* lib/e2mmap.rb (Exception2MessageMapper::E2MM.Raise): $! no
|
||||
longer modifiable in 1.9.
|
||||
|
||||
Fri Dec 14 08:17:24 2007 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* eval.c (rb_protect): restore root_jmpbuf even if proc exits by
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue