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

yarv-diff:234

From: ko1 atdot.net
Date: 13 Feb 2006 13:10:40 -0000
Subject: [yarv-diff:234] r395 - in trunk: . yarvtest

Author: ko1
Date: 2006-02-13 22:10:40 +0900 (Mon, 13 Feb 2006)
New Revision: 395

Modified:
   trunk/
   trunk/ChangeLog
   trunk/compile.c
   trunk/test.rb
   trunk/yarvtest/test_class.rb
Log:
 r583@leremita:  ko1 | 2006-02-13 22:10:16 +0900
 	* compile.c : support NODE_DECL, NODE_CLASS with NODE_CLON3 prefix
 
 	* yarvtest/test_class.rb : add tests for above
 



Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - 81cd9672-7512-7e48-ae48-6936450e977d:/local/yarv/trunk:580
   + 81cd9672-7512-7e48-ae48-6936450e977d:/local/yarv/trunk:583

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-02-13 12:24:09 UTC (rev 394)
+++ trunk/ChangeLog	2006-02-13 13:10:40 UTC (rev 395)
@@ -4,6 +4,13 @@
 #  from Mon, 03 May 2004 01:24:19 +0900
 #
 
+2006-02-13(Mon) 22:09:12 +0900  Koichi Sasada  <ko1 atdot.net>
+
+	* compile.c : support NODE_DECL, NODE_CLASS with NODE_CLON3 prefix
+
+	* yarvtest/test_class.rb : add tests for above
+
+
 2006-02-13(Mon) 21:20:57 +0900  Koichi Sasada  <ko1 atdot.net>
 
 	* compile.c : fix indent

Modified: trunk/compile.c
===================================================================
--- trunk/compile.c	2006-02-13 12:24:09 UTC (rev 394)
+++ trunk/compile.c	2006-02-13 13:10:40 UTC (rev 395)
@@ -2187,6 +2187,21 @@
 }
 
 static int
+compile_cpath(LINK_ANCHOR *ret, yarv_iseq_t *iseq, NODE *cpath)
+{
+    if(cpath->nd_head) {
+	COMPILE(ret, "nd_else->nd_head", cpath->nd_head);
+    }
+    else if (nd_type(cpath) == NODE_COLON2) {
+	COMPILE(ret, "cpath (NODE_COLON2)", cpath->nd_head);
+    }
+    else {
+	ADD_INSN1(ret, nd_line(cpath), putobject, rb_cObject);
+    }
+    return COMPILE_OK;
+}
+
+static int
 defined_expr(yarv_iseq_t *iseq, LINK_ANCHOR *ret,
 	     NODE * node, LABEL *lfinish, VALUE needstr)
 {
@@ -2864,9 +2879,6 @@
 		      level |= 0x4000;
 		      break;
 		  }
-		  else if (ip->type == ISEQ_TYPE_EVAL) {
-		      COMPILE_ERROR(("Can't escape from eval with eval"));
-		  }
 		  else if (ip->compile_data->redo_label != 0) {
 		      break;
 		  }
@@ -3158,7 +3170,7 @@
 			ID2SYM(node->nd_vid));
 	  }
 	  else {
-	      COMPILE(ret, "nd_else->nd_head", node->nd_else->nd_head);
+	      compile_cpath(ret, iseq, node->nd_else);
 	      ADD_INSN1(ret, nd_line(node), setconstant,
 			ID2SYM(node->nd_else->nd_mid));
 	  }
@@ -4073,8 +4085,7 @@
 								nd_cpath->
 								nd_mid)),
 					    ISEQ_TYPE_CLASS);
-
-	  COMPILE(ret, "cbase", node->nd_cpath->nd_head);
+	  compile_cpath(ret, iseq, node->nd_cpath);
 	  COMPILE(ret, "super", node->nd_super);
 	  ADD_INSN2(ret, nd_line(node), classdef,
 		    ID2SYM(node->nd_cpath->nd_mid), iseqval);

Modified: trunk/test.rb
===================================================================
--- trunk/test.rb	2006-02-13 12:24:09 UTC (rev 394)
+++ trunk/test.rb	2006-02-13 13:10:40 UTC (rev 395)
@@ -1,4 +1,9 @@
+__END__
 
+
+__END__
+
+
 def m
   proc{
     break :ok

Modified: trunk/yarvtest/test_class.rb
===================================================================
--- trunk/yarvtest/test_class.rb	2006-02-13 12:24:09 UTC (rev 394)
+++ trunk/yarvtest/test_class.rb	2006-02-13 13:10:40 UTC (rev 395)
@@ -616,5 +616,21 @@
       A.new.m
     }
   end
+
+  def test_colon3
+    ae %q{
+      class A
+        ::B = :OK
+      end
+      B
+    }
+    ae %q{
+      class A
+        class ::C
+        end
+      end
+      C
+    }
+  end
 end
 


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

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