Created
August 12, 2009 04:41
-
-
Save mark-moseley/166330 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: iseq.h | |
=================================================================== | |
--- iseq.h (revision 24504) | |
+++ iseq.h (working copy) | |
@@ -85,6 +85,7 @@ | |
int flip_cnt; | |
int label_no; | |
int node_level; | |
+ int last_line_traced; | |
const rb_compile_option_t *option; | |
}; | |
Index: compile.c | |
=================================================================== | |
--- compile.c (revision 24504) | |
+++ compile.c (working copy) | |
@@ -2361,7 +2361,13 @@ | |
DECL_ANCHOR(anchor); | |
INIT_ANCHOR(anchor); | |
COMPILE_POPED(anchor, "masgn lhs", node); | |
- REMOVE_ELEM(FIRST_ELEMENT(anchor)); | |
+ while (FIRST_ELEMENT(anchor)->type == ISEQ_ELEMENT_INSN) { | |
+ INSN *insn = (INSN*)FIRST_ELEMENT(anchor); | |
+ if ((insn->insn_id == BIN(putnil)) || (insn->insn_id == BIN(trace))) | |
+ REMOVE_ELEM(FIRST_ELEMENT(anchor)); | |
+ else | |
+ break; | |
+ } | |
ADD_SEQ(ret, anchor); | |
} | |
} | |
@@ -2936,6 +2942,14 @@ | |
{ | |
enum node_type type; | |
+ if (node) | |
+ iseq->compile_data->last_line = (int)nd_line(node); | |
+ | |
+ if (iseq->compile_data->last_line != iseq->compile_data->last_line_traced) { | |
+ iseq->compile_data->last_line_traced = iseq->compile_data->last_line; | |
+ ADD_TRACE(ret, iseq->compile_data->last_line, RUBY_EVENT_LINE); | |
+ } | |
+ | |
if (node == 0) { | |
if (!poped) { | |
debugs("node: NODE_NIL(implicit)\n"); | |
@@ -2944,21 +2958,18 @@ | |
return COMPILE_OK; | |
} | |
- iseq->compile_data->last_line = (int)nd_line(node); | |
debug_node_start(node); | |
type = nd_type(node); | |
- if (node->flags & NODE_FL_NEWLINE) { | |
- ADD_TRACE(ret, nd_line(node), RUBY_EVENT_LINE); | |
- } | |
- | |
switch (type) { | |
case NODE_BLOCK:{ | |
while (node && nd_type(node) == NODE_BLOCK) { | |
COMPILE_(ret, "BLOCK body", node->nd_head, | |
(node->nd_next == 0 && poped == 0) ? 0 : 1); | |
node = node->nd_next; | |
+ if (node) | |
+ iseq->compile_data->last_line = nd_line(node); | |
} | |
if (node) { | |
COMPILE_(ret, "BLOCK next", node->nd_next, poped); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment