[前][次][番号順一覧][スレッド一覧][生データ]

yarv-diff:418

From: ko1 atdot.net
Date: 30 Dec 2006 08:13:36 +0900
Subject: [yarv-diff:418] r587 - in trunk: . ext/ripper lib lib/rss sample test/ripper yarvtest

Author: ko1
Date: 2006-12-30 08:13:35 +0900 (Sat, 30 Dec 2006)
New Revision: 587

Modified:
   trunk/ChangeLog
   trunk/compile.c
   trunk/eval.c
   trunk/eval_error.h
   trunk/eval_intern.h
   trunk/eval_jump.h
   trunk/eval_method.h
   trunk/eval_safe.h
   trunk/ext/ripper/extconf.rb
   trunk/lib/delegate.rb
   trunk/lib/getoptlong.rb
   trunk/lib/rss/parser.rb
   trunk/sample/test.rb
   trunk/test/ripper/test_files.rb
   trunk/test/ripper/test_parser_events.rb
   trunk/test/ripper/test_scanner_events.rb
   trunk/vm.c
   trunk/vm_dump.c
   trunk/yarvcore.h
   trunk/yarvtest/test_eval.rb
Log:
	* eval_intern.h : reorder tag initialization

	* eval.c : fix to support __send!, funcall and prohibit funcall as
	send

	* eval_error.h, eval_jump.h, eval_safe.h : fix prototypes

	* eval_method.h, vm.c : check re-definition at rb_add_method()

	* yarvcore.h : fix typo

	* compile.c : fix white spaces

	* lib/delegate.rb : fix to support __send, ...

	* lib/getoptlong.rb : fix to work on YARV

	* lib/rss/parser.rb : use __send! instead of __send__

	* sample/test.rb : comment out codes which use |&b| type block parameter

	* ext/ripper/extconf.rb : turn off

	* test/ripper/test_files.rb, test_parser_events.rb,
	test_scanner_events.rb : fix to check it has ripper module

	* vm_dump.c : remove showing file path length limitation

	* yarvtest/test_eval.rb : use __send! instead of __send__



Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-12-19 02:51:12 UTC (rev 586)
+++ trunk/ChangeLog	2006-12-29 23:13:35 UTC (rev 587)
@@ -4,6 +4,39 @@
 #  from Mon, 03 May 2004 01:24:19 +0900
 #
 
+2006-12-30(Sat) 07:59:26 +0900  Koichi Sasada  <ko1 atdot.net>
+
+	* eval_intern.h : reorder tag initialization
+
+	* eval.c : fix to support __send!, funcall and prohibit funcall as
+	send
+
+	* eval_error.h, eval_jump.h, eval_safe.h : fix prototypes
+
+	* eval_method.h, vm.c : check re-definition at rb_add_method()
+
+	* yarvcore.h : fix typo
+
+	* compile.c : fix white spaces
+
+	* lib/delegate.rb : fix to support __send, ...
+
+	* lib/getoptlong.rb : fix to work on YARV
+
+	* lib/rss/parser.rb : use __send! instead of __send__
+
+	* sample/test.rb : comment out codes which use |&b| type block parameter
+
+	* ext/ripper/extconf.rb : turn off
+
+	* test/ripper/test_files.rb, test_parser_events.rb,
+	test_scanner_events.rb : fix to check it has ripper module
+
+	* vm_dump.c : remove showing file path length limitation
+
+	* yarvtest/test_eval.rb : use __send! instead of __send__
+
+
 2006-12-19(Tue) 11:46:08 +0900  Koichi Sasada  <ko1 atdot.net>
 
 	* doc/* : added

Modified: trunk/compile.c
===================================================================
--- trunk/compile.c	2006-12-19 02:51:12 UTC (rev 586)
+++ trunk/compile.c	2006-12-29 23:13:35 UTC (rev 587)
@@ -921,9 +921,9 @@
 {
     DECL_ANCHOR(anc);
     LINK_ELEMENT *elem;
-    
+
     COMPILE_POPED(anc, "set_block_local_tbl#masgn/other", node);
-    
+
     if (nd_type(node) == NODE_ATTRASGN) {
 	INSN *iobj = (INSN *)anc->last->prev;
 	iobj->operands[1] = INT2FIX(FIX2INT(iobj->operands[1]) + 1);
@@ -942,7 +942,7 @@
 	}
     }
     APPEND_LIST(anchor, anc);
-    
+
     return COMPILE_OK;
 }
 
@@ -969,7 +969,7 @@
 	    int i = 0;
 	    if (nargs->nd_head != 0) {
 		NODE *lhsn = massign->nd_head;
-		
+
 		while (lhsn) {
 		    if (nd_type(lhsn->nd_head) != NODE_DASGN_CURR) {
 			/* idx-th param, current level */
@@ -4081,6 +4081,7 @@
       case NODE_BLOCK_PASS:{
 	  /* OK */
 	  COMPILE_ERROR(("BUG: unknown node: NODE_BLOCK_PASS"));
+	  break;
       }
       case NODE_DEFN:{
 	  VALUE iseqval = NEW_ISEQVAL(node->nd_defn,

Modified: trunk/eval.c
===================================================================
--- trunk/eval.c	2006-12-19 02:51:12 UTC (rev 586)
+++ trunk/eval.c	2006-12-29 23:13:35 UTC (rev 587)
@@ -30,7 +30,7 @@
 static ID removed, singleton_removed, undefined, singleton_undefined;
 static ID init, eqq, each, aref, aset, match, missing;
 static ID added, singleton_added;
-static ID __id__, __send__, respond_to;
+static ID object_id, __send, __send_bang, respond_to;
 
 VALUE rb_eLocalJumpError;
 VALUE rb_eSysStackError;
@@ -1399,8 +1399,6 @@
 		      (VALUE)0);
 }
 
-static VALUE cont_protect;
-
 VALUE
 rb_protect(VALUE (*proc) (VALUE), VALUE data, int *state)
 {
@@ -1408,11 +1406,9 @@
     int status;
 
     PUSH_THREAD_TAG();
-    cont_protect = (VALUE)rb_node_newnode(NODE_MEMO, cont_protect, 0, 0);
     if ((status = EXEC_TAG()) == 0) {
 	result = (*proc) (data);
     }
-    cont_protect = ((NODE *) cont_protect)->u1.value;
     POP_THREAD_TAG();
     if (state) {
 	*state = status;
@@ -1591,8 +1587,7 @@
 }
 
 static VALUE
-rb_call(VALUE klass, VALUE recv, ID mid, int argc, const VALUE *argv,
-	int scope)
+rb_call(VALUE klass, VALUE recv, ID mid, int argc, const VALUE *argv, int scope)
 {
     NODE *body, *method;
     int noex;
@@ -1678,6 +1673,20 @@
     return rb_call(CLASS_OF(recv), recv, mid, argc, argv, NOEX_NOSUPER);
 }
 
+static VALUE
+send_funcall(int argc, VALUE *argv, VALUE recv, int scope)
+{
+    VALUE vid;
+
+    if (argc == 0) {
+	rb_raise(rb_eArgError, "no method name given");
+    }
+
+    vid = *argv++; argc--;
+    PASS_PASSED_BLOCK();
+    return rb_call(CLASS_OF(recv), recv, rb_to_id(vid), argc, argv, scope);
+}
+
 /*
  *  call-seq:
  *     obj.send(symbol [, args...])        => obj
@@ -1699,17 +1708,26 @@
 static VALUE
 rb_f_send(int argc, VALUE *argv, VALUE recv)
 {
-    VALUE vid;
+    return send_funcall(argc, argv, recv, NOEX_PUBLIC);
+}
 
-    if (argc == 0) {
-	rb_raise(rb_eArgError, "no method name given");
-    }
+/*
+ *  call-seq:
+ *     obj.funcall(symbol [, args...])        => obj
+ *     obj.__send!(symbol [, args...])        => obj
+ *  
+ *  Invokes the method identified by _symbol_, passing it any
+ *  arguments specified. Unlike send, which calls private methods only
+ *  when it is invoked in function call style, funcall always aware of
+ *  private methods.
+ *     
+ *     1.funcall(:puts, "hello")  # prints "foo"
+ */
 
-    vid = *argv++;
-    argc--;
-    PASS_PASSED_BLOCK();
-    return rb_call(CLASS_OF(recv), recv, rb_to_id(vid), argc, argv,
-		   NOEX_NOSUPER);
+static VALUE
+rb_f_funcall(int argc, VALUE *argv, VALUE recv)
+{
+    return send_funcall(argc, argv, recv, NOEX_NOSUPER | NOEX_PRIVATE);
 }
 
 VALUE
@@ -2836,8 +2854,9 @@
     undefined = rb_intern("method_undefined");
     singleton_undefined = rb_intern("singleton_method_undefined");
 
-    __id__ = rb_intern("__id__");
-    __send__ = rb_intern("__send__");
+    object_id = rb_intern("object_id");
+    __send = rb_intern("__send");
+    __send_bang = rb_intern("__send!");
 
     rb_global_variable((VALUE *)&ruby_eval_tree);
 
@@ -2866,7 +2885,11 @@
     rb_define_method(rb_mKernel, "send", rb_f_send, -1);
     rb_define_method(rb_mKernel, "funcall", rb_f_send, -1); /* temporarily */
     
-    rb_define_method(rb_mKernel, "__send__", rb_f_send, -1);
+    rb_define_method(rb_cBasicObject, "send", rb_f_send, -1);
+    rb_define_method(rb_cBasicObject, "__send__", rb_f_send, -1);
+    rb_define_method(rb_cBasicObject, "__send", rb_f_send, -1);
+    rb_define_method(rb_cBasicObject, "funcall", rb_f_funcall, -1);
+    rb_define_method(rb_cBasicObject, "__send!", rb_f_funcall, -1);
     rb_define_method(rb_mKernel, "instance_eval", rb_obj_instance_eval, -1);
     rb_define_method(rb_mKernel, "instance_exec", rb_obj_instance_exec, -1);
 
@@ -2967,7 +2990,7 @@
 }
 
 int
-rb_scope_base_local_tbl_size()
+rb_scope_base_local_tbl_size(void)
 {
     yarv_thread_t *th = GET_THREAD();
     if (th->base_block) {
@@ -2995,7 +3018,7 @@
 }
 
 int
-rb_dvar_current()
+rb_dvar_current(void)
 {
     yarv_thread_t *th = GET_THREAD();
     if (th->base_block) {

Modified: trunk/eval_error.h
===================================================================
--- trunk/eval_error.h	2006-12-19 02:51:12 UTC (rev 586)
+++ trunk/eval_error.h	2006-12-29 23:13:35 UTC (rev 587)
@@ -176,9 +176,7 @@
 }
 
 void
-print_undef(klass, id)
-    VALUE klass;
-    ID id;
+print_undef(VALUE klass, ID id)
 {
     rb_name_error(id, "undefined method `%s' for %s `%s'",
 		  rb_id2name(id),

Modified: trunk/eval_intern.h
===================================================================
--- trunk/eval_intern.h	2006-12-19 02:51:12 UTC (rev 586)
+++ trunk/eval_intern.h	2006-12-29 23:13:35 UTC (rev 587)
@@ -189,8 +189,8 @@
 #include <sys/stat.h>
 
 #define TH_PUSH_TAG(th) do { \
+  yarv_thread_t * const _th = th; \
   struct yarv_tag _tag; \
-  yarv_thread_t * const _th = th; \
   _tag.tag = 0; \
   _tag.prev = _th->tag; \
   _th->tag = &_tag;

Modified: trunk/eval_jump.h
===================================================================
--- trunk/eval_jump.h	2006-12-19 02:51:12 UTC (rev 586)
+++ trunk/eval_jump.h	2006-12-29 23:13:35 UTC (rev 587)
@@ -49,9 +49,7 @@
 }
 
 void
-rb_throw(tag, val)
-    const char *tag;
-    VALUE val;
+rb_throw(const char *tag, VALUE val)
 {
     VALUE argv[2];
 
@@ -119,17 +117,13 @@
 }
 
 static VALUE
-catch_i(tag)
-    VALUE tag;
+catch_i(VALUE tag)
 {
     return rb_funcall(Qnil, rb_intern("catch"), 1, tag);
 }
 
 VALUE
-rb_catch(tag, func, data)
-    const char *tag;
-    VALUE (*func) ();
-    VALUE data;
+rb_catch(const char *tag, VALUE (*func)(), VALUE data)
 {
     return rb_iterate((VALUE (*)_((VALUE)))catch_i, ID2SYM(rb_intern(tag)),
 		      func, data);
@@ -203,9 +197,7 @@
  */
 
 VALUE
-rb_f_exit(argc, argv)
-    int argc;
-    VALUE *argv;
+rb_f_exit(int argc, VALUE *argv)
 {
     VALUE status;
     int istatus;
@@ -248,9 +240,7 @@
  */
 
 VALUE
-rb_f_abort(argc, argv)
-    int argc;
-    VALUE *argv;
+rb_f_abort(int argc, VALUE *argv)
 {
     rb_secure(4);
     if (argc == 0) {
@@ -302,7 +292,7 @@
  */
 
 static VALUE
-rb_f_at_exit()
+rb_f_at_exit(void)
 {
     VALUE proc;
 
@@ -343,7 +333,7 @@
 }
 
 void
-rb_mark_end_proc()
+rb_mark_end_proc(void)
 {
     struct end_proc_data *link;
 
@@ -365,7 +355,7 @@
 }
 
 void
-rb_exec_end_proc()
+rb_exec_end_proc(void)
 {
     struct end_proc_data *link, *tmp;
     int status;

Modified: trunk/eval_method.h
===================================================================
--- trunk/eval_method.h	2006-12-19 02:51:12 UTC (rev 586)
+++ trunk/eval_method.h	2006-12-29 23:13:35 UTC (rev 587)
@@ -17,7 +17,7 @@
 static int ruby_running = 0;
 
 void
-rb_clear_cache()
+rb_clear_cache(void)
 {
     struct cache_entry *ent, *end;
 
@@ -104,8 +104,7 @@
     }
     if (!FL_TEST(klass, FL_SINGLETON) &&
 	node && nd_type(node) != NODE_ZSUPER &&
-	(mid == rb_intern("initialize")
-	 || mid == rb_intern("initialize_copy"))) {
+	(mid == rb_intern("initialize") || mid == rb_intern("initialize_copy"))) {
 	noex = NOEX_PRIVATE | noex;
     }
     else if (FL_TEST(klass, FL_SINGLETON) && node
@@ -139,13 +138,31 @@
     }
 
     {
+	/* check re-definition */
 	NODE *old_node;
+
 	if (st_lookup(RCLASS(klass)->m_tbl, mid, (st_data_t *)&old_node)) {
-	    if (old_node && nd_type(old_node->nd_body->nd_body) == NODE_CFUNC) {
-		yarv_check_redefinition_opt_method(old_node);
+	    if (old_node) {
+		if (nd_type(old_node->nd_body->nd_body) == NODE_CFUNC) {
+		    yarv_check_redefinition_opt_method(old_node);
+		}
 	    }
+	    if (klass == rb_cObject && node->nd_mid == init) {
+		rb_warn("redefining Object#initialize may cause infinite loop");
+	    }
+	    if (RTEST(ruby_verbose) && old_node->nd_cnt == 0 && old_node->nd_body) {
+		rb_warning("method redefined; discarding old %s", rb_id2name(mid));
+	    }
 	}
+
+	if (mid == object_id || mid == __send || mid == __send_bang) {
+	    if (node && nd_type(node) == YARV_METHOD_NODE) {
+		rb_warn("redefining `%s' may cause serious problem",
+			rb_id2name(mid));
+	    }
+	}
     }
+
     st_insert(RCLASS(klass)->m_tbl, mid, (st_data_t) body);
 
     if (node && mid != ID_ALLOCATOR && ruby_running) {
@@ -268,7 +285,7 @@
     }
     if (OBJ_FROZEN(klass))
 	rb_error_frozen("class/module");
-    if (mid == __id__ || mid == __send__ || mid == init) {
+    if (mid == object_id || mid == __send || mid == __send_bang || mid == init) {
 	rb_warn("removing `%s' may cause serious problem", rb_id2name(mid));
     }
     if (!st_delete(RCLASS(klass)->m_tbl, &mid, (st_data_t *) & body) ||
@@ -426,7 +443,7 @@
 		 rb_id2name(id));
     }
     rb_frozen_class_p(klass);
-    if (id == __id__ || id == __send__ || id == init) {
+    if (id == object_id || id == __send || id == __send_bang || id == init) {
 	rb_warn("undefining `%s' may cause serious problem", rb_id2name(id));
     }
     body = search_method(klass, id, &origin);

Modified: trunk/eval_safe.h
===================================================================
--- trunk/eval_safe.h	2006-12-19 02:51:12 UTC (rev 586)
+++ trunk/eval_safe.h	2006-12-29 23:13:35 UTC (rev 587)
@@ -11,7 +11,7 @@
 */
 
 int
-rb_safe_level()
+rb_safe_level(void)
 {
     return GET_THREAD()->safe_level;
 }

Modified: trunk/ext/ripper/extconf.rb
===================================================================
--- trunk/ext/ripper/extconf.rb	2006-12-19 02:51:12 UTC (rev 586)
+++ trunk/ext/ripper/extconf.rb	2006-12-29 23:13:35 UTC (rev 587)
@@ -4,6 +4,9 @@
 require 'rbconfig'
 
 def main
+  Logging.message "YARV doesn't support Ripper"
+  return
+
   unless find_executable('bison')
     unless File.exist?('ripper.c') or File.exist?("#{$srcdir}/ripper.c")
       Logging.message 'missing bison; abort'

Modified: trunk/lib/delegate.rb
===================================================================
--- trunk/lib/delegate.rb	2006-12-19 02:51:12 UTC (rev 586)
+++ trunk/lib/delegate.rb	2006-12-29 23:13:35 UTC (rev 587)
@@ -115,46 +115,46 @@
 # implementation, see SimpleDelegator.
 #
 class Delegator
-  preserved = ["__id__", "object_id", "__send__", "respond_to?", "send", "funcall"]
+  preserved = ["__id__", "object_id", "__send__", "__send", "__send!", "respond_to?", "send", "funcall"]
   instance_methods.each do |m|
     next if preserved.include?(m)
     undef_method m
   end
 
   module MethodDelegation
-  #
-  # Pass in the _obj_ to delegate method calls to.  All methods supported by
-  # _obj_ will be delegated to.
-  #
-  def initialize(obj)
-    __setobj__(obj)
-  end
+    #
+    # Pass in the _obj_ to delegate method calls to.  All methods supported by
+    # _obj_ will be delegated to.
+    #
+    def initialize(obj)
+      __setobj__(obj)
+    end
 
-  # Handles the magic of delegation through \_\_getobj\_\_.
+    # Handles the magic of delegation through \_\_getobj\_\_.
     def method_missing(m, *args, &block)
-    begin
-      target = self.__getobj__
-      unless target.respond_to?(m)
+      begin
+        target = self.__getobj__
+        unless target.respond_to?(m)
           super(m, *args, &block)
         else
-          target.__send__(m, *args, &block)
+          target.__send(m, *args, &block)
+        end
+      rescue Exception
+        $@.delete_if{|s| /^#{__FILE__}:\d+:in `method_missing'$/ =~ s} #`
+        ::Kernel::raise
       end
-    rescue Exception
-      $@.delete_if{|s| /^#{__FILE__}:\d+:in `method_missing'$/ =~ s} #`
-      ::Kernel::raise
     end
-  end
 
-  # 
-  # Checks for a method provided by this the delegate object by fowarding the 
-  # call through \_\_getobj\_\_.
-  # 
-  def respond_to?(m)
-    return true if super
-    return self.__getobj__.respond_to?(m)
-  end
+    # 
+    # Checks for a method provided by this the delegate object by fowarding the 
+    # call through \_\_getobj\_\_.
+    # 
+    def respond_to?(m)
+      return true if super
+      return self.__getobj__.respond_to?(m)
+    end
 
-  #
+    # 
     # Returns true if two objects are considered same.
     # 
     def ==(obj)
@@ -170,29 +170,29 @@
     end
 
     #
-  # This method must be overridden by subclasses and should return the object
-  # method calls are being delegated to.
-  #
-  def __getobj__
-    raise NotImplementedError, "need to define `__getobj__'"
-  end
+    # This method must be overridden by subclasses and should return the object
+    # method calls are being delegated to.
+    #
+    def __getobj__
+      raise NotImplementedError, "need to define `__getobj__'"
+    end
 
-  #
-  # This method must be overridden by subclasses and change the object delegate
-  # to _obj_.
-  #
-  def __setobj__(obj)
-    raise NotImplementedError, "need to define `__setobj__'"
-  end
+    #
+    # This method must be overridden by subclasses and change the object delegate
+    # to _obj_.
+    #
+    def __setobj__(obj)
+      raise NotImplementedError, "need to define `__setobj__'"
+    end
 
-  # Serialization support for the object returned by \_\_getobj\_\_.
-  def marshal_dump
-    __getobj__
-  end
-  # Reinitializes delegation from a serialized object.
-  def marshal_load(obj)
-    __setobj__(obj)
-  end
+    # Serialization support for the object returned by \_\_getobj\_\_.
+    def marshal_dump
+      __getobj__
+    end
+    # Reinitializes delegation from a serialized object.
+    def marshal_load(obj)
+      __setobj__(obj)
+    end
 
     # Clone support for the object returned by \_\_getobj\_\_.
     def clone
@@ -262,10 +262,9 @@
   klass = Class.new
   methods = superclass.public_instance_methods(true)
   methods -= [
-    "send", "funcall",
-    "__id__", "object_id", "__send__", "respond_to?", "==", "equal?",
-    "initialize", "method_missing", "__getobj__", "__setobj__",
-    "clone", "dup", "marshal_dump", "marshal_load",
+    :__id__, :object_id, :__send__, :__send, :__send!, :respond_to?, :send, :funcall,
+    :==, :equal?, :initialize, :method_missing, :__getobj__, :__setobj__,
+    :clone, :dup, :marshal_dump, :marshal_load,
   ]
   klass.module_eval {
     include Delegator::MethodDelegation
@@ -282,7 +281,7 @@
       klass.module_eval <<-EOS, __FILE__, __LINE__+1
         def #{method}(*args, &block)
 	  begin
-	    @_dc_obj.__send__(:#{method}, *args, &block)
+	    @_dc_obj.__send(:#{method}, *args, &block)
 	  rescue
 	    $@[0,2] = nil
 	    raise

Modified: trunk/lib/getoptlong.rb
===================================================================
--- trunk/lib/getoptlong.rb	2006-12-19 02:51:12 UTC (rev 586)
+++ trunk/lib/getoptlong.rb	2006-12-29 23:13:35 UTC (rev 587)
@@ -290,6 +290,7 @@
     @argument_flags.clear
 
     arguments.each do |*arg|
+      arg = arg.first # TODO: YARV Hack
       #
       # Find an argument flag and it set to `argument_flag'.
       #
@@ -302,6 +303,7 @@
 	  argument_flag = i
 	end
       end
+
       raise ArgumentError, "no argument-flag" if argument_flag == nil
 
       canonical_name = nil

Modified: trunk/lib/rss/parser.rb
===================================================================
--- trunk/lib/rss/parser.rb	2006-12-19 02:51:12 UTC (rev 586)
+++ trunk/lib/rss/parser.rb	2006-12-29 23:13:35 UTC (rev 587)
@@ -247,7 +247,7 @@
             end
           end
           EOT
-          __send__("private", "start_#{name}")
+          __send!("private", "start_#{name}")
         end
       end
 

Modified: trunk/sample/test.rb
===================================================================
--- trunk/sample/test.rb	2006-12-19 02:51:12 UTC (rev 586)
+++ trunk/sample/test.rb	2006-12-29 23:13:35 UTC (rev 587)
@@ -1074,8 +1074,8 @@
 test_ok(Proc.new{|a,| a}.yield(1,2,3) == 1)
 call_argument_test(true, Proc.new{|a,|}, 1,2)
 
-test_ok(Proc.new{|&b| b.call(10)}.call {|x| x} == 10)
-test_ok(Proc.new{|a,&b| b.call(a)}.call(12) {|x| x} == 12)
+#! test_ok(Proc.new{|&b| b.call(10)}.call {|x| x} == 10)
+#! test_ok(Proc.new{|a,&b| b.call(a)}.call(12) {|x| x} == 12)
 
 def test_return1
   Proc.new {
@@ -1101,7 +1101,8 @@
 end
 test_ok(proc_return1() == 43)
 def proc_return2
-  ->{return 42}.call+1
+  #! ->{return 42}.call+1
+  lambda{return 42}.call+1
 end
 test_ok(proc_return2() == 43)
 def proc_return3

Modified: trunk/test/ripper/test_files.rb
===================================================================
--- trunk/test/ripper/test_files.rb	2006-12-19 02:51:12 UTC (rev 586)
+++ trunk/test/ripper/test_files.rb	2006-12-29 23:13:35 UTC (rev 587)
@@ -1,3 +1,5 @@
+begin
+
 require 'ripper'
 require 'find'
 require 'test/unit'
@@ -17,3 +19,7 @@
     }
   end
 end
+
+rescue LoadError
+end
+  
\ No newline at end of file

Modified: trunk/test/ripper/test_parser_events.rb
===================================================================
--- trunk/test/ripper/test_parser_events.rb	2006-12-19 02:51:12 UTC (rev 586)
+++ trunk/test/ripper/test_parser_events.rb	2006-12-29 23:13:35 UTC (rev 587)
@@ -1,3 +1,5 @@
+begin
+
 require 'dummyparser'
 require 'test/unit'
 
@@ -491,3 +493,6 @@
 =end
 
 end
+
+rescue LoadError
+end
\ No newline at end of file

Modified: trunk/test/ripper/test_scanner_events.rb
===================================================================
--- trunk/test/ripper/test_scanner_events.rb	2006-12-19 02:51:12 UTC (rev 586)
+++ trunk/test/ripper/test_scanner_events.rb	2006-12-29 23:13:35 UTC (rev 587)
@@ -1,6 +1,7 @@
 #
 # test_scanner_events.rb
 #
+begin
 
 require 'ripper'
 require 'test/unit'
@@ -801,3 +802,6 @@
   end
 
 end
+
+rescue LoadError
+end

Modified: trunk/vm.c
===================================================================
--- trunk/vm.c	2006-12-19 02:51:12 UTC (rev 586)
+++ trunk/vm.c	2006-12-29 23:13:35 UTC (rev 587)
@@ -1167,21 +1167,13 @@
 		     "can't define singleton method \"%s\" for %s",
 		     rb_id2name(id), rb_obj_classname(obj));
 	}
+
 	if (OBJ_FROZEN(obj)) {
 	    rb_error_frozen("object");
 	}
 
 	klass = rb_singleton_class(obj);
 	noex = NOEX_PUBLIC;
-
-	if (st_lookup(RCLASS(klass)->m_tbl, id, (void *)&newbody)) {
-	    if (rb_safe_level() >= 4) {
-		rb_raise(rb_eSecurityError, "redefining method prohibited");
-	    }
-	    if (RTEST(ruby_verbose)) {
-		rb_warning("redefine %s", rb_id2name(id));
-	    }
-	}
     }
 
     /* dup */

Modified: trunk/vm_dump.c
===================================================================
--- trunk/vm_dump.c	2006-12-19 02:51:12 UTC (rev 586)
+++ trunk/vm_dump.c	2006-12-29 23:13:35 UTC (rev 587)
@@ -16,6 +16,8 @@
 #include "yarvcore.h"
 #include "vm.h"
 
+#define MAX_POSBUF 128
+
 static void
 control_frame_dump(yarv_thread_t *th, yarv_control_frame_t *cfp)
 {
@@ -23,7 +25,7 @@
     unsigned int lfp = cfp->lfp - th->stack;
     unsigned int dfp = cfp->dfp - th->stack;
     char lfp_in_heap = ' ', dfp_in_heap = ' ';
-    char posbuf[30];
+    char posbuf[MAX_POSBUF+1];
 
     const char *magic, *iseq_name = "-", *selfstr = "-", *biseq_name = "-";
     VALUE tmp;
@@ -100,15 +102,15 @@
 	    iseq_name = RSTRING_PTR(cfp->iseq->name);
 	    line = th_get_sourceline(cfp);
 	    if (line) {
-		char fn[23];
-		snprintf(fn, 22, "%s", RSTRING_PTR(cfp->iseq->file_name));
-		snprintf(posbuf, 27, "%s:%d", fn, line);
+		char fn[MAX_POSBUF+1];
+		snprintf(fn, MAX_POSBUF, "%s", RSTRING_PTR(cfp->iseq->file_name));
+		snprintf(posbuf, MAX_POSBUF, "%s:%d", fn, line);
 	    }
 	}
     }
     else if (cfp->method_id) {
 	iseq_name = rb_id2name(cfp->method_id);
-	snprintf(posbuf, 23, ":%s", rb_id2name(cfp->method_id));
+	snprintf(posbuf, MAX_POSBUF, ":%s", rb_id2name(cfp->method_id));
 	line = -1;
     }
 

Modified: trunk/yarvcore.h
===================================================================
--- trunk/yarvcore.h	2006-12-19 02:51:12 UTC (rev 586)
+++ trunk/yarvcore.h	2006-12-29 23:13:35 UTC (rev 587)
@@ -443,7 +443,7 @@
 
     int parse_in_eval;
 
-    /* strage */
+    /* storage */
     st_table *local_storage;
 #if USE_VALUE_CACHE
     VALUE value_cache[YARV_VALUE_CACHE_SIZE + 1];

Modified: trunk/yarvtest/test_eval.rb
===================================================================
--- trunk/yarvtest/test_eval.rb	2006-12-19 02:51:12 UTC (rev 586)
+++ trunk/yarvtest/test_eval.rb	2006-12-29 23:13:35 UTC (rev 587)
@@ -16,12 +16,12 @@
 
   def test_eval_with_send
     ae %q{
-      __send__ :eval, %{
+      __send! :eval, %{
         :ok
       }
     }
     ae %q{
-      1.__send__ :instance_eval, %{
+      1.__send! :instance_eval, %{
         :ok
       }
     }


--
ML: yarv-diff quickml.atdot.net
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧][生データ]