mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2025-02-11 13:10:15 +08:00
Remove some static imports
This commit is contained in:
parent
cd9414631a
commit
b291159cbd
@ -72,7 +72,6 @@
|
||||
import static com.sk89q.worldedit.internal.expression.ExpressionHelper.getArgumentHandleName;
|
||||
import static com.sk89q.worldedit.internal.expression.ExpressionHelper.resolveFunction;
|
||||
import static com.sk89q.worldedit.internal.expression.invoke.ExpressionHandles.CALL_BINARY_OP;
|
||||
import static com.sk89q.worldedit.internal.expression.invoke.ExpressionHandles.COMPILED_EXPRESSION_SIG;
|
||||
import static com.sk89q.worldedit.internal.expression.invoke.ExpressionHandles.DOUBLE_TO_BOOL;
|
||||
import static com.sk89q.worldedit.internal.expression.invoke.ExpressionHandles.IS_NULL;
|
||||
import static com.sk89q.worldedit.internal.expression.invoke.ExpressionHandles.NEW_LS_CONSTANT;
|
||||
@ -138,7 +137,7 @@ private ExecNode evaluate(ParserRuleContext ctx) {
|
||||
}
|
||||
|
||||
private void checkHandle(MethodHandle mh, ParserRuleContext ctx) {
|
||||
check(mh.type().equals(COMPILED_EXPRESSION_SIG), ctx,
|
||||
check(mh.type().equals(ExpressionHandles.COMPILED_EXPRESSION_SIG), ctx,
|
||||
"Incorrect type returned from handler for " + ctx.getClass());
|
||||
}
|
||||
|
||||
@ -593,7 +592,7 @@ public MethodHandle visitFunctionCall(ExpressionParser.FunctionCallContext ctx)
|
||||
// Collapse every data into one argument
|
||||
int[] permutation = new int[arguments.length];
|
||||
return permuteArguments(
|
||||
manyData, COMPILED_EXPRESSION_SIG, permutation
|
||||
manyData, ExpressionHandles.COMPILED_EXPRESSION_SIG, permutation
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -29,8 +29,6 @@
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.invoke.MethodType;
|
||||
|
||||
import static com.sk89q.worldedit.internal.expression.invoke.ExpressionHandles.COMPILED_EXPRESSION_SIG;
|
||||
import static com.sk89q.worldedit.internal.expression.invoke.ExpressionHandles.safeInvoke;
|
||||
import static java.lang.invoke.MethodType.methodType;
|
||||
|
||||
/**
|
||||
@ -45,7 +43,7 @@ public class ExpressionCompiler {
|
||||
private static final MethodHandle HANDLE_TO_CE_CONVERTER;
|
||||
|
||||
static {
|
||||
MethodHandle handleInvoker = MethodHandles.invoker(COMPILED_EXPRESSION_SIG);
|
||||
MethodHandle handleInvoker = MethodHandles.invoker(ExpressionHandles.COMPILED_EXPRESSION_SIG);
|
||||
try {
|
||||
HANDLE_TO_CE_CONVERTER = LambdaMetafactory.metafactory(
|
||||
MethodHandles.lookup(),
|
||||
@ -54,11 +52,11 @@ public class ExpressionCompiler {
|
||||
// Take a handle, to be converted to CompiledExpression
|
||||
HANDLE_TO_CE,
|
||||
// Raw signature for SAM type
|
||||
COMPILED_EXPRESSION_SIG,
|
||||
ExpressionHandles.COMPILED_EXPRESSION_SIG,
|
||||
// Handle to call the captured handle.
|
||||
handleInvoker,
|
||||
// Actual signature at invoke time
|
||||
COMPILED_EXPRESSION_SIG
|
||||
ExpressionHandles.COMPILED_EXPRESSION_SIG
|
||||
).dynamicInvoker().asType(HANDLE_TO_CE);
|
||||
} catch (LambdaConversionException e) {
|
||||
throw new IllegalStateException("Failed to load ExpressionCompiler MetaFactory", e);
|
||||
@ -68,7 +66,7 @@ public class ExpressionCompiler {
|
||||
public CompiledExpression compileExpression(ExpressionParser.AllStatementsContext root,
|
||||
SetMultimap<String, MethodHandle> functions) {
|
||||
MethodHandle invokable = root.accept(new CompilingVisitor(functions));
|
||||
return (CompiledExpression) safeInvoke(
|
||||
return (CompiledExpression) ExpressionHandles.safeInvoke(
|
||||
HANDLE_TO_CE_CONVERTER, h -> h.invoke(invokable)
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user