From 8f03a9fb5d65c44762edd478d964935da5f2c85a Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 17 Jun 2023 21:08:21 +0100 Subject: Introduce FreeVariables collection type --- .../compiler/backends/llvm/LlvmCompilerDefineFunctionTests.java | 7 +++---- .../org/shedlang/compiler/stackir/InstructionSerializerTests.java | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'src/test/java/org') diff --git a/src/test/java/org/shedlang/compiler/backends/llvm/LlvmCompilerDefineFunctionTests.java b/src/test/java/org/shedlang/compiler/backends/llvm/LlvmCompilerDefineFunctionTests.java index 31b695eb..f49d03cd 100644 --- a/src/test/java/org/shedlang/compiler/backends/llvm/LlvmCompilerDefineFunctionTests.java +++ b/src/test/java/org/shedlang/compiler/backends/llvm/LlvmCompilerDefineFunctionTests.java @@ -1,18 +1,17 @@ package org.shedlang.compiler.backends.llvm; import org.junit.jupiter.api.Test; +import org.shedlang.compiler.ast.typed.FreeVariables; import org.shedlang.compiler.backends.llvm.ir.LlvmIrSerializer; import org.shedlang.compiler.backends.llvm.ir.ast.LlvmIr; import org.shedlang.compiler.backends.llvm.ir.ast.operands.LlvmOperand; import org.shedlang.compiler.sources.Sources; import org.shedlang.compiler.stackir.instructions.DefineFunctionInstruction; import org.shedlang.compiler.stackir.instructions.Instructions; -import org.shedlang.compiler.util.P; import org.zwobble.precisely.Matcher; import java.util.List; import java.util.Map; -import java.util.Set; import static org.shedlang.compiler.backends.llvm.ir.ast.LlvmIrMatchers.isLlvmVariableLocal; import static org.shedlang.compiler.util.Iterables.forEachInterspersed; @@ -26,7 +25,7 @@ public class LlvmCompilerDefineFunctionTests { "f", List.of(), List.of(), - Set.of(), + FreeVariables.empty(), List.of( Instructions.pushUnit(), Instructions.return_() @@ -75,7 +74,7 @@ public class LlvmCompilerDefineFunctionTests { "f", List.of(), List.of(), - P.orderedSet("a", "b"), + FreeVariables.of("a", "b"), List.of( Instructions.pushUnit(), Instructions.return_() diff --git a/src/test/java/org/shedlang/compiler/stackir/InstructionSerializerTests.java b/src/test/java/org/shedlang/compiler/stackir/InstructionSerializerTests.java index 4c1cc6e2..14e71249 100644 --- a/src/test/java/org/shedlang/compiler/stackir/InstructionSerializerTests.java +++ b/src/test/java/org/shedlang/compiler/stackir/InstructionSerializerTests.java @@ -1,6 +1,7 @@ package org.shedlang.compiler.stackir; import org.junit.jupiter.api.Test; +import org.shedlang.compiler.ast.typed.FreeVariables; import org.shedlang.compiler.sources.Sources; import org.shedlang.compiler.stackir.instructions.DefineFunctionInstruction; import org.shedlang.compiler.stackir.instructions.Instruction; @@ -9,7 +10,6 @@ import org.shedlang.compiler.types.NamespaceName; import java.util.List; -import static org.shedlang.compiler.util.Sets.orderedSetOf; import static org.zwobble.precisely.AssertThat.assertThat; import static org.zwobble.precisely.Matchers.equalTo; @@ -30,7 +30,7 @@ public class InstructionSerializerTests { "f", List.of(Instructions.param("p1"), Instructions.param("p2")), List.of(Instructions.param("n1"), Instructions.param("n2")), - orderedSetOf("fv1", "fv2"), + FreeVariables.of("fv1", "fv2"), List.of( Instructions.pushBool(true), Instructions.pushBool(false) -- cgit v1.2.3