[ruby-cvs:67831] mame:r60650 (trunk): Avoid usage of the magic number `(NODE*)-1`

mame at ruby-lang.org mame at ruby-lang.org
Sat Nov 4 23:24:16 JST 2017


mame	2017-11-04 23:24:16 +0900 (Sat, 04 Nov 2017)

  New Revision: 60650

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60650

  Log:
    Avoid usage of the magic number `(NODE*)-1`
    
    This magic number has two meanings depending upon the context:
    
    * "required keyword argument (no name)" on NODE_LASGN (`def foo(x:)`)
    * "rest argument (no name)" on NODE_MASGN and NODE_POSTARG
      ('a, b, * = ary` or `a, b, *, z = ary`)
    
    To show this intention explicitly, two macros are introduced:
    NODE_SPECIAL_REQUIRED_KEYWORD and NODE_SPECIAL_NO_NAME_REST.

  Modified files:
    trunk/compile.c
    trunk/node.c
    trunk/node.h
    trunk/parse.y


More information about the ruby-cvs mailing list