aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-09-23 16:17:11 +0100
committerMichael Williamson <mike@zwobble.org>2023-09-23 16:17:11 +0100
commit121bb5c7e3d141d6baade166e42b58fef7c59c1c (patch)
tree64a0537865be6673f6f5b8b577866ef83e867852 /src/test/java
parent2047794b40b140675ef6f5ae7be83ae4ae603e02 (diff)
Store total element count in tuple-get instruction
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/shedlang/compiler/patio/PatioCodeGenTupleGetTests.java2
-rw-r--r--src/test/java/org/shedlang/compiler/stackir/InstructionSerializerTests.java4
-rw-r--r--src/test/java/org/shedlang/compiler/stackir/instructions/Instructions.java4
3 files changed, 5 insertions, 5 deletions
diff --git a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenTupleGetTests.java b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenTupleGetTests.java
index d50b8022..fc1cf272 100644
--- a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenTupleGetTests.java
+++ b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenTupleGetTests.java
@@ -15,7 +15,7 @@ import static org.shedlang.compiler.patio.PatioTesting.serialize;
public class PatioCodeGenTupleGetTests {
@Test
public void canGenerateCodeForTupleGet(Snapshotter snapshotter) throws IOException {
- var stackIr = Instructions.tupleGet(2);
+ var stackIr = Instructions.tupleGet(2, 3);
var context = PatioCodeGenContext.EMPTY
.temporaryPush(new PatioLocalRef("a"))
.temporaryPush(new PatioLocalRef("b"));
diff --git a/src/test/java/org/shedlang/compiler/stackir/InstructionSerializerTests.java b/src/test/java/org/shedlang/compiler/stackir/InstructionSerializerTests.java
index d6f4b830..b9166fac 100644
--- a/src/test/java/org/shedlang/compiler/stackir/InstructionSerializerTests.java
+++ b/src/test/java/org/shedlang/compiler/stackir/InstructionSerializerTests.java
@@ -305,11 +305,11 @@ public class InstructionSerializerTests {
@Test
public void canSerializeTupleGet() {
- var instruction = Instructions.tupleGet(2);
+ var instruction = Instructions.tupleGet(2, 3);
var string = serialize(instruction);
- assertThat(string, equalTo("(tuple-get 2)"));
+ assertThat(string, equalTo("(tuple-get 2 3)"));
}
@Test
diff --git a/src/test/java/org/shedlang/compiler/stackir/instructions/Instructions.java b/src/test/java/org/shedlang/compiler/stackir/instructions/Instructions.java
index 126ad1fa..ae1e0a4c 100644
--- a/src/test/java/org/shedlang/compiler/stackir/instructions/Instructions.java
+++ b/src/test/java/org/shedlang/compiler/stackir/instructions/Instructions.java
@@ -110,8 +110,8 @@ public class Instructions {
return new TupleCreateInstruction(elementCount, Sources.NULL);
}
- public static Instruction tupleGet(int elementIndex) {
- return new TupleGetInstruction(elementIndex, Sources.NULL);
+ public static Instruction tupleGet(int elementIndex, int elementCount) {
+ return new TupleGetInstruction(elementIndex, elementCount, Sources.NULL);
}
public static Instruction varLoad(String name) {