1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

parse.y: trace elsif

* parse.y (new_if_gen): set newline flag to NODE_IF to trace all
  if/elsif statements.  [ruby-core:67720] [Bug #10763]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-05-03 05:19:20 +00:00
parent e0a0c2b802
commit e0611820df
3 changed files with 25 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Tue May 3 14:19:18 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (new_if_gen): set newline flag to NODE_IF to trace all
if/elsif statements. [ruby-core:67720] [Bug #10763]
Tue May 3 05:35:54 2016 Eric Wong <e@80x24.org>
* process.c (disable_child_handler_fork_child):

View file

@ -9955,7 +9955,7 @@ new_if_gen(struct parser_params *parser, NODE *cc, NODE *left, NODE *right)
{
if (!cc) return right;
cc = cond0(parser, cc);
return NEW_IF(cc, left, right);
return newline_node(NEW_IF(cc, left, right));
}
static NODE*

View file

@ -1399,6 +1399,25 @@ class TestSetTraceFunc < Test::Unit::TestCase
assert_equal [__LINE__ - 3, __LINE__ - 2], lines, 'Bug #10449'
end
def test_elsif_line_event
bug10763 = '[ruby-core:67720] [Bug #10763]'
lines = []
line = nil
TracePoint.new(:line){|tp|
next unless target_thread?
lines << tp.lineno if line
}.enable{
line = __LINE__
if !line
1
elsif line
2
end
}
assert_equal [line+1, line+3, line+4], lines, bug10763
end
class Bug10724
def initialize
loop{return}