summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-27 05:58:23 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-27 05:58:23 +0000
commit6c08b4522d4b9173dcbada62c6d218452d103b4a (patch)
tree9c1d61c48ed6842d7bf5e582cfca85aca80005f2 /compile.c
parent5effdad2cdd0807eca83ea2cdbddc70f4f3fe02f (diff)
* iseq.h, iseq.c (rb_iseq_new_main): add a type ISEQ_TYPE_MAIN.
[ruby-dev:37619] * compile.c (rb_dvar_defined, ruby_iseq_compile): ditto. * iseq.c (iseq_data_to_ary, iseq_load): ditto. * compile.c (iseq_compile_each): fix to check ip->compile_data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21088 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/compile.c b/compile.c
index 951d1c0076..f459eb3cdc 100644
--- a/compile.c
+++ b/compile.c
@@ -469,6 +469,7 @@ ruby_iseq_compile(VALUE self, NODE *node)
case ISEQ_TYPE_CLASS:
case ISEQ_TYPE_BLOCK:
case ISEQ_TYPE_EVAL:
+ case ISEQ_TYPE_MAIN:
case ISEQ_TYPE_TOP:
rb_compile_error(ERROR_ARGS "compile/should not be reached: %s:%d",
__FILE__, __LINE__);
@@ -3265,6 +3266,11 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
else {
rb_iseq_t *ip = iseq->parent_iseq;
while (ip) {
+ if (!ip->compile_data) {
+ ip = 0;
+ break;
+ }
+
level++;
if (ip->compile_data->redo_label != 0) {
level = 0x8000;
@@ -3281,6 +3287,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
else if (ip->type == ISEQ_TYPE_EVAL) {
goto break_in_eval;
}
+
ip = ip->parent_iseq;
}
COMPILE_ERROR((ERROR_ARGS "Invalid break"));
@@ -3322,6 +3329,11 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
rb_iseq_t *ip;
ip = iseq;
while (ip) {
+ if (!ip->compile_data) {
+ ip = 0;
+ break;
+ }
+
level = 0x8000 | 0x4000;
if (ip->compile_data->redo_label != 0) {
/* while loop */
@@ -3333,6 +3345,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
else if (ip->type == ISEQ_TYPE_EVAL) {
goto next_in_eval;
}
+
ip = ip->parent_iseq;
}
if (ip != 0) {
@@ -3383,6 +3396,11 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
level = 0x8000 | 0x4000;
ip = iseq;
while (ip) {
+ if (!ip->compile_data) {
+ ip = 0;
+ break;
+ }
+
if (ip->compile_data->redo_label != 0) {
break;
}
@@ -3392,6 +3410,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
else if (ip->type == ISEQ_TYPE_EVAL) {
goto redo_in_eval;
}
+
ip = ip->parent_iseq;
}
if (ip != 0) {
@@ -5291,7 +5310,9 @@ rb_dvar_defined(ID id)
while (iseq->type == ISEQ_TYPE_BLOCK ||
iseq->type == ISEQ_TYPE_RESCUE ||
iseq->type == ISEQ_TYPE_ENSURE ||
- iseq->type == ISEQ_TYPE_EVAL) {
+ iseq->type == ISEQ_TYPE_EVAL ||
+ iseq->type == ISEQ_TYPE_MAIN
+ ) {
int i;
for (i = 0; i < iseq->local_table_size; i++) {