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

ruby-changes:2534

From: ko1@a...
Date: 27 Nov 2007 10:03:02 +0900
Subject: [ruby-changes:2534] ko1 - Ruby:r14025 (trunk): * insns.def, compile.c: fix to allow dsym for alias/undef.

ko1	2007-11-27 10:02:30 +0900 (Tue, 27 Nov 2007)

  New Revision: 14025

  Modified files:
    trunk/ChangeLog
    trunk/bootstraptest/test_method.rb
    trunk/compile.c
    trunk/insns.def
    trunk/version.h

  Log:
    * insns.def, compile.c: fix to allow dsym for alias/undef.
      [ruby-dev:32355]
    * bootstraptest/test_method.rb: add tests for above.
    


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/version.h?r1=14025&r2=14024
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/compile.c?r1=14025&r2=14024
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14025&r2=14024
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/bootstraptest/test_method.rb?r1=14025&r2=14024
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/insns.def?r1=14025&r2=14024

Index: insns.def
===================================================================
--- insns.def	(revision 14024)
+++ insns.def	(revision 14025)
@@ -751,18 +751,18 @@
  */
 DEFINE_INSN
 alias
-(VALUE v_p, ID id1, ID id2)
+(VALUE v_p)
+(VALUE sym1, VALUE sym2)
 ()
-()
 {
     VALUE klass;
 
     if (v_p == Qtrue) {
-	rb_alias_variable(id1, id2);
+	rb_alias_variable(ID2SYM(sym1), SYM2ID(sym2));
     }
     else {
 	klass = get_cref(GET_ISEQ(), GET_LFP())->nd_clss;
-	rb_alias(klass, id1, id2);
+	rb_alias(klass, SYM2ID(sym1), SYM2ID(sym2));
     }
 }
 
@@ -773,12 +773,12 @@
  */
 DEFINE_INSN
 undef
-(ID id)
 ()
+(VALUE sym)
 ()
 {
     VALUE klass = get_cref(GET_ISEQ(), GET_LFP())->nd_clss;
-    rb_undef(klass, id);
+    rb_undef(klass, SYM2ID(sym));
     INC_VM_STATE_VERSION();
 }
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 14024)
+++ ChangeLog	(revision 14025)
@@ -1,3 +1,10 @@
+Tue Nov 27 09:57:42 2007  Koichi Sasada  <ko1@a...>
+
+	* insns.def, compile.c: fix to allow dsym for alias/undef.
+	  [ruby-dev:32355]
+
+	* bootstraptest/test_method.rb: add tests for above.
+
 Mon Nov 26 23:18:46 2007  Masatoshi SEKI  <m_seki@m...>
 
 	* lib/drb/extserv.rb (initialize, stop_service): synchronize with
Index: bootstraptest/test_method.rb
===================================================================
--- bootstraptest/test_method.rb	(revision 14024)
+++ bootstraptest/test_method.rb	(revision 14025)
@@ -230,6 +230,28 @@
                             end
                             begin B.new.b; rescue NoMethodError; 1 end )
 
+assert_equal '3',  %q{
+  def m1
+    1
+  end
+  alias m2 m1
+  alias :"#{'m3'}" m1
+  m1 + m2 + m3
+}, '[ruby-dev:32308]'
+assert_equal '1', %q{
+  def foobar
+  end
+  undef :"foo#{:bar}"
+  1
+}, '[ruby-dev:32308]'
+assert_equal '1', %q{
+  def foobar
+    1
+  end
+  alias :"bar#{:baz}" :"foo#{:bar}"
+  barbaz
+}, '[ruby-dev:32308]'
+
 # private
 assert_equal '1',       %q( class C
                               def m() mm() end
Index: compile.c
===================================================================
--- compile.c	(revision 14024)
+++ compile.c	(revision 14025)
@@ -4063,42 +4063,37 @@
 	break;
       }
       case NODE_ALIAS:{
-	VALUE s1, s2;
-	enum node_type t;
+	  VALUE s1, s2;
+	  enum node_type t;
 
-	if (((t = nd_type(node->u1.node)) != NODE_LIT && t != NODE_DSYM) ||
-	    ((t = nd_type(node->u2.node)) != NODE_LIT && t != NODE_DSYM)) {
-	    rb_compile_bug(ERROR_ARGS "alias args must be NODE_LIT or NODE_DSYM");
-	}
-	s1 = node->u1.node->nd_lit;
-	s2 = node->u2.node->nd_lit;
+	  COMPILE(ret, "alias arg1", node->u1.node);
+	  COMPILE(ret, "alias arg2", node->u2.node);
 
-	ADD_INSN3(ret, nd_line(node), alias, Qfalse, ID2SYM(rb_to_id(s1)),
-		  ID2SYM(rb_to_id(s2)));
-	if (!poped) {
-	    ADD_INSN(ret, nd_line(node), putnil);
-	}
-	break;
+	  ADD_INSN1(ret, nd_line(node), alias, Qfalse);
+
+	  if (!poped) {
+	      ADD_INSN(ret, nd_line(node), putnil);
+	  }
+	  break;
       }
       case NODE_VALIAS:{
-	ADD_INSN3(ret, nd_line(node), alias, Qtrue, ID2SYM(node->u1.id),
-		  ID2SYM(node->u2.id));
-	if (!poped) {
-	    ADD_INSN(ret, nd_line(node), putnil);
-	}
-	break;
+	  ADD_INSN1(ret, nd_line(node), putobject, ID2SYM(node->u1.id));
+	  ADD_INSN1(ret, nd_line(node), putobject, ID2SYM(node->u2.id));
+	  ADD_INSN1(ret, nd_line(node), alias, Qtrue);
+
+	  if (!poped) {
+	      ADD_INSN(ret, nd_line(node), putnil);
+	  }
+	  break;
       }
       case NODE_UNDEF:{
-	enum node_type t = nd_type(node->u2.node);
-	if (t != NODE_LIT && t != NODE_DSYM) {
-	    rb_compile_bug(ERROR_ARGS "undef args must be NODE_LIT");
-	}
-	ADD_INSN1(ret, nd_line(node), undef,
-		  ID2SYM(rb_to_id(node->u2.node->nd_lit)));
-	if (!poped) {
-	    ADD_INSN(ret, nd_line(node), putnil);
-	}
-	break;
+	  COMPILE(ret, "undef arg", node->u2.node);
+	  ADD_INSN(ret, nd_line(node), undef);
+
+	  if (!poped) {
+	      ADD_INSN(ret, nd_line(node), putnil);
+	  }
+	  break;
       }
       case NODE_CLASS:{
 	VALUE iseqval =
Index: version.h
===================================================================
--- version.h	(revision 14024)
+++ version.h	(revision 14025)
@@ -1,7 +1,7 @@
 #define RUBY_VERSION "1.9.0"
-#define RUBY_RELEASE_DATE "2007-11-26"
+#define RUBY_RELEASE_DATE "2007-11-27"
 #define RUBY_VERSION_CODE 190
-#define RUBY_RELEASE_CODE 20071126
+#define RUBY_RELEASE_CODE 20071127
 #define RUBY_PATCHLEVEL 0
 
 #define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
 #define RUBY_VERSION_TEENY 0
 #define RUBY_RELEASE_YEAR 2007
 #define RUBY_RELEASE_MONTH 11
-#define RUBY_RELEASE_DAY 26
+#define RUBY_RELEASE_DAY 27
 
 #ifdef RUBY_EXTERN
 RUBY_EXTERN const char ruby_version[];

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

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