[前][次][番号順一覧][スレッド一覧]

ruby-changes:2746

From: ko1@a...
Date: 15 Dec 2007 15:08:50 +0900
Subject: [ruby-changes:2746] matz - Ruby:r14237 (trunk): * lib/e2mmap.rb (Exception2MessageMapper::E2MM.Raise): $! no

matz	2007-12-15 15:03:22 +0900 (Sat, 15 Dec 2007)

  New Revision: 14237

  Modified files:
    trunk/ChangeLog
    trunk/lib/e2mmap.rb

  Log:
    * lib/e2mmap.rb (Exception2MessageMapper::E2MM.Raise): $! no
      longer modifiable in 1.9.

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14237&r2=14236
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/e2mmap.rb?r1=14237&r2=14236

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 14236)
+++ ChangeLog	(revision 14237)
@@ -91,6 +91,11 @@
 	* ext/readline/extconf.rb: should use have_func for functions instead
 	  of have_var.
 
+Fri Dec 14 10:25:56 2007  Yukihiro Matsumoto  <matz@r...>
+
+	* lib/e2mmap.rb (Exception2MessageMapper::E2MM.Raise): $! no
+	  longer modifiable in 1.9. 
+
 Fri Dec 14 08:17:24 2007  Tanaka Akira  <akr@f...>
 
 	* eval.c (rb_protect): restore root_jmpbuf even if proc exits by
Index: lib/e2mmap.rb
===================================================================
--- lib/e2mmap.rb	(revision 14236)
+++ lib/e2mmap.rb	(revision 14237)
@@ -55,15 +55,9 @@
 
   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 @@
   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 @@
   #
   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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧]