aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-03-23 07:15:49 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-03-23 07:15:49 +0000
commit142922368680cbd6038fc2837daf2df7e7109720 (patch)
tree7f6e4ca05ec337381bc48d371f14e37095d8669b
parent93c746f8282ec59b8ac59b2ac2f884aadf3e384b (diff)
downloadruby-142922368680cbd6038fc2837daf2df7e7109720.tar.gz
* parse.y (primary): fix lineno of rescue and ensure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--parse.y9
-rw-r--r--test/ruby/test_settracefunc.rb7
3 files changed, 12 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 68cb881759..d01499ce21 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Wed Mar 23 16:12:40 2005 Shugo Maeda <shugo@ruby-lang.org>
+
+ * parse.y (primary): fix lineno of rescue and ensure.
+
Wed Mar 23 00:39:05 2005 Shugo Maeda <shugo@ruby-lang.org>
* test/ruby/test_settracefunc.rb (test_event): added tests for
diff --git a/parse.y b/parse.y
index 4922eeee5e..21faacd0e0 100644
--- a/parse.y
+++ b/parse.y
@@ -2448,10 +2448,15 @@ primary : literal
kEND
{
/*%%%*/
- if ($3 == NULL)
+ if ($3 == NULL) {
$$ = NEW_NIL();
- else
+ }
+ else {
+ if (nd_type($3) == NODE_RESCUE ||
+ nd_type($3) == NODE_ENSURE)
+ nd_set_line($3, $<num>1);
$$ = NEW_BEGIN($3);
+ }
nd_set_line($$, $<num>1);
/*%
$$ = dispatch1(begin, $3);
diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb
index 220c946ca8..aa21812fa0 100644
--- a/test/ruby/test_settracefunc.rb
+++ b/test/ruby/test_settracefunc.rb
@@ -71,13 +71,8 @@ class TestSetTraceFunc < Test::Unit::TestCase
events.shift) # when 3
assert_equal(["line", 20, :test_event, TestSetTraceFunc],
events.shift) # c = "b == 3"
-
- # 1.8
- # assert_equal(["line", 23, :test_event, TestSetTraceFunc],
- # events.shift) # begin
- assert_equal(["line", 24, :test_event, TestSetTraceFunc],
+ assert_equal(["line", 23, :test_event, TestSetTraceFunc],
events.shift) # begin
-
assert_equal(["line", 24, :test_event, TestSetTraceFunc],
events.shift) # raise "error"
assert_equal(["c-call", 24, :raise, Kernel],