Skip to content

Commit

Permalink
free: fix one test
Browse files Browse the repository at this point in the history
  • Loading branch information
ice1000 committed Jan 4, 2025
1 parent f2787de commit fc0f4ae
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020-2024 Tesla (Yinsen) Zhang.
// Copyright (c) 2020-2025 Tesla (Yinsen) Zhang.
// Use of this source code is governed by the MIT license that can be found in the LICENSE.md file.
package org.aya.compiler.free.morphism.free;

Expand All @@ -8,22 +8,19 @@
import org.jetbrains.annotations.NotNull;

public record FreeArgumentProvider(int paramCount) implements ArgumentProvider {
@Override
public @NotNull LocalVariable arg(int nth) {
@Override public @NotNull LocalVariable arg(int nth) {
assert nth < paramCount;
return new FreeVariable.Arg(nth);
}

record Lambda(int captureCount, int paramCount) implements ArgumentProvider.Lambda {
@Override
public @NotNull FreeJavaExpr capture(int nth) {
@Override public @NotNull FreeJavaExpr capture(int nth) {
assert nth < captureCount;
return new FreeExpr.RefCapture(nth);
}

@Override
public @NotNull LocalVariable arg(int nth) {
assert nth + captureCount < paramCount;
@Override public @NotNull LocalVariable arg(int nth) {
assert nth < paramCount;
return new FreeVariable.Arg(nth);
}
}
Expand Down

0 comments on commit fc0f4ae

Please sign in to comment.