|
18 | 18 | import com.oracle.truffle.api.library.Message;
|
19 | 19 | import com.oracle.truffle.api.library.ReflectionLibrary;
|
20 | 20 |
|
| 21 | +import org.truffleruby.core.array.ArrayUtils; |
21 | 22 | import org.truffleruby.language.dispatch.CallDispatchHeadNode;
|
22 | 23 |
|
23 | 24 | @ExportLibrary(ReflectionLibrary.class)
|
@@ -49,21 +50,12 @@ protected Object send(Message message, Object[] rawArgs,
|
49 | 50 | if (message == EXECUTABLE || message == INSTANTIATE) {
|
50 | 51 | args = (Object[]) rawArgs[0];
|
51 | 52 | } else if (message == INVOKE) {
|
52 |
| - Object[] invokeArgs = (Object[]) rawArgs[1]; |
53 |
| - args = new Object[invokeArgs.length + 1]; |
54 |
| - args[0] = rawArgs[0]; |
55 |
| - System.arraycopy(invokeArgs, 0, args, 1, invokeArgs.length); |
| 53 | + args = ArrayUtils.unshift((Object[])rawArgs[1], rawArgs[0]); |
56 | 54 | } else {
|
57 | 55 | args = rawArgs;
|
58 | 56 | }
|
59 |
| - Object[] loggingArgs = new Object[args.length + 1]; |
60 |
| - loggingArgs[0] = message.getSimpleName(); |
61 |
| - System.arraycopy(args, 0, loggingArgs, 1, args.length); |
| 57 | + Object[] loggingArgs = ArrayUtils.unshift(args, message.getSimpleName()); |
62 | 58 | Object[] convertedArgs = foreignToRubyArgumentsNode.executeConvert(loggingArgs);
|
63 |
| - for (int i = 0; i < convertedArgs.length; i++) { |
64 |
| - if (convertedArgs[i] instanceof Object[]) { |
65 |
| - } |
66 |
| - } |
67 | 59 | dispatchNode.call(logger, "log", convertedArgs);
|
68 | 60 | }
|
69 | 61 |
|
|
0 commit comments