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