mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-28 09:54:47 +00:00
Move VarargArguments factory to VarargArguments itself
This commit is contained in:
parent
e2189535b8
commit
7ad6132494
@ -41,7 +41,7 @@ class BasicFunction extends VarArgFunction
|
||||
@Override
|
||||
public Varargs invoke( LuaState luaState, Varargs args ) throws LuaError
|
||||
{
|
||||
IArguments arguments = CobaltLuaMachine.toArguments( args );
|
||||
IArguments arguments = VarargArguments.of( args );
|
||||
MethodResult results;
|
||||
try
|
||||
{
|
||||
|
@ -424,11 +424,6 @@ public class CobaltLuaMachine implements ILuaMachine
|
||||
return objects;
|
||||
}
|
||||
|
||||
static IArguments toArguments( Varargs values )
|
||||
{
|
||||
return values == Constants.NONE ? VarargArguments.EMPTY : new VarargArguments( values );
|
||||
}
|
||||
|
||||
/**
|
||||
* A {@link DebugHandler} which observes the {@link TimeoutState} and responds accordingly.
|
||||
*/
|
||||
|
@ -51,7 +51,7 @@ class ResultInterpreterFunction extends ResumableVarArgFunction<ResultInterprete
|
||||
@Override
|
||||
protected Varargs invoke( LuaState state, DebugFrame debugFrame, Varargs args ) throws LuaError, UnwindThrowable
|
||||
{
|
||||
IArguments arguments = CobaltLuaMachine.toArguments( args );
|
||||
IArguments arguments = VarargArguments.of( args );
|
||||
MethodResult results;
|
||||
try
|
||||
{
|
||||
|
@ -15,19 +15,24 @@ import javax.annotation.Nullable;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Optional;
|
||||
|
||||
class VarargArguments implements IArguments
|
||||
final class VarargArguments implements IArguments
|
||||
{
|
||||
static final IArguments EMPTY = new VarargArguments( Constants.NONE );
|
||||
private static final IArguments EMPTY = new VarargArguments( Constants.NONE );
|
||||
|
||||
boolean released;
|
||||
private final Varargs varargs;
|
||||
private Object[] cache;
|
||||
|
||||
VarargArguments( Varargs varargs )
|
||||
private VarargArguments( Varargs varargs )
|
||||
{
|
||||
this.varargs = varargs;
|
||||
}
|
||||
|
||||
static IArguments of( Varargs values )
|
||||
{
|
||||
return values == Constants.NONE ? EMPTY : new VarargArguments( values );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int count()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user