--Multipart_Tue_May_28_10:33:47_2002-1
Content-Type: text/plain; charset=US-ASCII

Hi,

At Tue, 28 May 2002 00:56:00 +0900,
ts wrote:
> n> Another approach.
> 
>  Seems better,

Since it was too ugly, additional patch, and testcases.  The
latest versions of 1.6 and 1.7 succeed the tests excepting
test_bug.

--- eval.c~	Mon May 27 23:34:52 2002
+++ eval.c	Tue May 28 09:34:42 2002
@@ -3059,8 +3059,6 @@ rb_eval(self, n)
 			if (ruby_scope->local_tbl) {
 			    NODE *body  NODE *)ruby_scope->scope_node;
-			    if (body &&
-				(!body->nd_tbl ||
-				 body->nd_tbl ! uby_scope->local_tbl &&
-				 (free(body->nd_tbl), 1))) {
+			    if (body && body->nd_tbl ! uby_scope->local_tbl) {
+				if (body->nd_tbl) free(body->nd_tbl);
 				ruby_scope->local_vars[-1] VALUE)(body->nd_tbl  uby_scope->local_tbl);



--Multipart_Tue_May_28_10:33:47_2002-1
Content-Type: text/x-ruby; charset=US-ASCII
Content-Disposition: attachment; filename="tc_evstr.rb"
Content-Transfer-Encoding: 7bit

require 'test/unit'

class TC_Evstr < Test::Unit::TestCase
  def bug
    "#{a"
  end

  def bug2
   "#{a  2
     2.times {b  }
     'end'
     a}"
  end

  def test_bug
    assert_equal("1", assert_nothing_raised {bug})
    assert_equal("1", assert_nothing_raised {bug})
    assert_equal("12", assert_nothing_raised {bug2})
    assert_equal("12", assert_nothing_raised {bug2})
  end

  def test_error
    begin "#{a    :}"; rescue SyntaxError; end
    assert_raises(NameError) {eval "a"}
    assert_raises(NameError) {eval "b"}
  end

  def test_raise
    begin "#{a  ; raise}"; rescue; end
    assert_equal("1", "#{a}")
  end

  def test_nest
    "#{"#{a"}"
    assert_equal("1", "#{a}")
  end

  def test_dvar
    "#{a  2}"
    eval "x  2"
    assert_equal("local-variable", "#{defined? x}")
  end
end

--Multipart_Tue_May_28_10:33:47_2002-1
Content-Type: text/plain; charset=US-ASCII


-- 
Nobu Nakada

--Multipart_Tue_May_28_10:33:47_2002-1--