java-commons/muscript/src/main/java/io/gitlab/jfronny/muscript/ast/NumberExpr.java

25 lines
638 B
Java

package io.gitlab.jfronny.muscript.ast;
import io.gitlab.jfronny.muscript.ast.dynamic.DynamicCoerce;
import io.gitlab.jfronny.muscript.compiler.Order;
import io.gitlab.jfronny.muscript.compiler.Type;
public abstract non-sealed class NumberExpr extends Expr<Double> {
protected NumberExpr(Order order, int chStart, int chEnd) {
super(order, chStart, chEnd);
}
@Override
public Type getResultType() {
return Type.Number;
}
@Override
public abstract NumberExpr optimize();
@Override
public DynamicExpr asDynamicExpr() {
return new DynamicCoerce(chStart, chEnd, this);
}
}