summaryrefslogtreecommitdiffstats
path: root/compile.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-07-10 07:52:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-07-10 07:52:03 +0000
commit706d72a1d5301ca4f83ad00a0ebb464ada4e33d6 (patch)
tree1496368b6ea3c8bbf2fed3a5af0191842cb12efa /compile.c
parent2bb106fdbd8c954f0ee855e6ea117f88d9a04c28 (diff)
downloadruby-706d72a1d5301ca4f83ad00a0ebb464ada4e33d6.tar.gz
ruby-706d72a1d5301ca4f83ad00a0ebb464ada4e33d6.tar.xz
ruby-706d72a1d5301ca4f83ad00a0ebb464ada4e33d6.zip
* compile.c (rb_iseq_compile): formatted if/else to switch statement.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@12730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/compile.c b/compile.c
index 2fa2166d9..38c6e42d1 100644
--- a/compile.c
+++ b/compile.c
@@ -151,7 +151,8 @@ rb_iseq_compile(VALUE self, NODE *node)
set_local_table(iseq, node->nd_tbl);
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 *end = iseq->compile_data->end_label = NEW_LABEL(0);
@@ -162,21 +163,24 @@ rb_iseq_compile(VALUE self, NODE *node)
/* wide range catch handler must put at last */
ADD_CATCH_ENTRY(CATCH_TYPE_REDO, start, end, 0, start);
ADD_CATCH_ENTRY(CATCH_TYPE_NEXT, start, end, 0, end);
- }
- else {
- if (iseq->type == ISEQ_TYPE_CLASS) {
- ADD_TRACE(ret, nd_line(node), RUBY_EVENT_CLASS);
- COMPILE(ret, "scoped node", node->nd_body);
- ADD_TRACE(ret, nd_line(node), RUBY_EVENT_END);
- }
- else if (iseq->type == ISEQ_TYPE_METHOD) {
- ADD_TRACE(ret, nd_line(node), RUBY_EVENT_CALL);
- COMPILE(ret, "scoped node", node->nd_body);
- ADD_TRACE(ret, nd_line(node), RUBY_EVENT_RETURN);
- }
- else {
- COMPILE(ret, "scoped node", node->nd_body);
- }
+ break;
+ }
+ case ISEQ_TYPE_CLASS: {
+ ADD_TRACE(ret, nd_line(node), RUBY_EVENT_CLASS);
+ COMPILE(ret, "scoped node", node->nd_body);
+ ADD_TRACE(ret, nd_line(node), RUBY_EVENT_END);
+ break;
+ }
+ case ISEQ_TYPE_METHOD: {
+ ADD_TRACE(ret, nd_line(node), RUBY_EVENT_CALL);
+ COMPILE(ret, "scoped node", node->nd_body);
+ ADD_TRACE(ret, nd_line(node), RUBY_EVENT_RETURN);
+ break;
+ }
+ default: {
+ COMPILE(ret, "scoped node", node->nd_body);
+ break;
+ }
}
}
else {