aboutsummaryrefslogtreecommitdiffstats
path: root/node.h
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2019-09-10 14:00:48 -0700
committerAaron Patterson <tenderlove@ruby-lang.org>2019-09-10 14:00:48 -0700
commit91ee9584f9a3e8b8e5e0e9c2f1f2b229ca10323e (patch)
tree6126a870d9d99cf52dca474b7b59064b3579b935 /node.h
parent139510238bcbb8d7fd8022c23a603c51d2acbe2e (diff)
downloadruby-91ee9584f9a3e8b8e5e0e9c2f1f2b229ca10323e.tar.gz
Macros can't be expressions, so make a function
Macros can't be expressions, that is a GNU extension (I didn't know that). This commit converts the macro to a function so that everything will compile correctly on non-GNU compatible compilers.
Diffstat (limited to 'node.h')
-rw-r--r--node.h8
1 files changed, 2 insertions, 6 deletions
diff --git a/node.h b/node.h
index 6d4ee686f9..73b9444214 100644
--- a/node.h
+++ b/node.h
@@ -281,15 +281,11 @@ typedef struct RNode {
#define nd_apinfo u3.apinfo
#define NEW_NODE(t,a0,a1,a2,loc) rb_node_newnode((t),(VALUE)(a0),(VALUE)(a1),(VALUE)(a2),loc)
+#define NEW_NODE_WITH_LOCALS(t,a1,a2,loc) node_newnode_with_locals(p, (t),(VALUE)(a1),(VALUE)(a2),loc)
#define NEW_DEFN(i,a,d,loc) NEW_NODE(NODE_DEFN,0,i,NEW_SCOPE(a,d,loc),loc)
#define NEW_DEFS(r,i,a,d,loc) NEW_NODE(NODE_DEFS,r,i,NEW_SCOPE(a,d,loc),loc)
-#define NEW_SCOPE(a,b,loc) ({ \
- VALUE tbl = 0; \
- NODE * _n = NEW_NODE(NODE_SCOPE,local_tbl(p, &tbl),b,a,loc); \
- tbl && RB_OBJ_WRITTEN(p->ast, Qnil, tbl); \
- _n; \
-})
+#define NEW_SCOPE(a,b,loc) NEW_NODE_WITH_LOCALS(NODE_SCOPE,b,a,loc)
#define NEW_BLOCK(a,loc) NEW_NODE(NODE_BLOCK,a,0,0,loc)
#define NEW_IF(c,t,e,loc) NEW_NODE(NODE_IF,c,t,e,loc)
#define NEW_UNLESS(c,t,e,loc) NEW_NODE(NODE_UNLESS,c,t,e,loc)