Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Commit

Permalink
expr: use Node
Browse files Browse the repository at this point in the history
  • Loading branch information
HoshinoTented committed Jan 4, 2024
1 parent 9c20bcc commit e14478c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions base/src/main/java/org/aya/syntax/concrete/expr/Expr.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.function.Function;
import java.util.function.UnaryOperator;

public sealed interface Expr {
Expand All @@ -25,20 +24,20 @@ record Node(@NotNull SourcePos sourcePos, @NotNull Expr expr) implements SourceN
record Param(
@NotNull SourcePos sourcePos,
@NotNull LocalVar ref,
@NotNull Expr type,
@NotNull Node type,
boolean explicit
// @ForLSP MutableValue<Result> theCore
) {
public Param(@NotNull SourcePos sourcePos, @NotNull LocalVar var, boolean explicit) {
this(sourcePos, var, new Hole(false, null), explicit);
this(sourcePos, var, new Node(sourcePos, new Hole(false, null)), explicit);
}

public @NotNull Param update(@NotNull Expr type) {
public @NotNull Param update(@NotNull Node type) {
return type == type() ? this : new Param(sourcePos, ref, type, explicit);
}

public @NotNull Param descent(@NotNull Function<@NotNull Expr, @NotNull Expr> f) {
return update(f.apply(type));
public @NotNull Param descent(@NotNull UnaryOperator<Expr> f) {
return update(type.map(f));
}
}

Expand Down

0 comments on commit e14478c

Please sign in to comment.