Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-05 11:00:05 +01:00
Improved accuracy of Function.getPosition() after optimization.
Dieser Commit ist enthalten in:
Ursprung
0ca66ce350
Commit
ef5fba0f05
@ -76,19 +76,24 @@ public class Function extends Invokable {
|
||||
public Invokable optimize() throws EvaluationException {
|
||||
final Invokable[] optimizedArgs = new Invokable[args.length];
|
||||
boolean optimizable = !method.isAnnotationPresent(Dynamic.class);
|
||||
int position = getPosition();
|
||||
for (int i = 0; i < args.length; ++i) {
|
||||
final Invokable optimized = optimizedArgs[i] = args[i].optimize();
|
||||
|
||||
if (!(optimized instanceof Constant)) {
|
||||
optimizable = false;
|
||||
}
|
||||
|
||||
if (optimized.getPosition() < position) {
|
||||
position = optimized.getPosition();
|
||||
}
|
||||
}
|
||||
|
||||
if (optimizable) {
|
||||
return new Constant(getPosition(), invoke());
|
||||
return new Constant(position, invoke());
|
||||
}
|
||||
else {
|
||||
return new Function(getPosition(), method, optimizedArgs);
|
||||
return new Function(position, method, optimizedArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren