All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.hollowcube.mql.tree.MqlAccessExpr Maven / Gradle / Ivy

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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy