diff --git a/muscript/src/main/java/io/gitlab/jfronny/muscript/ast/dynamic/Closure.java b/muscript/src/main/java/io/gitlab/jfronny/muscript/ast/dynamic/Closure.java index 801961b..ff0abb9 100644 --- a/muscript/src/main/java/io/gitlab/jfronny/muscript/ast/dynamic/Closure.java +++ b/muscript/src/main/java/io/gitlab/jfronny/muscript/ast/dynamic/Closure.java @@ -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; diff --git a/muscript/src/main/java/io/gitlab/jfronny/muscript/compiler/Parser.java b/muscript/src/main/java/io/gitlab/jfronny/muscript/compiler/Parser.java index 0e29654..2ef8c6b 100644 --- a/muscript/src/main/java/io/gitlab/jfronny/muscript/compiler/Parser.java +++ b/muscript/src/main/java/io/gitlab/jfronny/muscript/compiler/Parser.java @@ -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; + } } } diff --git a/src/test/java/io/gitlab/jfronny/commons/test/ReflectTest.java b/src/test/java/io/gitlab/jfronny/commons/test/ReflectTest.java index 3533dcf..136c09f 100644 --- a/src/test/java/io/gitlab/jfronny/commons/test/ReflectTest.java +++ b/src/test/java/io/gitlab/jfronny/commons/test/ReflectTest.java @@ -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()); }