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

* node.c: parenthesize macro arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2010-12-20 14:13:12 +00:00
parent 13569788b2
commit 8f6c729601
2 changed files with 8 additions and 4 deletions

View file

@ -1,3 +1,7 @@
Mon Dec 20 23:12:37 2010 Tanaka Akira <akr@fsij.org>
* node.c: parenthesize macro arguments.
Mon Dec 20 20:04:41 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
* NEWS: add #__id__ and #object_id. [ruby-dev:42778]

8
node.c
View file

@ -16,21 +16,21 @@
#define AR(str) rb_str_concat(buf, (str))
#define A_INDENT add_indent(buf, indent)
#define A_ID(id) add_id(buf, id)
#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))
#define A_FIELD_HEADER(name) \
rb_str_catf(buf, "+- %s:", name)
rb_str_catf(buf, "+- %s:", (name))
#define D_NULL_NODE A_INDENT; A("(null node)"); A("\n");
#define D_NODE_HEADER(node) A_INDENT; A_NODE_HEADER(node); A("\n");
#define COMPOUND_FIELD(name, name2, block) \
do { \
A_INDENT; A_FIELD_HEADER(comment ? name2 : name); A("\n"); \
A_INDENT; A_FIELD_HEADER(comment ? (name2) : (name)); A("\n"); \
rb_str_cat2(indent, next_indent); \
block; \
rb_str_resize(indent, RSTRING_LEN(indent) - 4); \
@ -38,7 +38,7 @@
#define SIMPLE_FIELD(name, name2, block) \
do { \
A_INDENT; A_FIELD_HEADER(comment ? name2 : name); A(" "); block; A("\n"); \
A_INDENT; A_FIELD_HEADER(comment ? (name2) : (name)); A(" "); block; A("\n"); \
} while (0)
#define F_CUSTOM1(name, ann, block) SIMPLE_FIELD(#name, #name " (" ann ")", block)