summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-05-28 03:20:04 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-05-28 03:20:04 +0000
commitff3d6d201d72eaa0f21dc376d59f4ba2a3acad92 (patch)
treed84849f3e2e4804ada7d4dac34c5da75167d8c93
parent1fe8b3742528ccfabee751d7f42317f53d6fdda7 (diff)
* eval.c (scope_node): trick to keep the node has a scope.
* eval.c (rb_eval): NODE_EVSTR: write back local_tbl to the node. * eval.c (rb_eval): NODE_SCOPE: hold the scope node in ruby_scope. * eval.c (module_setup): ditto. * eval.c (rb_call0): ditto. * node.h (NEW_DASGN, NEW_DASGN_CURR): remove surplus semicolons. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog14
-rw-r--r--eval.c12
-rw-r--r--node.h4
-rw-r--r--version.h4
4 files changed, 30 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 0ee45b26ea4..2ec19a378c2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+Tue May 28 12:13:37 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * eval.c (scope_node): trick to keep the node has a scope.
+
+ * eval.c (rb_eval): NODE_EVSTR: write back local_tbl to the node.
+
+ * eval.c (rb_eval): NODE_SCOPE: hold the scope node in ruby_scope.
+
+ * eval.c (module_setup): ditto.
+
+ * eval.c (rb_call0): ditto.
+
+ * node.h (NEW_DASGN, NEW_DASGN_CURR): remove surplus semicolons.
+
Thu May 23 16:39:21 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* ruby.c (proc_options): option parsing problem.
diff --git a/eval.c b/eval.c
index 02cfa3fac74..6e91a687345 100644
--- a/eval.c
+++ b/eval.c
@@ -840,6 +840,7 @@ static NODE *top_cref;
#define PUSH_CREF(c) ruby_cref = rb_node_newnode(NODE_CREF,(c),0,ruby_cref)
#define POP_CREF() ruby_cref = ruby_cref->nd_next
+#define scope_node super.klass
#define PUSH_SCOPE() do { \
volatile int _vmode = scope_vmode; \
struct SCOPE * volatile _old; \
@@ -2783,6 +2784,7 @@ rb_eval(self, n)
ruby_cref = (NODE*)node->nd_rval;
ruby_frame->cbase = node->nd_rval;
}
+ ruby_scope->scope_node = (VALUE)node;
if (node->nd_tbl) {
VALUE *vars = ALLOCA_N(VALUE, node->nd_tbl[0]+1);
*vars++ = (VALUE)node;
@@ -3076,6 +3078,14 @@ rb_eval(self, n)
list->nd_head = compile(list->nd_head->nd_lit,
ruby_sourcefile,
ruby_sourceline);
+ if (ruby_scope->local_tbl) {
+ NODE *body = (NODE *)ruby_scope->scope_node;
+ if (body && body->nd_tbl != ruby_scope->local_tbl) {
+ if (body->nd_tbl) free(body->nd_tbl);
+ ruby_scope->local_vars[-1] =
+ (VALUE)(body->nd_tbl = ruby_scope->local_tbl);
+ }
+ }
ruby_eval_tree = 0;
ruby_in_eval--;
if (ruby_nerrs > 0) {
@@ -3413,6 +3423,7 @@ module_setup(module, n)
PUSH_SCOPE();
PUSH_VARS();
+ ruby_scope->scope_node = (VALUE)node;
if (node->nd_tbl) {
VALUE *vars = TMP_ALLOC(node->nd_tbl[0]+1);
*vars++ = (VALUE)node;
@@ -4552,6 +4563,7 @@ rb_call0(klass, recv, id, argc, argv, body, nosuper)
ruby_cref = (NODE*)body->nd_rval;
ruby_frame->cbase = body->nd_rval;
}
+ ruby_scope->scope_node = (VALUE)body;
if (body->nd_tbl) {
local_vars = TMP_ALLOC(body->nd_tbl[0]+1);
*local_vars++ = (VALUE)body;
diff --git a/node.h b/node.h
index 33b0703ebc0..ecf61450c1a 100644
--- a/node.h
+++ b/node.h
@@ -267,8 +267,8 @@ typedef struct RNode {
#define NEW_MASGN(l,r) rb_node_newnode(NODE_MASGN,l,0,r)
#define NEW_GASGN(v,val) rb_node_newnode(NODE_GASGN,v,val,rb_global_entry(v))
#define NEW_LASGN(v,val) rb_node_newnode(NODE_LASGN,v,val,local_cnt(v))
-#define NEW_DASGN(v,val) rb_node_newnode(NODE_DASGN,v,val,0);
-#define NEW_DASGN_CURR(v,val) rb_node_newnode(NODE_DASGN_CURR,v,val,0);
+#define NEW_DASGN(v,val) rb_node_newnode(NODE_DASGN,v,val,0)
+#define NEW_DASGN_CURR(v,val) rb_node_newnode(NODE_DASGN_CURR,v,val,0)
#define NEW_IASGN(v,val) rb_node_newnode(NODE_IASGN,v,val,0)
#define NEW_CDECL(v,val) rb_node_newnode(NODE_CDECL,v,val,0)
#define NEW_CVASGN(v,val) rb_node_newnode(NODE_CVASGN,v,val,0)
diff --git a/version.h b/version.h
index ad9c048c356..431a752b056 100644
--- a/version.h
+++ b/version.h
@@ -1,4 +1,4 @@
#define RUBY_VERSION "1.7.2"
-#define RUBY_RELEASE_DATE "2002-05-23"
+#define RUBY_RELEASE_DATE "2002-05-28"
#define RUBY_VERSION_CODE 172
-#define RUBY_RELEASE_CODE 20020523
+#define RUBY_RELEASE_CODE 20020528