diff --git a/common/src/main/java/li/cil/tis3d/common/module/execution/compiler/instruction/AbstractInstructionEmitter.java b/common/src/main/java/li/cil/tis3d/common/module/execution/compiler/instruction/AbstractInstructionEmitter.java index c63261c9..f0b1d2cc 100644 --- a/common/src/main/java/li/cil/tis3d/common/module/execution/compiler/instruction/AbstractInstructionEmitter.java +++ b/common/src/main/java/li/cil/tis3d/common/module/execution/compiler/instruction/AbstractInstructionEmitter.java @@ -55,6 +55,7 @@ static Object checkTargetOrNumber(String name, final int lineNumber, final Map defines, final int start, final int end) throws ParseException { name = defines.getOrDefault(name, name); try { diff --git a/common/src/main/java/li/cil/tis3d/common/module/execution/compiler/instruction/MoveInstructionEmitter.java b/common/src/main/java/li/cil/tis3d/common/module/execution/compiler/instruction/MoveInstructionEmitter.java index 9436c825..156e82cc 100644 --- a/common/src/main/java/li/cil/tis3d/common/module/execution/compiler/instruction/MoveInstructionEmitter.java +++ b/common/src/main/java/li/cil/tis3d/common/module/execution/compiler/instruction/MoveInstructionEmitter.java @@ -15,12 +15,6 @@ import java.util.regex.Matcher; public final class MoveInstructionEmitter extends AbstractInstructionEmitter { - private static void validateLabel(final MachineState state, final String label, final Matcher matcher, final int lineNumber) throws ParseException { - if (!state.labels.containsKey(label)) { - throw new ParseException(Strings.MESSAGE_LABEL_NOT_FOUND, lineNumber, matcher.start("arg1"), matcher.end("arg1")); - } - } - @Override public Instruction compile(final Matcher matcher, final int lineNumber, final Map defines, final List validators) throws ParseException { final Object src = checkTargetOrNumberOrLabel(checkArg(lineNumber, matcher, "arg1", "name"), @@ -33,7 +27,7 @@ public Instruction compile(final Matcher matcher, final int lineNumber, final Ma return new MoveInstruction(target, dst); } else if (src instanceof final Short value) { return new MoveImmediateInstruction(value, dst); - } else if (src instanceof String){ + } else if (src instanceof String) { final String label = checkArg(lineNumber, matcher, "arg1", "name"); validators.add(state -> validateLabel(state, label, matcher, lineNumber)); return new MoveLabelInstruction(label, dst); @@ -41,4 +35,10 @@ public Instruction compile(final Matcher matcher, final int lineNumber, final Ma throw new AssertionError(); } } + + private static void validateLabel(final MachineState state, final String label, final Matcher matcher, final int lineNumber) throws ParseException { + if (!state.labels.containsKey(label)) { + throw new ParseException(Strings.MESSAGE_LABEL_NOT_FOUND, lineNumber, matcher.start("arg1"), matcher.end("arg1")); + } + } } diff --git a/common/src/main/java/li/cil/tis3d/common/module/execution/instruction/JumpAbsoluteImmediateInstruction.java b/common/src/main/java/li/cil/tis3d/common/module/execution/instruction/JumpAbsoluteImmediateInstruction.java index 0331b647..0e66552f 100644 --- a/common/src/main/java/li/cil/tis3d/common/module/execution/instruction/JumpAbsoluteImmediateInstruction.java +++ b/common/src/main/java/li/cil/tis3d/common/module/execution/instruction/JumpAbsoluteImmediateInstruction.java @@ -1,8 +1,6 @@ package li.cil.tis3d.common.module.execution.instruction; import li.cil.tis3d.common.module.execution.Machine; -import li.cil.tis3d.common.module.execution.target.Target; -import li.cil.tis3d.common.module.execution.target.TargetInterface; public class JumpAbsoluteImmediateInstruction implements Instruction { private final short pc;