fix(muscript): it builds again
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
b2887a3ed6
commit
b91e15e352
@ -12,6 +12,7 @@ import io.gitlab.jfronny.muscript.error.LocationalException;
|
|||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -198,7 +199,7 @@ public class StandardLib {
|
|||||||
|
|
||||||
public static Dynamic<?> fold(DList args) {
|
public static Dynamic<?> fold(DList args) {
|
||||||
if (args.size() != 3) throw new IllegalArgumentException("Invalid number of arguments for fold: expected 3 but got " + args.size());
|
if (args.size() != 3) throw new IllegalArgumentException("Invalid number of arguments for fold: expected 3 but got " + args.size());
|
||||||
return args.get(0).asList().getValue().stream().reduce(args.get(1), args.get(2).asCallable()::call);
|
return args.get(0).asList().getValue().stream().<Dynamic<?>>map(Function.identity()).reduce(args.get(1), args.get(2).asCallable()::call);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Dynamic<?> forEach(DList args) {
|
public static Dynamic<?> forEach(DList args) {
|
||||||
|
@ -97,7 +97,7 @@ public class Call extends DynamicExpr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public record Arg(DynamicExpr expr, boolean variadic) {
|
public record Arg(DynamicExpr expr, boolean variadic) {
|
||||||
public Stream<Dynamic<?>> get(Scope dataRoot) {
|
public Stream<? extends Dynamic<?>> get(Scope dataRoot) {
|
||||||
return variadic ? expr.get(dataRoot).asList().getValue().stream() : Stream.of(expr.get(dataRoot));
|
return variadic ? expr.get(dataRoot).asList().getValue().stream() : Stream.of(expr.get(dataRoot));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,16 +3,14 @@ package io.gitlab.jfronny.muscript.data.dynamic.additional;
|
|||||||
import io.gitlab.jfronny.muscript.ast.DynamicExpr;
|
import io.gitlab.jfronny.muscript.ast.DynamicExpr;
|
||||||
import io.gitlab.jfronny.muscript.ast.dynamic.*;
|
import io.gitlab.jfronny.muscript.ast.dynamic.*;
|
||||||
import io.gitlab.jfronny.muscript.compiler.CodeLocation;
|
import io.gitlab.jfronny.muscript.compiler.CodeLocation;
|
||||||
import io.gitlab.jfronny.muscript.compiler.ExprWriter;
|
|
||||||
import io.gitlab.jfronny.muscript.data.dynamic.*;
|
import io.gitlab.jfronny.muscript.data.dynamic.*;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public record DCallableObject(Map<String, Dynamic<?>> value, DCallable callable) implements DObject {
|
public record DCallableObject(Map<String, ? extends Dynamic<?>> value, DCallable callable) implements DObject {
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Dynamic<?>> getValue() {
|
public Map<String, ? extends Dynamic<?>> getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,23 +5,22 @@ import io.gitlab.jfronny.muscript.ast.DynamicExpr;
|
|||||||
import io.gitlab.jfronny.muscript.ast.dynamic.Call;
|
import io.gitlab.jfronny.muscript.ast.dynamic.Call;
|
||||||
import io.gitlab.jfronny.muscript.ast.dynamic.Variable;
|
import io.gitlab.jfronny.muscript.ast.dynamic.Variable;
|
||||||
import io.gitlab.jfronny.muscript.ast.literal.StringLiteral;
|
import io.gitlab.jfronny.muscript.ast.literal.StringLiteral;
|
||||||
import io.gitlab.jfronny.muscript.compiler.*;
|
import io.gitlab.jfronny.muscript.compiler.CodeLocation;
|
||||||
import io.gitlab.jfronny.muscript.data.dynamic.*;
|
import io.gitlab.jfronny.muscript.data.dynamic.*;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An enum represented as an OObject.
|
* An enum represented as an OObject.
|
||||||
* May also have a selected value with automatic conversions to a number (index) and string
|
* May also have a selected value with automatic conversions to a number (index) and string
|
||||||
*/
|
*/
|
||||||
public record DEnum(Map<String, Dynamic<?>> values, @Nullable DEnumEntry value) implements DObject {
|
public record DEnum(Map<String, ? extends Dynamic<?>> values, @Nullable DEnumEntry value) implements DObject {
|
||||||
public DEnum(Map<String, Dynamic<?>> values) {
|
public DEnum(Map<String, ? extends Dynamic<?>> values) {
|
||||||
this(values, (DEnumEntry) null);
|
this(values, (DEnumEntry) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DEnum(Map<String, Dynamic<?>> values, @Nullable String value) {
|
public DEnum(Map<String, ? extends Dynamic<?>> values, @Nullable String value) {
|
||||||
this(values, value == null ? null : new DEnumEntry(value, values.keySet().stream().toList().indexOf(value), true));
|
this(values, value == null ? null : new DEnumEntry(value, values.keySet().stream().toList().indexOf(value), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,7 +33,7 @@ public record DEnum(Map<String, Dynamic<?>> values, @Nullable DEnumEntry value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Dynamic<?>> getValue() {
|
public Map<String, ? extends Dynamic<?>> getValue() {
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user