aboutsummaryrefslogtreecommitdiffstats
path: root/compile.c
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-24 06:16:31 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-24 06:16:31 +0000
commite044a59504aa97f6178c7f72f84cf8e5e2068e6b (patch)
treec3110ced5a14785b9b2afd2f03c1cc1a08aa8a8b /compile.c
parentd10bc8f974c1bd6b39394d734942aa9f872bc96b (diff)
downloadruby-e044a59504aa97f6178c7f72f84cf8e5e2068e6b.tar.gz
Remove dynamic NODE allocation out of parser
A temporary NODE object was allocated to create iseq. Instead, this patch allocates a dummy NODE as auto variable, and discard it soon. This change is intended as a preparation to manage AST NODEs out of GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/compile.c b/compile.c
index 8c7676d4c9..a1887521a0 100644
--- a/compile.c
+++ b/compile.c
@@ -3963,11 +3963,14 @@ defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *const ret,
int line = nd_line(node);
LABEL *lstart = NEW_LABEL(line);
LABEL *lend = NEW_LABEL(line);
- const rb_iseq_t *rescue = NEW_CHILD_ISEQ(NEW_NIL(),
- rb_str_concat(rb_str_new2
- ("defined guard in "),
- iseq->body->location.label),
- ISEQ_TYPE_DEFINED_GUARD, 0);
+ const rb_iseq_t *rescue;
+ NODE tmp_node, *node = &tmp_node;
+ rb_node_init(node, NODE_NIL, 0, 0, 0);
+ rescue = NEW_CHILD_ISEQ(node,
+ rb_str_concat(rb_str_new2
+ ("defined guard in "),
+ iseq->body->location.label),
+ ISEQ_TYPE_DEFINED_GUARD, 0);
lstart->rescued = LABEL_RESCUE_BEG;
lend->rescued = LABEL_RESCUE_END;
APPEND_LABEL(ret, lcur, lstart);