aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
authoryui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-31 00:46:30 +0000
committeryui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-31 00:46:30 +0000
commit20c27e854e6fab340099b1a82378981b021e9bc5 (patch)
treee4a888d5da822653a45addc4a319684c9d46e543 /parse.y
parent2349aa5e330aeadb28a0e0a568de4f14779c65f5 (diff)
downloadruby-20c27e854e6fab340099b1a82378981b021e9bc5.tar.gz
Use NODE_CASE2 if case expressions don't exist
When NODE_WHEN is compiled by iseq_compile_each0, the node passed to compile_when is NODE_WHEN (not NODE_CASE). So we can not handle the location of NODE_CASE of case statements which don't have case expressions. e.g. : ``` case; when 1; foo; when 2; bar; else baz; end ``` This commit adds NODE_CASE2, and compiles it by iseq_compile_each0. * compile.c (compile_case): Does not call COMPILE_ when NODE_CASE does not have case expressions. * compile.c (compile_case2): Compile NODE_CASE2 by compile_case2. * compile.c (compile_when): Delete an obsoleted function. * compile.c (iseq_compile_each0): Compile NODE_CASE2. * ext/objspace/objspace.c (count_nodes): Add NODE_CASE2 case. * node.c (dump_node, rb_gc_mark_node): Add NODE_CASE2 case. * node.h (node_type): Add NODE_CASE2. * node.h (NEW_CASE2): Add a macro which generates NODE_CASE2. * parse.y: Generate NODE_CASE2 if case expressions don't exist. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y2
1 files changed, 1 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index d83586cf57..3607b5c39c 100644
--- a/parse.y
+++ b/parse.y
@@ -2866,7 +2866,7 @@ primary : literal
| k_case opt_terms case_body k_end
{
/*%%%*/
- $$ = NEW_CASE(0, $3);
+ $$ = NEW_CASE2(0, $3);
nd_set_line($3, $<num>1);
nd_set_lineno($$, @1.first_line);
nd_set_column($$, @1.first_column);