1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* node.c (dump_node): fixed for long members.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-12-09 15:46:45 +00:00
parent 38828fa8d1
commit 7cd9a5d363
3 changed files with 14 additions and 8 deletions

View file

@ -1,3 +1,7 @@
Thu Dec 10 00:46:43 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* node.c (dump_node): fixed for long members.
Wed Dec 9 22:57:04 2009 Yusuke Endoh <mame@tsg.ne.jp>
* node.c: node management added. Currently, only pretty-dumper is

14
node.c
View file

@ -18,6 +18,7 @@
#define A_INDENT add_indent(buf, indent)
#define A_ID(id) add_id(buf, id)
#define A_INT(val) rb_str_catf(buf, "%d", (val));
#define A_LONG(val) rb_str_catf(buf, "%ld", (val));
#define A_LIT(lit) AR(rb_inspect(lit))
#define A_NODE_HEADER(node) \
rb_str_catf(buf, "@ %s (line: %d)", ruby_node_name(nd_type(node)), nd_line(node))
@ -44,6 +45,7 @@
#define F_ID(name, ann) SIMPLE_FIELD(#name, #name " (" ann ")", A_ID(node->name))
#define F_GENTRY(name, ann) SIMPLE_FIELD(#name, #name " (" ann ")", A_ID((node->name)->id))
#define F_INT(name, ann) SIMPLE_FIELD(#name, #name " (" ann ")", A_INT(node->name))
#define F_LONG(name, ann) SIMPLE_FIELD(#name, #name " (" ann ")", A_LONG(node->name))
#define F_LIT(name, ann) SIMPLE_FIELD(#name, #name " (" ann ")", A_LIT(node->name))
#define F_MSG(name, ann, desc) SIMPLE_FIELD(#name, #name " (" ann ")", A(desc))
@ -148,9 +150,9 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
ANN("until statement");
ANN("format: until [nd_cond]; [nd_body]; end");
ANN("example: until x == 1; foo; end");
loop:
loop:
F_CUSTOM1(nd_state, "begin-end-while?", {
A_INT(node->nd_state);
A_INT((int)node->nd_state);
A((node->nd_state == 1) ? " (while-end)" : " (begin-end-while)");
});
F_NODE(nd_cond, "condition");
@ -422,7 +424,7 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
ANN("format: [ [nd_head], [nd_next].. ] (length: [nd_alen])");
ANN("example: return 1, 2, 3");
ary:
F_INT(nd_alen, "length");
F_LONG(nd_alen, "length");
F_NODE(nd_head, "element");
LAST_NODE;
F_NODE(nd_next, "next element");
@ -489,7 +491,7 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
ANN("nth special variable reference");
ANN("format: $[nd_nth]");
ANN("example: $1, $2, ..");
F_CUSTOM1(nd_nth, "variable", { A("$"); A_INT(node->nd_nth); });
F_CUSTOM1(nd_nth, "variable", { A("$"); A_LONG(node->nd_nth); });
break;
case NODE_BACK_REF:
@ -853,7 +855,7 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
D_NODE_HEADER(node);
ANN("method parameters (cont'd)");
F_ID(nd_pid, "first post argument");
F_INT(nd_plen, "post argument length");
F_LONG(nd_plen, "post argument length");
LAST_NODE;
F_CUSTOM2(nd_next, "aux info 3", {
node = node->nd_next;
@ -877,7 +879,7 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
ANN("method parameters");
ANN("format: def method_name(.., [nd_opt=some], *[nd_rest], [nd_pid], .., &[nd_body])");
ANN("example: def foo(a, b, opt1=1, opt2=2, *rest, y, z, &blk); end");
F_INT(nd_frml, "argc");
F_LONG(nd_frml, "argc");
F_NODE(nd_next, "aux info 1");
LAST_NODE;
F_NODE(nd_opt, "optional arguments");

View file

@ -1,5 +1,5 @@
#define RUBY_VERSION "1.9.2"
#define RUBY_RELEASE_DATE "2009-12-09"
#define RUBY_RELEASE_DATE "2009-12-10"
#define RUBY_PATCHLEVEL -1
#define RUBY_BRANCH_NAME "trunk"
@ -8,7 +8,7 @@
#define RUBY_VERSION_TEENY 1
#define RUBY_RELEASE_YEAR 2009
#define RUBY_RELEASE_MONTH 12
#define RUBY_RELEASE_DAY 9
#define RUBY_RELEASE_DAY 10
#include "ruby/version.h"