Skip to content

Commit 357d40e

Browse files
committed
Tidy-up.
1 parent fb30b2f commit 357d40e

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

src/main/java/org/byteskript/skript/lang/syntax/config/ConfigFile.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ public void compileInline(Context context, Pattern.Match match) throws Throwable
106106

107107
@Override
108108
public boolean allowAsInputFor(Type type) {
109-
return CommonTypes.OBJECT.equals(type) || CommonTypes.REFERENT.equals(type) || CommonTypes.CONFIG.equals(type) || super.allowAsInputFor(type);
109+
return CommonTypes.OBJECT.equals(type)
110+
|| CommonTypes.REFERENT.equals(type)
111+
|| CommonTypes.CONFIG.equals(type)
112+
|| super.allowAsInputFor(type);
110113
}
111114

112115
@Override
@@ -121,6 +124,7 @@ static class ConfigTree extends BasicTree {
121124
public ConfigTree(SectionMeta owner) {
122125
super(owner);
123126
}
127+
124128
}
125129

126130
}

src/main/java/org/byteskript/skript/lang/syntax/function/ExternalFunctionExpression.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,12 @@ private Type[] getParams(String params) {
7070
if (params.isBlank()) return new Type[0];
7171
int nest = 0;
7272
final List<Type> types = new ArrayList<>();
73-
int count = 1;
7473
boolean atomic = false;
7574
for (char c : params.toCharArray()) {
7675
if (c == '(') nest++;
7776
else if (c == ')') nest--;
7877
else if (c == '@' && nest < 1) atomic = true;
7978
else if (c == ',' && nest < 1) {
80-
count++;
8179
if (atomic) types.add(CommonTypes.ATOMIC);
8280
else types.add(CommonTypes.OBJECT);
8381
atomic = false;
@@ -89,8 +87,7 @@ else if (c == ',' && nest < 1) {
8987
}
9088

9189
private String buildDummyPattern(String name, int params, String location) {
92-
final StringBuilder builder = new StringBuilder()
93-
.append(name).append("\\(");
90+
final StringBuilder builder = new StringBuilder().append(name).append("\\(");
9491
if (params > 0) {
9592
for (int i = 0; i < params; i++) {
9693
if (i > 0) builder.append(", ");
@@ -107,9 +104,8 @@ public Type getReturnType() {
107104

108105
@Override
109106
public void preCompile(Context context, Pattern.Match match) throws Throwable {
110-
for (final ElementTree tree : context.getCompileCurrent().nested()) {
111-
tree.takeAtomic = true;
112-
}
107+
final ElementTree[] trees = context.getCompileCurrent().nested();
108+
for (final ElementTree tree : trees) tree.takeAtomic = true;
113109
super.preCompile(context, match);
114110
}
115111

src/main/java/org/byteskript/skript/lang/syntax/generic/PropertyExpression.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public Pattern.Match match(String thing, Context context) {
6363
final Matcher matcher = pattern.matcher(thing);
6464
if (!matcher.find()) return null;
6565
final String name = matcher.group("name");
66-
final Matcher dummy = createDummy(thing, i, matcher);
66+
final Matcher dummy = this.createDummy(thing, i, matcher);
6767
dummy.find();
6868
return new Pattern.Match(dummy, name, CommonTypes.OBJECT);
6969
}

src/main/java/org/byteskript/skript/runtime/UnsafeAccessor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ class UnsafeAccessor {
2525
static {
2626
try {
2727
UNSAFE = java.security.AccessController.doPrivileged((PrivilegedExceptionAction<Unsafe>) () -> {
28-
final Field f = Unsafe.class.getDeclaredField("theUnsafe");
29-
f.setAccessible(true);
30-
return (Unsafe) f.get(null);
28+
final Field field = Unsafe.class.getDeclaredField("theUnsafe");
29+
field.setAccessible(true);
30+
return (Unsafe) field.get(null);
3131
});
3232
} catch (PrivilegedActionException e) {
3333
throw new RuntimeException(e);

src/main/java/org/byteskript/skript/runtime/internal/EventHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ public List<ScriptRunner> getTriggers() {
2525
}
2626

2727
public void run(final Skript skript, final Event event) {
28-
for (ScriptRunner trigger : triggers) {
28+
for (final ScriptRunner trigger : triggers) {
2929
skript.runScript(trigger, event);
3030
}
3131
}
3232

3333
public void run(final Skript skript, final Event event, final Script script) {
34-
for (ScriptRunner trigger : triggers) {
34+
for (final ScriptRunner trigger : triggers) {
3535
if (trigger.owner() == script.mainClass())
3636
skript.runScript(trigger, event);
3737
}

0 commit comments

Comments
 (0)