* compile.c (rb_iseq_compile): formatted if/else to switch statement.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e86a6e2514
commit
d4662d49d9
@ -1,3 +1,7 @@
|
|||||||
|
Tue Jul 10 16:52:01 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* compile.c (rb_iseq_compile): formatted if/else to switch statement.
|
||||||
|
|
||||||
Tue Jul 10 15:57:53 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Tue Jul 10 15:57:53 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* bootstraptest/test_flip.rb: new test for flip-flop operator.
|
* bootstraptest/test_flip.rb: new test for flip-flop operator.
|
||||||
|
14
compile.c
14
compile.c
@ -151,7 +151,8 @@ rb_iseq_compile(VALUE self, NODE *node)
|
|||||||
set_local_table(iseq, node->nd_tbl);
|
set_local_table(iseq, node->nd_tbl);
|
||||||
set_arguments(iseq, ret, node->nd_args);
|
set_arguments(iseq, ret, node->nd_args);
|
||||||
|
|
||||||
if (iseq->type == ISEQ_TYPE_BLOCK) {
|
switch (iseq->type) {
|
||||||
|
case ISEQ_TYPE_BLOCK: {
|
||||||
LABEL *start = iseq->compile_data->start_label = NEW_LABEL(0);
|
LABEL *start = iseq->compile_data->start_label = NEW_LABEL(0);
|
||||||
LABEL *end = iseq->compile_data->end_label = NEW_LABEL(0);
|
LABEL *end = iseq->compile_data->end_label = NEW_LABEL(0);
|
||||||
|
|
||||||
@ -162,20 +163,23 @@ rb_iseq_compile(VALUE self, NODE *node)
|
|||||||
/* wide range catch handler must put at last */
|
/* wide range catch handler must put at last */
|
||||||
ADD_CATCH_ENTRY(CATCH_TYPE_REDO, start, end, 0, start);
|
ADD_CATCH_ENTRY(CATCH_TYPE_REDO, start, end, 0, start);
|
||||||
ADD_CATCH_ENTRY(CATCH_TYPE_NEXT, start, end, 0, end);
|
ADD_CATCH_ENTRY(CATCH_TYPE_NEXT, start, end, 0, end);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else {
|
case ISEQ_TYPE_CLASS: {
|
||||||
if (iseq->type == ISEQ_TYPE_CLASS) {
|
|
||||||
ADD_TRACE(ret, nd_line(node), RUBY_EVENT_CLASS);
|
ADD_TRACE(ret, nd_line(node), RUBY_EVENT_CLASS);
|
||||||
COMPILE(ret, "scoped node", node->nd_body);
|
COMPILE(ret, "scoped node", node->nd_body);
|
||||||
ADD_TRACE(ret, nd_line(node), RUBY_EVENT_END);
|
ADD_TRACE(ret, nd_line(node), RUBY_EVENT_END);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (iseq->type == ISEQ_TYPE_METHOD) {
|
case ISEQ_TYPE_METHOD: {
|
||||||
ADD_TRACE(ret, nd_line(node), RUBY_EVENT_CALL);
|
ADD_TRACE(ret, nd_line(node), RUBY_EVENT_CALL);
|
||||||
COMPILE(ret, "scoped node", node->nd_body);
|
COMPILE(ret, "scoped node", node->nd_body);
|
||||||
ADD_TRACE(ret, nd_line(node), RUBY_EVENT_RETURN);
|
ADD_TRACE(ret, nd_line(node), RUBY_EVENT_RETURN);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else {
|
default: {
|
||||||
COMPILE(ret, "scoped node", node->nd_body);
|
COMPILE(ret, "scoped node", node->nd_body);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user