summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-06-30 01:40:51 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-06-30 01:40:51 +0000
commitd7b1e063ff799f8172916df6eb7feedea27d6f2a (patch)
tree0e99bef9f33d14541a4c5894e7c2efbb7da0ced6
parent05da25f297c4d26b6bb454a9649b1dd63a102910 (diff)
*** empty log message ***
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--ToDo1
-rw-r--r--eval.c33
-rw-r--r--ext/gtk/depend2
-rw-r--r--ext/gtk/gtk.c2
-rw-r--r--sample/test.rb13
6 files changed, 45 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 177275776c6..b9fbf551b4f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Jun 30 01:05:20 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (BEGIN_CALLARGS): adjust the_block before evaluating the
+ receiver's value and the arguments.
+
Fri Jun 26 18:02:50 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
* experimental release 1.1b9_28.
diff --git a/ToDo b/ToDo
index 9710c423024..462bc47adb1 100644
--- a/ToDo
+++ b/ToDo
@@ -1,3 +1,4 @@
+* remove Enumerable#reverse at 1.2
* non-blocking open/write for thread
* package or access control for global variables
* format
diff --git a/eval.c b/eval.c
index cc2f93566c6..f7852cbefb3 100644
--- a/eval.c
+++ b/eval.c
@@ -401,7 +401,7 @@ struct BLOCK {
#endif
struct BLOCK *prev;
};
-static struct BLOCK *the_block;
+static struct BLOCK *the_block;
#define PUSH_BLOCK(v,b) { \
struct BLOCK _block; \
@@ -1312,6 +1312,18 @@ mod_alias_method(mod, newname, oldname)
}\
}
+#define BEGIN_CALLARGS {\
+ struct BLOCK *tmp_block = the_block;\
+ if (the_iter->iter == ITER_PRE) {\
+ the_block = the_block->prev;\
+ }\
+ PUSH_ITER(ITER_NOT);
+
+#define END_CALLARGS \
+ the_block = tmp_block;\
+ POP_ITER();\
+}
+
#define MATCH_DATA the_scope->local_vars[node->nd_cnt]
static char* is_defined _((VALUE, NODE*, char*));
@@ -1961,10 +1973,11 @@ rb_eval(self, node)
int argc; VALUE *argv; /* used in SETUP_ARGS */
TMP_PROTECT;
- PUSH_ITER(ITER_NOT);
+ BEGIN_CALLARGS;
recv = rb_eval(self, node->nd_recv);
SETUP_ARGS(node->nd_args);
- POP_ITER();
+ END_CALLARGS;
+
result = rb_call(CLASS_OF(recv),recv,node->nd_mid,argc,argv,0);
}
break;
@@ -1974,9 +1987,10 @@ rb_eval(self, node)
int argc; VALUE *argv; /* used in SETUP_ARGS */
TMP_PROTECT;
- PUSH_ITER(ITER_NOT);
+ BEGIN_CALLARGS;
SETUP_ARGS(node->nd_args);
- POP_ITER();
+ END_CALLARGS;
+
result = rb_call(CLASS_OF(self),self,node->nd_mid,argc,argv,1);
}
break;
@@ -2000,9 +2014,9 @@ rb_eval(self, node)
argv = the_frame->argv;
}
else {
- PUSH_ITER(ITER_NOT);
+ BEGIN_CALLARGS;
SETUP_ARGS(node->nd_args);
- POP_ITER();
+ END_CALLARGS;
}
PUSH_ITER(the_iter->iter?ITER_PRE:ITER_NOT);
@@ -3072,9 +3086,10 @@ handle_rescue(self, node)
return obj_is_kind_of(errinfo, eStandardError);
}
- PUSH_ITER(ITER_NOT);
+ BEGIN_CALLARGS;
SETUP_ARGS(node->nd_args);
- POP_ITER();
+ END_CALLARGS;
+
while (argc--) {
if (!obj_is_kind_of(argv[0], cModule)) {
TypeError("class or module required for rescue clause");
diff --git a/ext/gtk/depend b/ext/gtk/depend
index 4cd0e181d45..04e92708c35 100644
--- a/ext/gtk/depend
+++ b/ext/gtk/depend
@@ -1,2 +1,2 @@
gtk.o: gtk.c $(hdrdir)/ruby.h $(hdrdir)/config.h $(hdrdir)/defines.h \
- $(hdrdir)/intern.h $(hdrdir)/sig.h
+ $(hdrdir)/intern.h $(hdrdir)/rubysig.h
diff --git a/ext/gtk/gtk.c b/ext/gtk/gtk.c
index c0015900107..9efdc1ce0b1 100644
--- a/ext/gtk/gtk.c
+++ b/ext/gtk/gtk.c
@@ -5779,7 +5779,7 @@ idle()
{
CHECK_INTS;
#ifdef THREAD
- if (!thred_critical) thred_schedule();
+ if (!thread_critical) thread_schedule();
#endif
return TRUE;
}
diff --git a/sample/test.rb b/sample/test.rb
index 3bc00306f65..e3ca832e0fa 100644
--- a/sample/test.rb
+++ b/sample/test.rb
@@ -453,6 +453,19 @@ end
ok($x.size == 10)
ok($x == [1, 2, 3, 1, 2, 3, 4, 5, 6, 7])
+# append method to built-in class
+class Array
+ def iter_test1
+ collect{|e| [e, yield(e)]}.sort{|a,b|a[1]<=>b[1]}
+ end
+ def iter_test2
+ a = collect{|e| [e, yield(e)]}
+ a.sort{|a,b|a[1]<=>b[1]}
+ end
+end
+$x = [[1,2],[3,4],[5,6]]
+ok($x.iter_test1{|x|x} == $x.iter_test2{|x|x})
+
check "bignum"
def fact(n)
return 1 if n == 0