aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-07-20 11:31:51 +0100
committerMichael Williamson <mike@zwobble.org>2023-07-20 11:32:10 +0100
commita43868cec3986d17da9987caf89ccc137e3a48d4 (patch)
tree0f13314b1546b1767f06210d1534a049d5624c00 /src/test/java
parent0fdcc84a6eaf3664e5305055e389dde33553ad5e (diff)
Rename PatioLocal to PatioLocalRef
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/shedlang/compiler/patio/PatioCodeGenCallTests.java18
-rw-r--r--src/test/java/org/shedlang/compiler/patio/PatioCodeGenDiscardTests.java6
-rw-r--r--src/test/java/org/shedlang/compiler/patio/PatioCodeGenLocalStoreTests.java6
-rw-r--r--src/test/java/org/shedlang/compiler/patio/PatioCodeGenReturnTests.java6
-rw-r--r--src/test/java/org/shedlang/compiler/patio/instructions/Patio.java28
5 files changed, 32 insertions, 32 deletions
diff --git a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenCallTests.java b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenCallTests.java
index 39c47867..fc191166 100644
--- a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenCallTests.java
+++ b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenCallTests.java
@@ -2,7 +2,7 @@ package org.shedlang.compiler.patio;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import org.shedlang.compiler.patio.ast.PatioLocal;
+import org.shedlang.compiler.patio.ast.PatioLocalRef;
import org.shedlang.compiler.stackir.instructions.Instructions;
import org.shedlang.compiler.testing.snapshots.SnapshotResolver;
import org.shedlang.compiler.testing.snapshots.Snapshotter;
@@ -18,8 +18,8 @@ public class PatioCodeGenCallTests {
public void canCallFunctionWithNoArgs(Snapshotter snapshotter) throws IOException {
var instruction = Instructions.call(0, List.of());
var context = PatioCodeGenContext.EMPTY
- .temporaryPush(new PatioLocal("other"))
- .temporaryPush(new PatioLocal("receiver"));
+ .temporaryPush(new PatioLocalRef("other"))
+ .temporaryPush(new PatioLocalRef("receiver"));
var result = PatioCodeGen.generateInstruction(instruction, context);
@@ -30,12 +30,12 @@ public class PatioCodeGenCallTests {
public void canCallFunctionWithArgs(Snapshotter snapshotter) throws IOException {
var instruction = Instructions.call(2, List.of("b", "a"));
var context = PatioCodeGenContext.EMPTY
- .temporaryPush(new PatioLocal("other"))
- .temporaryPush(new PatioLocal("receiver"))
- .temporaryPush(new PatioLocal("pos1"))
- .temporaryPush(new PatioLocal("pos2"))
- .temporaryPush(new PatioLocal("namedB"))
- .temporaryPush(new PatioLocal("namedA"));
+ .temporaryPush(new PatioLocalRef("other"))
+ .temporaryPush(new PatioLocalRef("receiver"))
+ .temporaryPush(new PatioLocalRef("pos1"))
+ .temporaryPush(new PatioLocalRef("pos2"))
+ .temporaryPush(new PatioLocalRef("namedB"))
+ .temporaryPush(new PatioLocalRef("namedA"));
var result = PatioCodeGen.generateInstruction(instruction, context);
diff --git a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenDiscardTests.java b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenDiscardTests.java
index 6bf90f56..75aec63c 100644
--- a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenDiscardTests.java
+++ b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenDiscardTests.java
@@ -2,7 +2,7 @@ package org.shedlang.compiler.patio;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import org.shedlang.compiler.patio.ast.PatioLocal;
+import org.shedlang.compiler.patio.ast.PatioLocalRef;
import org.shedlang.compiler.stackir.instructions.Instructions;
import org.shedlang.compiler.testing.snapshots.SnapshotResolver;
import org.shedlang.compiler.testing.snapshots.Snapshotter;
@@ -17,8 +17,8 @@ public class PatioCodeGenDiscardTests {
public void discardInstructionPopsFromTemporaryStack(Snapshotter snapshotter) throws IOException {
var stackIr = Instructions.discard();
var context = PatioCodeGenContext.EMPTY
- .temporaryPush(new PatioLocal("a"))
- .temporaryPush(new PatioLocal("b"));
+ .temporaryPush(new PatioLocalRef("a"))
+ .temporaryPush(new PatioLocalRef("b"));
var result = PatioCodeGen.generateInstruction(stackIr, context);
diff --git a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenLocalStoreTests.java b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenLocalStoreTests.java
index af127819..186d81cb 100644
--- a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenLocalStoreTests.java
+++ b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenLocalStoreTests.java
@@ -2,7 +2,7 @@ package org.shedlang.compiler.patio;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import org.shedlang.compiler.patio.ast.PatioLocal;
+import org.shedlang.compiler.patio.ast.PatioLocalRef;
import org.shedlang.compiler.stackir.instructions.Instructions;
import org.shedlang.compiler.testing.snapshots.SnapshotResolver;
import org.shedlang.compiler.testing.snapshots.Snapshotter;
@@ -17,8 +17,8 @@ public class PatioCodeGenLocalStoreTests {
public void localStorePopsTemporaryIntoLocal(Snapshotter snapshotter) throws IOException {
var stackIr = Instructions.localStore("x");
var context = PatioCodeGenContext.EMPTY
- .temporaryPush(new PatioLocal("a"))
- .temporaryPush(new PatioLocal("b"));
+ .temporaryPush(new PatioLocalRef("a"))
+ .temporaryPush(new PatioLocalRef("b"));
var result = PatioCodeGen.generateInstruction(stackIr, context);
diff --git a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenReturnTests.java b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenReturnTests.java
index 44d24e5a..afe90a4c 100644
--- a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenReturnTests.java
+++ b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenReturnTests.java
@@ -2,7 +2,7 @@ package org.shedlang.compiler.patio;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import org.shedlang.compiler.patio.ast.PatioLocal;
+import org.shedlang.compiler.patio.ast.PatioLocalRef;
import org.shedlang.compiler.stackir.instructions.Instructions;
import org.shedlang.compiler.testing.snapshots.SnapshotResolver;
import org.shedlang.compiler.testing.snapshots.Snapshotter;
@@ -17,8 +17,8 @@ public class PatioCodeGenReturnTests {
public void returnInstructionGeneratesReturnInstruction(Snapshotter snapshotter) throws IOException {
var stackIr = Instructions.return_();
var context = PatioCodeGenContext.EMPTY
- .temporaryPush(new PatioLocal("a"))
- .temporaryPush(new PatioLocal("b"));
+ .temporaryPush(new PatioLocalRef("a"))
+ .temporaryPush(new PatioLocalRef("b"));
var result = PatioCodeGen.generateInstruction(stackIr, context);
diff --git a/src/test/java/org/shedlang/compiler/patio/instructions/Patio.java b/src/test/java/org/shedlang/compiler/patio/instructions/Patio.java
index 5924e1a0..cfb81d83 100644
--- a/src/test/java/org/shedlang/compiler/patio/instructions/Patio.java
+++ b/src/test/java/org/shedlang/compiler/patio/instructions/Patio.java
@@ -1,6 +1,6 @@
package org.shedlang.compiler.patio.instructions;
-import org.shedlang.compiler.patio.ast.PatioLocal;
+import org.shedlang.compiler.patio.ast.PatioLocalRef;
import org.shedlang.compiler.patio.ast.instructions.*;
import org.shedlang.compiler.sources.Sources;
@@ -10,7 +10,7 @@ public class Patio {
private Patio() {}
public static PatioInstruction alloc(String target, int bytes) {
- return new PatioAlloc(new PatioLocal(target), bytes, Sources.NULL);
+ return new PatioAlloc(new PatioLocalRef(target), bytes, Sources.NULL);
}
public static PatioInstruction callPointer(
@@ -19,35 +19,35 @@ public class Patio {
List<String> args
) {
return new PatioCallPointer(
- new PatioLocal(target),
- new PatioLocal(functionPointer),
+ new PatioLocalRef(target),
+ new PatioLocalRef(functionPointer),
args.stream()
- .map(arg -> new PatioLocal(arg))
+ .map(arg -> new PatioLocalRef(arg))
.toList(),
Sources.NULL
);
}
public static PatioInstruction functionPointerGet(String target, String name) {
- return new PatioFunctionPointerGet(new PatioLocal(target), name, Sources.NULL);
+ return new PatioFunctionPointerGet(new PatioLocalRef(target), name, Sources.NULL);
}
public static PatioInstruction intGet(String target, int value) {
- return new PatioIntGet(new PatioLocal(target), value, Sources.NULL);
+ return new PatioIntGet(new PatioLocalRef(target), value, Sources.NULL);
}
public static PatioInstruction localCopy(String target, String value) {
return new PatioLocalCopy(
- new PatioLocal(target),
- new PatioLocal(value),
+ new PatioLocalRef(target),
+ new PatioLocalRef(value),
Sources.NULL
);
}
public static PatioInstruction memoryLoad(String target, String pointer, int offset) {
return new PatioMemoryLoad(
- new PatioLocal(target),
- new PatioLocal(pointer),
+ new PatioLocalRef(target),
+ new PatioLocalRef(pointer),
offset,
Sources.NULL
);
@@ -55,14 +55,14 @@ public class Patio {
public static PatioInstruction memoryStore(String pointer, int offset, String value) {
return new PatioMemoryStore(
- new PatioLocal(pointer),
+ new PatioLocalRef(pointer),
offset,
- new PatioLocal(value),
+ new PatioLocalRef(value),
Sources.NULL
);
}
public static PatioInstruction return_(String value) {
- return new PatioReturn(new PatioLocal(value), Sources.NULL);
+ return new PatioReturn(new PatioLocalRef(value), Sources.NULL);
}
}