summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-27 11:06:51 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-27 11:06:51 +0000
commitea290804891b259cce4a156790ba024c1d52ad27 (patch)
tree990c6a2acb27d44a22e1adce171a787dbc0245cd /compile.c
parent6115f65d7dd29561710c3e84bb27180e5bab4380 (diff)
* 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/trunk@48609 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 6b3f49a..b505fbe 100644
--- a/compile.c
+++ b/compile.c
@@ -3268,16 +3268,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) {