Issue #8014 has been reported by tmm1 (Aman Gupta).

----------------------------------------
Bug #8014: Add missing node types to ObjectSpace.count_nodes
https://bugs.ruby-lang.org/issues/8014

Author: tmm1 (Aman Gupta)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 2.0.0p0 (2013-02-24 revision 39474)


diff --git a/ext/objspace/objspace.c b/ext/objspace/objspace.c
index b8f524c..5857327 100644
--- a/ext/objspace/objspace.c
+++ b/ext/objspace/objspace.c
@@ -469,6 +469,7 @@ count_nodes(int argc, VALUE *argv, VALUE os)
 		COUNT_NODE(NODE_OP_ASGN2);
 		COUNT_NODE(NODE_OP_ASGN_AND);
 		COUNT_NODE(NODE_OP_ASGN_OR);
+		COUNT_NODE(NODE_OP_CDECL);
 		COUNT_NODE(NODE_CALL);
 		COUNT_NODE(NODE_FCALL);
 		COUNT_NODE(NODE_VCALL);
@@ -502,6 +503,7 @@ count_nodes(int argc, VALUE *argv, VALUE os)
 		COUNT_NODE(NODE_ARGS);
 		COUNT_NODE(NODE_ARGS_AUX);
 		COUNT_NODE(NODE_OPT_ARG);
+		COUNT_NODE(NODE_KW_ARG);
 		COUNT_NODE(NODE_POSTARG);
 		COUNT_NODE(NODE_ARGSCAT);
 		COUNT_NODE(NODE_ARGSPUSH);
@@ -519,6 +521,7 @@ count_nodes(int argc, VALUE *argv, VALUE os)
 		COUNT_NODE(NODE_SCLASS);
 		COUNT_NODE(NODE_COLON2);
 		COUNT_NODE(NODE_COLON3);
+		COUNT_NODE(NODE_CREF);
 		COUNT_NODE(NODE_DOT2);
 		COUNT_NODE(NODE_DOT3);
 		COUNT_NODE(NODE_FLIP2);
@@ -539,7 +542,7 @@ count_nodes(int argc, VALUE *argv, VALUE os)
 		COUNT_NODE(NODE_PRELUDE);
 		COUNT_NODE(NODE_LAMBDA);
 #undef COUNT_NODE
-	      default: node = INT2FIX(nodes[i]);
+	      default: node = INT2FIX(i);
 	    }
 	    rb_hash_aset(hash, node, SIZET2NUM(nodes[i]));
 	}



-- 
http://bugs.ruby-lang.org/