[[ moved to ruby-core ]]

n> Patch.

 it will not work.

pigeon% diff -u eval.c.old eval.c
--- eval.c.old  Sat May 25 10:51:01 2002
+++ eval.c      Sat May 25 10:51:44 2002
@@ -3073,9 +3073,11 @@
                        ruby_errinfo = Qnil;
                        ruby_sourceline = nd_line(node);
                        ruby_in_eval++;
+                       rb_dvar_push(0, 0);
                        list->nd_head = compile(list->nd_head->nd_lit,
                                                ruby_sourcefile,
                                                ruby_sourceline);
+                       ruby_dyna_vars = ruby_dyna_vars->next;
                        ruby_eval_tree = 0;
                        ruby_in_eval--;
                        if (ruby_nerrs > 0) {
pigeon%
 
pigeon% cat b.rb
#!./ruby -v
def html
   "#{a = 12
     2.times do
         b = 1
     end
     p 'end'
     p a}"
end
html
pigeon% 

pigeon% b.rb
ruby 1.7.2 (2002-05-23) [i686-linux]
"end"
./b.rb:8: [BUG] Segmentation fault
ruby 1.7.2 (2002-05-23) [i686-linux]
Aborted
pigeon% 

 Something like this (I *really* don't like it), without the patch to eval.c


pigeon% diff -u node.h.old node.h
--- node.h.old  Sat May 25 11:01:51 2002
+++ node.h      Sat May 25 11:01:56 2002
@@ -267,8 +267,8 @@
 #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)
pigeon%
 
pigeon% diff -u parse.y.old parse.y
--- parse.y.old Sat May 25 11:03:29 2002
+++ parse.y     Sat May 25 11:03:33 2002
@@ -5101,8 +5101,15 @@
     }
     if (ruby_dyna_vars)
        lvtbl->dlev = 1;
-    else
+    else {
        lvtbl->dlev = 0;
+       if (compile_for_eval) {
+           dyna_push();
+           ruby_eval_tree = block_append(ruby_eval_tree, 
+                                         NEW_DASGN(0, NEW_LIT(0)));
+       }
+    }
+           
 }
 
 static void
pigeon% 



Guy Decoux