muScript: clean up

This commit is contained in:
Johannes Frohnmeyer 2023-03-11 17:02:03 +01:00
parent 4be87948a3
commit 51db36f53f
Signed by: Johannes
GPG Key ID: E76429612C2929F4
3 changed files with 8 additions and 4 deletions

View File

@ -6,7 +6,6 @@ import io.gitlab.jfronny.muscript.data.Scope;
import io.gitlab.jfronny.muscript.data.dynamic.*;
import io.gitlab.jfronny.muscript.error.LocationalException;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.IntStream;

View File

@ -68,7 +68,7 @@ public class Parser {
} catch (RuntimeException e) {
if (e instanceof ParseException) throw e;
else if (e instanceof LocationalException le) {
throw new ParseException(le.asPrintable(lexer.source));
throw new ParseException(le.asPrintable(lexer.source), le.getCause());
} else throw error(e.getMessage());
}
}
@ -436,5 +436,10 @@ public class Parser {
super(error.toString());
this.error = error;
}
public ParseException(LocationalError error, Throwable cause) {
super(error.toString(), cause);
this.error = error;
}
}
}

View File

@ -8,7 +8,7 @@ import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
public class ReflectTest {
class ReflectTest {
private static final String CLASS_NAME = "some.other.location.ToConstruct";
@Test
@ -67,7 +67,7 @@ public class ReflectTest {
}
@Test
void noArgFunction() { //TODO fix
void noArgFunction() {
assertEquals(assertDoesNotThrow(() -> Reflect.staticFunction(CLASS_NAME, "function", String.class).get()), InstanceConstruct.getLastProc().toString());
}