@@ -65,6 +65,30 @@ public static Object[] pack(
65
65
Object self ,
66
66
Object block ,
67
67
Object [] arguments ) {
68
+ assert assertValues (callerFrameOrVariables , method , declarationContext , self , block , arguments );
69
+
70
+ final Object [] packed = new Object [RUNTIME_ARGUMENT_COUNT + arguments .length ];
71
+
72
+ packed [ArgumentIndicies .DECLARATION_FRAME .ordinal ()] = declarationFrame ;
73
+ packed [ArgumentIndicies .CALLER_FRAME_OR_VARIABLES .ordinal ()] = callerFrameOrVariables ;
74
+ packed [ArgumentIndicies .METHOD .ordinal ()] = method ;
75
+ packed [ArgumentIndicies .DECLARATION_CONTEXT .ordinal ()] = declarationContext ;
76
+ packed [ArgumentIndicies .FRAME_ON_STACK_MARKER .ordinal ()] = frameOnStackMarker ;
77
+ packed [ArgumentIndicies .SELF .ordinal ()] = self ;
78
+ packed [ArgumentIndicies .BLOCK .ordinal ()] = block ;
79
+
80
+ ArrayUtils .arraycopy (arguments , 0 , packed , RUNTIME_ARGUMENT_COUNT , arguments .length );
81
+
82
+ return packed ;
83
+ }
84
+
85
+ public static boolean assertValues (
86
+ Object callerFrameOrVariables ,
87
+ InternalMethod method ,
88
+ DeclarationContext declarationContext ,
89
+ Object self ,
90
+ Object block ,
91
+ Object [] arguments ) {
68
92
assert method != null ;
69
93
assert declarationContext != null ;
70
94
assert self != null ;
@@ -76,26 +100,14 @@ public static Object[] pack(
76
100
callerFrameOrVariables instanceof SpecialVariableStorage ||
77
101
callerFrameOrVariables instanceof FrameAndVariables ;
78
102
79
- final Object [] packed = new Object [RUNTIME_ARGUMENT_COUNT + arguments .length ];
80
-
81
- packed [ArgumentIndicies .DECLARATION_FRAME .ordinal ()] = declarationFrame ;
82
- packed [ArgumentIndicies .CALLER_FRAME_OR_VARIABLES .ordinal ()] = callerFrameOrVariables ;
83
- packed [ArgumentIndicies .METHOD .ordinal ()] = method ;
84
- packed [ArgumentIndicies .DECLARATION_CONTEXT .ordinal ()] = declarationContext ;
85
- packed [ArgumentIndicies .FRAME_ON_STACK_MARKER .ordinal ()] = frameOnStackMarker ;
86
- packed [ArgumentIndicies .SELF .ordinal ()] = self ;
87
-
88
103
/* The block in the arguments array is always either a Nil or RubyProc. The provision of Nil if the caller
89
104
* doesn't want to provide a block is done at the caller, because it will know the type of values within its
90
105
* compilation unit.
91
106
*
92
107
* When you read the block back out in the callee, you'll therefore get a Nil or RubyProc. */
93
108
assert block instanceof Nil || block instanceof RubyProc : block ;
94
- packed [ArgumentIndicies .BLOCK .ordinal ()] = block ;
95
-
96
- ArrayUtils .arraycopy (arguments , 0 , packed , RUNTIME_ARGUMENT_COUNT , arguments .length );
97
109
98
- return packed ;
110
+ return true ;
99
111
}
100
112
101
113
// Getters
0 commit comments