Skip to content

Commit 1681161

Browse files
committed
* compile.c (ricsin_compile): fix to skip __Ccont__ 2nd argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ricsin@19598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 66d75cd commit 1681161

File tree

3 files changed

+34
-5
lines changed

3 files changed

+34
-5
lines changed

compile.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3029,13 +3029,18 @@ ricsin_compile(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *node, int cx)
30293029
if (cx) {
30303030
args = args->nd_next;
30313031

3032-
if (nd_type(args->nd_head) == NODE_LIT) {
3033-
rb_ary_push(ary, args->nd_head->nd_lit);
3034-
rb_ary_push(ary, (VALUE)iseq | 0x01 /* iseq id */);
3032+
if (args) {
3033+
if (nd_type(args->nd_head) == NODE_LIT) {
3034+
rb_ary_push(ary, args->nd_head->nd_lit);
3035+
rb_ary_push(ary, (VALUE)iseq | 0x01 /* iseq id */);
3036+
}
3037+
else {
3038+
rb_bug("boo...: %s", ruby_node_name(nd_type(args->nd_head)));
3039+
}
30353040
}
30363041
else {
3037-
3038-
rb_bug("boo...: %s", ruby_node_name(nd_type(args->nd_head)));
3042+
rb_ary_push(ary, INT2FIX(0));
3043+
rb_ary_push(ary, (VALUE)iseq | 0x01 /* iseq id */);
30393044
}
30403045

30413046
args = args->nd_next;

ricsin/ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Sat Sep 27 21:40:44 2008 Koichi Sasada <ko1@atdot.net>
2+
3+
* compile.c (ricsin_compile): fix to skip __Ccont__ 2nd argument.
4+
15
Fri Sep 26 13:39:46 2008 Koichi Sasada <ko1@atdot.net>
26

37
* compile.c, ricsin/ricsin.rb: rename __Cx__ to __Ccont__.

ricsin/t.rcb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
v = true
2+
__Ccont__('while (v != Qnil) {') # (a)
3+
v = nil # (b)
4+
__Ccont__(' rb_p(v);') # (c)
5+
__Ccont__('}') # (d)
6+
__END__
7+
8+
__END__
9+
v = 42
10+
r = __C__(%q{
11+
return INT2FIX(FIX2INT(v) + 1);
12+
})
13+
p r #=> 43 �ƕ\��
14+
__END__
15+
16+
p [1, 2, 3].map(&__Cb__(%q{
17+
return INT2FIX(FIX2INT(arg) * 2);
18+
}))
19+
__END__
20+
121
p $0
222
p $0 == __FILE__
323

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy