ES6 Support Groundwork + Fixes #26

Merged
TopchetoEU merged 49 commits from ES6 into master 2024-09-05 14:26:07 +00:00
Showing only changes of commit 6932bea677 - Show all commits

View File

@ -1,29 +0,0 @@
package me.topchetoeu.jscript.compilation;
import java.util.function.Predicate;
public class Path<T extends Node> {
public final Path<?> parent;
public final Node node;
public Path<?> getParent(Predicate<Path<?>> predicate) {
for (Path<?> it = this; it != null; it = it.parent) {
if (predicate.test(it)) return it;
}
return null;
}
public Path<?> getParent(Class<? extends Node> type, Predicate<Path<?>> predicate) {
for (Path<?> it = this; it != null; it = it.parent) {
if (type.isInstance(it.node) && predicate.test(it)) return it;
}
return null;
}
public Path(Path<?> parent, Node node) {
this.parent = parent;
this.node = node;
}
}