java-commons/muscript/src/main/java/io/gitlab/jfronny/muscript/compiler/CodeLocation.java
JFronny 79d862da6c
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
perf: extract side effects of top-level expressions
2023-09-21 14:10:41 +02:00

26 lines
691 B
Java

package io.gitlab.jfronny.muscript.compiler;
import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
public record CodeLocation(int chStart, int chEnd, @Nullable String source, @Nullable String file) {
public static final CodeLocation NONE = new CodeLocation(-1, -1);
public CodeLocation(int chStart, int chEnd) {
this(chStart, chEnd, null, null);
}
public CodeLocation(int ch) {
this(ch, ch);
}
public CodeLocation withSource(String source) {
return new CodeLocation(chStart, chEnd, source, file);
}
public CodeLocation withFile(String file) {
return new CodeLocation(chStart, chEnd, source, file);
}
}