Skip to content

Instantly share code, notes, and snippets.

@mark-moseley
Created August 10, 2009 16:53
Show Gist options
  • Save mark-moseley/165282 to your computer and use it in GitHub Desktop.
Save mark-moseley/165282 to your computer and use it in GitHub Desktop.
Index: iseq.h
===================================================================
--- iseq.h (revision 24493)
+++ 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 24493)
+++ compile.c (working copy)
@@ -2936,6 +2936,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 +2952,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 = (int)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