refactor: make some classes final for performance
This commit is contained in:
parent
1ac6513c00
commit
acfdf23586
@ -7,7 +7,7 @@ import java.util.function.Supplier;
|
||||
|
||||
import me.topchetoeu.jscript.runtime.exceptions.InterruptException;
|
||||
|
||||
public class Engine implements EventLoop {
|
||||
public final class Engine implements EventLoop {
|
||||
private static class Task<T> implements Comparable<Task<?>> {
|
||||
public final Supplier<?> runnable;
|
||||
public final CompletableFuture<T> notifier = new CompletableFuture<T>();
|
||||
@ -74,7 +74,4 @@ public class Engine implements EventLoop {
|
||||
public boolean isRunning() {
|
||||
return this.thread != null;
|
||||
}
|
||||
|
||||
public Engine() {
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ import me.topchetoeu.jscript.runtime.values.functions.CodeFunction;
|
||||
import me.topchetoeu.jscript.runtime.values.objects.ObjectValue;
|
||||
import me.topchetoeu.jscript.runtime.values.objects.ScopeValue;
|
||||
|
||||
public class Frame {
|
||||
public final class Frame {
|
||||
public static final Key<Frame> KEY = Key.of();
|
||||
|
||||
public static enum TryState {
|
||||
|
@ -5,7 +5,7 @@ import me.topchetoeu.jscript.runtime.values.primitives.NumberValue;
|
||||
import me.topchetoeu.jscript.runtime.values.primitives.StringValue;
|
||||
import me.topchetoeu.jscript.runtime.values.primitives.SymbolValue;
|
||||
|
||||
public class KeyCache {
|
||||
public final class KeyCache {
|
||||
public final Value value;
|
||||
private Integer intCache;
|
||||
private Double doubleCache;
|
||||
|
@ -5,7 +5,7 @@ import me.topchetoeu.jscript.common.environment.Environment;
|
||||
import me.topchetoeu.jscript.runtime.Frame;
|
||||
import me.topchetoeu.jscript.runtime.values.Value;
|
||||
|
||||
public class CodeFunction extends FunctionValue {
|
||||
public final class CodeFunction extends FunctionValue {
|
||||
public final FunctionBody body;
|
||||
public final Value[][] captures;
|
||||
public Environment env;
|
||||
|
@ -3,7 +3,7 @@ package me.topchetoeu.jscript.runtime.values.functions;
|
||||
import me.topchetoeu.jscript.common.environment.Environment;
|
||||
import me.topchetoeu.jscript.runtime.values.Value;
|
||||
|
||||
public class NativeFunction extends FunctionValue {
|
||||
public final class NativeFunction extends FunctionValue {
|
||||
public static interface NativeFunctionRunner {
|
||||
Value run(Arguments args);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import me.topchetoeu.jscript.common.environment.Environment;
|
||||
import me.topchetoeu.jscript.runtime.values.Value;
|
||||
import me.topchetoeu.jscript.runtime.values.Member.FieldMember;
|
||||
|
||||
public class ScopeValue extends ObjectValue {
|
||||
public final class ScopeValue extends ObjectValue {
|
||||
private class VariableField extends FieldMember {
|
||||
private int i;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user