Skip to content

Commit

Permalink
Minor tidy-up.
Browse files Browse the repository at this point in the history
  • Loading branch information
Moderocky committed Jan 8, 2022
1 parent 5a532d4 commit 09c1aab
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/byteskript/skript/api/Property.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public interface Property extends Referent {
default void compile(Context context, Pattern.Match match) throws Throwable {
final MethodBuilder method = context.getMethod();
assert method != null;
final Method target = getHandler(StandardHandlers.GET);
final Method target = this.getHandler(StandardHandlers.GET);
if (target == null) throw new ScriptCompileError(context.lineNumber(), "Referent has no get handler.");
if (target.getReturnType() == void.class)
throw new ScriptCompileError(context.lineNumber(), "Referent get handler must not have a void return.");
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/byteskript/skript/api/Referent.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@

import java.lang.reflect.Method;

/**
* This syntax is designed to be set or altered in some way.
*/
public interface Referent extends SyntaxElement {

Type getHolderType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ default void generateSyntaxFrom(Class<?> owner) {
if (section == null) break entry_section;
final GeneratedEntrySection box = new GeneratedEntrySection(this, (Class<Record>) owner, section.value());
this.registerSyntax(CompileState.MEMBER_BODY, box);
for (RecordComponent component : owner.getRecordComponents()) {
for (final RecordComponent component : owner.getRecordComponents()) {
final EntryNode node = component.getAnnotation(EntryNode.class);
if (node == null) continue;
final GeneratedEntryNode thing = new GeneratedEntryNode(this, component, node.value());
this.registerSyntax(CompileState.AREA_BODY, thing);
}
}
for (Method method : owner.getDeclaredMethods()) {
for (final Method method : owner.getDeclaredMethods()) {
effect:
{
final Effect effect = method.getAnnotation(Effect.class);
Expand Down Expand Up @@ -83,7 +83,7 @@ default void generateSyntaxFrom(Class<?> owner) {
void registerProperty(String name, HandlerType type, Method handler);

default void registerValues(EventHolder event) {
for (Method method : event.eventClass().getMethods()) {
for (final Method method : event.eventClass().getMethods()) {
final EventValue value = method.getAnnotation(EventValue.class);
if (value == null) continue;
if (method.getParameterTypes().length == 0 && method.getReturnType() != void.class) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
@FunctionalInterface
public interface Query {

boolean check(Object vaue);
boolean check(Object value);

}

0 comments on commit 09c1aab

Please sign in to comment.