summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-28 09:40:46 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-28 09:40:46 +0000
commit7e35c2e2d0ba1b0a0d3df190df45158044a2620d (patch)
tree9b49f0e5b8658b3e441d7de5118f25f62870bd5d /compile.c
parentf54ed7a794f5814f16ae7d070febe0f152ea319f (diff)
merges r21088 from trunk into ruby_1_(_1.
* 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/branches/ruby_1_9_1@21118 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++) {