31 lines
846 B
Java
31 lines
846 B
Java
package io.gitlab.jfronny.muscript.data.dynamic;
|
|
|
|
import io.gitlab.jfronny.muscript.ast.DynamicExpr;
|
|
import io.gitlab.jfronny.muscript.ast.dynamic.Call;
|
|
import io.gitlab.jfronny.muscript.ast.dynamic.Variable;
|
|
import io.gitlab.jfronny.muscript.compiler.CodeLocation;
|
|
|
|
import java.util.List;
|
|
|
|
public non-sealed interface DList extends Dynamic {
|
|
default Dynamic get(int i) {
|
|
return getValue().get(i);
|
|
}
|
|
|
|
default int size() {
|
|
return getValue().size();
|
|
}
|
|
|
|
default boolean isEmpty() {
|
|
return getValue().isEmpty();
|
|
}
|
|
|
|
@Override
|
|
default DynamicExpr toExpr() {
|
|
return new Call(CodeLocation.NONE, new Variable(CodeLocation.NONE, "listOf"), getValue().stream().map(s -> new Call.Arg(s.toExpr().asDynamicExpr(), false)).toList());
|
|
}
|
|
|
|
@Override
|
|
List<? extends Dynamic> getValue();
|
|
}
|