net.hollowcube.mql.tree.MqlAccessExpr Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mql Show documentation
Show all versions of mql Show documentation
An interpreter and JIT compiler for a subset of Molang
The newest version!
package net.hollowcube.mql.tree;
import net.hollowcube.mql.runtime.MqlScope;
import net.hollowcube.mql.value.MqlHolder;
import net.hollowcube.mql.value.MqlValue;
import org.jetbrains.annotations.NotNull;
public record MqlAccessExpr(
@NotNull MqlExpr lhs, String target) implements MqlExpr {
@Override
public MqlValue evaluate(@NotNull MqlScope scope) {
var lhs = lhs().evaluate(scope).cast(MqlHolder.class);
return lhs.get(target());
}
@Override
public R visit(@NotNull MqlVisitor
visitor, P p) {
return visitor.visitAccessExpr(this, p);
}
}