mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-08-23 05:58:14 +00:00
Remove empty-argument optimisation
This doesn't work with getTableUnsafe, as empty arguments are considered closed already. We could argubly special-case the empty args, but the optimisation has very minor benefits, so I don't think worrying about too much. Fixes #2246.
This commit is contained in:
parent
00475b9bb0
commit
5f16909d4b
@ -20,13 +20,8 @@ import static org.squiddev.cobalt.Constants.NAME;
|
||||
final class VarargArguments implements IArguments {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(VarargArguments.class);
|
||||
|
||||
private static final VarargArguments EMPTY = new VarargArguments(Constants.NONE);
|
||||
private static boolean reportedIllegalGet;
|
||||
|
||||
static {
|
||||
EMPTY.escapes = EMPTY.closed = true;
|
||||
}
|
||||
|
||||
private final Varargs varargs;
|
||||
|
||||
private volatile boolean closed;
|
||||
@ -51,7 +46,7 @@ final class VarargArguments implements IArguments {
|
||||
}
|
||||
|
||||
static VarargArguments of(Varargs values) {
|
||||
return values == Constants.NONE ? EMPTY : new VarargArguments(values);
|
||||
return new VarargArguments(values);
|
||||
}
|
||||
|
||||
boolean isClosed() {
|
||||
@ -138,9 +133,7 @@ final class VarargArguments implements IArguments {
|
||||
if (count < 0) throw new IllegalStateException("count cannot be negative");
|
||||
if (count == 0) return this;
|
||||
|
||||
var newArgs = varargs.subargs(count + 1);
|
||||
if (newArgs == Constants.NONE) return EMPTY;
|
||||
return new VarargArguments(newArgs, this, count);
|
||||
return new VarargArguments(varargs.subargs(count + 1), this, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user