[ruby-cvs:67766] yui-knk:r60585 (trunk): Use NODE_CASE2 if case expressions don't exist
yui-knk at ruby-lang.org
yui-knk at ruby-lang.org
Tue Oct 31 09:46:30 JST 2017
yui-knk 2017-10-31 09:46:30 +0900 (Tue, 31 Oct 2017)
New Revision: 60585
https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60585
Log:
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.
Modified files:
trunk/compile.c
trunk/ext/objspace/objspace.c
trunk/node.c
trunk/node.h
trunk/parse.y
More information about the ruby-cvs
mailing list