summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-18 11:24:36 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-18 11:24:36 +0000
commit9f8d00ff9aa85d097def654494b16c2ce09d8e92 (patch)
tree0fcc61192c6ddd51daed139482b9761c4d4f69bc /compile.c
parentbc090868b8e480ac4d179bc6b7d2ba65d4f82aef (diff)
merge revision(s) 48609: [Backport #10449] [Backport #11651]
* compile.c (iseq_compile_each): remove duplicated line event. [Bug #10449] * test/ruby/test_settracefunc.rb: add and fix tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@52640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/compile.c b/compile.c
index c8ed314f1c..40319dc0a6 100644
--- a/compile.c
+++ b/compile.c
@@ -3264,16 +3264,23 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
return COMPILE_OK;
}
- iseq->compile_data->last_line = line = (int)nd_line(node);
+ line = (int)nd_line(node);
+
+ if (iseq->compile_data->last_line == line) {
+ /* ignore */
+ }
+ else {
+ if (node->flags & NODE_FL_NEWLINE) {
+ iseq->compile_data->last_line = line;
+ ADD_TRACE(ret, line, RUBY_EVENT_LINE);
+ saved_last_element = ret->last;
+ }
+ }
+
debug_node_start(node);
type = nd_type(node);
- if (node->flags & NODE_FL_NEWLINE) {
- ADD_TRACE(ret, line, RUBY_EVENT_LINE);
- saved_last_element = ret->last;
- }
-
switch (type) {
case NODE_BLOCK:{
while (node && nd_type(node) == NODE_BLOCK) {