@@ -5,19 +5,26 @@ module YARV
55 # This is an operand to various YARV instructions that represents the
66 # information about a specific call site.
77 class CallData
8- CALL_ARGS_SPLAT = 1 << 0
9- CALL_ARGS_BLOCKARG = 1 << 1
10- CALL_FCALL = 1 << 2
11- CALL_VCALL = 1 << 3
12- CALL_ARGS_SIMPLE = 1 << 4
13- CALL_BLOCKISEQ = 1 << 5
14- CALL_KWARG = 1 << 6
15- CALL_KW_SPLAT = 1 << 7
16- CALL_TAILCALL = 1 << 8
17- CALL_SUPER = 1 << 9
18- CALL_ZSUPER = 1 << 10
19- CALL_OPT_SEND = 1 << 11
20- CALL_KW_SPLAT_MUT = 1 << 12
8+ flags = %i[
9+ CALL_ARGS_SPLAT
10+ CALL_ARGS_BLOCKARG
11+ CALL_FCALL
12+ CALL_VCALL
13+ CALL_ARGS_SIMPLE
14+ CALL_KWARG
15+ CALL_KW_SPLAT
16+ CALL_TAILCALL
17+ CALL_SUPER
18+ CALL_ZSUPER
19+ CALL_OPT_SEND
20+ CALL_KW_SPLAT_MUT
21+ ]
22+
23+ # Insert the legacy CALL_BLOCKISEQ flag for Ruby 3.2 and earlier.
24+ flags . insert ( 5 , :CALL_BLOCKISEQ ) if RUBY_VERSION < "3.3"
25+
26+ # Set the flags as constants on the class.
27+ flags . each_with_index { |name , index | const_set ( name , 1 << index ) }
2128
2229 attr_reader :method , :argc , :flags , :kw_arg
2330
@@ -50,7 +57,6 @@ def inspect
5057 names << :FCALL if flag? ( CALL_FCALL )
5158 names << :VCALL if flag? ( CALL_VCALL )
5259 names << :ARGS_SIMPLE if flag? ( CALL_ARGS_SIMPLE )
53- names << :BLOCKISEQ if flag? ( CALL_BLOCKISEQ )
5460 names << :KWARG if flag? ( CALL_KWARG )
5561 names << :KW_SPLAT if flag? ( CALL_KW_SPLAT )
5662 names << :TAILCALL if flag? ( CALL_TAILCALL )
0 commit comments